纳金网

标题: [Unity 组件参考手册]iOS:透明着色器系列之高光透明 [打印本页]

作者: .    时间: 2013-2-21 17:01
标题: [Unity 组件参考手册]iOS:透明着色器系列之高光透明
This shader can make mesh geometry partially or fully transparent by reading the alpha channel of the main texture. In the alpha, 0 (black) is completely transparent while 255 (white) is completely opaque. If your main texture does not have an alpha channel, the object will appear completely opaque.这个着色器可以通过读取基础纹理贴图的Alpha通道控制对象全部或部分透明。在Alpha表达中,0(纯黑)是完全的透明而255(纯白)是完全的不透明。如果您的基础纹理贴图不含有Alpha通道,对象会完全不透明显示。Using transparent objects in your game can be tricky, as there are traditional graphical programming problems that can present sorting issues in your game. For example, if you see odd results when looking through two windows at once, you're experiencing the classical problem with using transparency. The general&nbsp***le is to be aware that there are some cases in which one transparent object may be drawn in front of another in an unusual way, especially if the objects are intersecting, enclose each other or are of very different sizes. For this reason, you should use transparent objects if you need them, and try not to let them become excessive. You should also make your designer(s) aware that such sorting problems can occur, and have them prepare to change some design to work around these issues.在游戏中使用透明对象可能会比较棘手,因为传统图形编程中的一些问题会在你的游戏中出现。例如,如果你在透过两个窗子观察看到奇怪的结果时,你在体验使用透明的的经典问题。一般的规则是要知道有些情况下在一个透明对象前面绘制另外一个透明对象的时候会出现不正常的现象,特别是在透明对象相交、互为包含或者尺寸上有着很大的差异。因此,如果你需要使用透明对象,要注意不要让它们过大。你也需要告诉美工师这些问题让他们在设计上做出适当的修改。
Specular Properties 高光属性Specular computes the same simple (Lambertian) lighting as Diffuse, plus a viewer dependent specular highlight. This is called the Blinn-Phong lighting model. It has a specular highlight that is dependent on surface angle, light angle, and viewing angle. The highlight is actually just a realtime-suitable way to simulate blurred reflection of the light source. The level of blur for the highlight is controlled with the Shininess slider in the Inspector.高光同漫反射一样进行简单的(兰伯特)照明计算的同时,附加显示一个高光点。这个称为Blinn-Phong光照模型。它有一个依靠曲面角度、入射光角度及观察角度而产生的高光点。这个高光点其实是一个实时表现光源模糊反射的方式,高光的模糊层次由Inspector面板中的Shininess(反光)滑标参数控制。Additionally, the alpha channel of the main texture acts as a Specular Map (sometimes called "gloss map"), defining which areas of the object are more reflective than others. Black areas of the alpha will be zero specular reflection, while white areas will be full specular reflection. This is very useful when you want different areas of your object to reflect different levels of specularity. For example, something like&nbsp***sty metal would use low specularity, while polished metal would use high specularity. Lipstick has higher specularity than skin, and skin has higher specularity than cotton clothes. A well-made Specular Map can make a huge difference in impressing the player.另外,基础纹理贴图的alpha通道作为高光贴图(有时称为“光泽贴图”),定义了对象上的某个地方比其它地方更反光。Alpha通道黑色区域是0高光反射区域,而白色区域是全反射区域。这在你需要游戏对象具有不同的高光反射层次时很有用。例如,腐蚀的金属用低高光,而抛光金属应用强高光。唇膏应该比皮肤有更强的高光,而皮肤应该比纯棉衣服更反光。一个精致的高光贴图可以给玩家一个截然不同的印象。
Performance 性能表现Generally, this shader is moderately expensive to render. For more details, please view the Shader Peformance page.通常来讲这个着色器系统资源耗费一般。如果希望获取更多的细节信息,可以参考着色器性能章节。
【来源:互联网】
更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/




欢迎光临 纳金网 (http://wwww.narkii.com/club/) Powered by Discuz! X2.5