最后,又回到上一篇我们提到的那篇教程才找到答案。其实就一句话,使用透明纹理的物体需要加前缀SORT::,强制导出插件对顶点重新排序,以按照正确的顺序渲染。
-
Open the file SimpleShape4.max and load the associated texture SimpleTexture4.png in the material editor. These files are located in the documentation file pack. The texture map is shown in Figure 7.
-
You will see that the material applied to the shape is a translucent .png. In the material editor, check the "2-sided" option.
Note
Making this material double sided is important because you will be seeing the inside of the object through the translucent sections of the texture map. On most objects, double sided textures are a bad idea because they will double the number of surfaces rendered, yet never be visible to the user.
-
In the DTS Exporter settings in the utility panel, make sure 'Enable 2-sided materials' is checked in the Parameters rollout. This tells the exporter to expect double sided textures. If this is not checked, the exporter will ignore the double sided texture and export it as normal.
Export the shape. Checking Translucency in the ShowTool. You will see something resembling Figure 8.
You will note, that the shape is all screwed up. Things are not drawing in the correct order. Some of the polygons are drawing in front of other polygons. This is due to the way translucent shapes are drawn in the engine. More details on why this happens is covered in Appendix ????. In order for translucent shapes to draw correctly they must be forced to sort in the correct order. The next section will discuss how this is done.
Warning
It is important that transparency sorting only be used on simple shapes. SORT:: subdivides the polygons of the shape in order to correctly display their transparency, but the complexity of the shape created increases geometrically with the number of polygons sorted. The technical details of transparency sorting are covered in detail in Appendix ????.
Procedure 8.10. Setting up the SORT:: function
-
Select the SimpleShape and prepend the name of the object with "SORT::". It should now be named "SORT::SimpleBox2" This will tell the exporter that this object may have trouble sorting and it will take extra steps to ensure it sorts correctly.
Re-export the shape and open it in the ShowTool. It now sorts correctly, as shown in figure 9. The exporter has split some of the faces so that it the rendering engine can tell which faces are in front more easily. This increases the polygon count of the shape (you can check this in the detail level window in the showtool).