TGE学习笔记03 - 透明纹理

今天被透明纹理烦恼了一下,使用了透明纹理的物体渲染顺序总是固定的,不管怎么修改都没用,明明是插件导出的设置问题,可是里里外外翻了N多遍,都没发现插件的相关设置。
最后,又回到上一篇我们提到的那篇教程才找到答案。其实就一句话,使用透明纹理的物体需要加前缀SORT::,强制导出插件对顶点重新排序,以按照正确的顺序渲染。

Simple Shape with Double Sided Materials and Translucency
  1. 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.

    Figure 7

    Figure 7

  2. 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.

  3. 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.

Figure 8

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.

Simple Shape with Translucency and Sorting

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).

Figure 9

Figure 9

转载于:https://www.cnblogs.com/gamesacer/archive/2008/02/25/1080996.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值