1

Recently, a customer tried our 3D platform. When importing the model, the model appeared completely black and invisible. The last article talked about the situation in total darkness. This article talks about invisible situations.

After testing, it was found that there may be the following two situations.

The imported model is not in the field of view

The imported model is not within the field of view of the lens, so the model cannot be seen. It is possible that the model is not in the field of view, or the position of the model exceeds the far parameter value of the lens. In this case, adjust the lens parameters (including position, center, far, etc.).

The modeling center of the model is not at the geometric center

A relatively hidden situation is that the modeling center point of the model is not in the geometric center of the model itself, and the modeling center is outside the model itself. At this time, although the position of the model is within the field of view of the lens, all the vertices of the model are in Out of the lens field of view. In this case, you can check the center value of the model boudingbox. If the center value does not deviate a lot from (0,0,0), it means that the modeling center of the model is very far from the geometric center of the model itself. In this case, the modeler needs to adjust the model and adjust the modeling center to the geometric center (at least nearby).

Model size is too small

Another situation is that the size of the model is too small and the lens is far away. Although the lens can see the model at this time, it may not be seen by the human eye because it is too small. In this case, you can check the size value of the model's boudingbox to see how the size is. If it is too small, it is recommended that the modeler adjust it and increase the size.

Model is fully transparent

When importing the obj model, sometimes the model is completely transparent. In this case, the tr parameter in the mtl file is set to 1. When tr is equal to 1, the opacity will be set to 1-tr, the code is as follows:

case 'tr':
    n = parseFloat( value );
       if ( this.options && this.options.invertTrProperty ) n = 1 - n;
       if ( n > 0 ) {
        params.opacity = 1 - n;
        params.transparent = true;

        if(params.opacity === 0) {
            console.warn( "opacity is 0");
        }

    }

    break;

You can directly modify the mtl file manually to remove the tr related parameter settings, or let the modeler not export the tr parameters when exporting the model.

Concluding remarks

The modified effect is as shown in the figure below:

image.png

If you are interested in visualization, you can communicate with me on WeChat 541002349. Pay attention to the public account "ITMan Biaoshu" to receive more valuable articles in time.


netcy
204 声望120 粉丝

欢迎对canvas、webgl、图形学感兴趣的读者订阅专栏。