查看: 2671|回复: 0
打印 上一主题 下一主题

[Unity 组件参考手册]iOS:透明着色器系列之凹凸效果漫反射透明

[复制链接]
.    

3797

主题

11

听众

5万

积分

首席设计师

Rank: 8Rank: 8

纳金币
32328
精华
41

活跃会员 优秀版主 荣誉管理 论坛元老

跳转到指定楼层
楼主
发表于 2013-2-21 17:02:58 |只看该作者 |倒序浏览
Transparent Properties 透明属性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.在游戏中使用透明对象可能会比较棘手,因为传统图形编程中的一些问题会在你的游戏中出现。例如,如果你在透过两个窗子观察看到奇怪的结果时,你在体验使用透明的的经典问题。一般的规则是要知道有些情况下在一个透明对象前面绘制另外一个透明对象的时候会出现不正常的现象,特别是在透明对象相交、互为包含或者尺寸上有着很大的差异。因此,如果你需要使用透明对象,要注意不要让它们过大。你也需要告诉美工师这些问题让他们在设计上做出适当的修改。
Normal Mapped Properties 法线贴图属性Like a Diffuse shader, this computes a simple (Lambertian) lighting model. The lighting on the surface decreases as the angle between it and the light decreases. The lighting depends only on the this angle, and does not change as the camera moves or rotates around.类似于漫反射着色器,这是一个简单的(兰伯特)光照模型。对象表面上的光照随着与入射光夹角的减小而减小。光照效果只与这个夹角有关,与摄像机的移动位置与旋转角度无关。Normal mapping simulates small surface details using a texture, instead of spending more polygons to actually carve out details. It does not actually change the shape of the object, but uses a special texture called a Normal Map to achieve this effect. In the normal map, each pixel's color value represents the angle of the surface normal. Then by using this value instead of the one from geometry, lighting is computed. The normal map effectively overrides the mesh's geometry when calculating lighting of the object.法线映射使用纹理贴图来模拟表面细节,而不是使用更多的多边形真正的雕刻出来。它没有真正的改变对象的形状,而是使用了一种命名为法线贴图的特殊纹理贴图获得效果。在法线贴图中,每个像素的颜色值代表了表面法线的角度。光照根据这个贴图来计算入射角度而不是真正的参考光源与对象的关系。法线贴图在进行对象光照计算时有效的节省了几何体的网格数。
Creating Normal maps 创建法线贴图You can import a regular grayscale image and convert it to a Normal Map from within Unity. To learn how to do this, please read the Normal map FAQ page.你可以输入一个常规的灰度图像并在Unity中将它转化成法线贴图。想学习如何做到这一点,可以参考Normal map FAQ page(法线贴图常见问题页面)。
Technical Details 技术细节The Normal Map is a tangent space type of normal map. Tangent space is the space that "follows the surface" of the model geometry. In this space, Z always points away from the surface. Tangent space Normal Maps are a bit more expensive than the other "object space" type Normal Maps, but have some advantages:法线贴图是切线空间类型,切线空间是指“沿着表面变化”的空间。在这个空间中,Z轴总是从表面指向外面的。切线空间法线贴图会比其它“对象空间”类型的法线贴图昂贵一点(指资源消耗方面---译者注),但有着些许优势。    It's possible to use them on deforming models - the bumps will remain on the deforming surface and will just work.
    可以将他们用于变形模型--凹凸效果会在变形面上呈现。
    It's possible to reuse parts of the normal map on different areas of a model; or use them on different models.
    可以在模型的不同区域上重复使用部分法线贴图;或者将它们用在不同的模型上。 Diffuse Properties 漫反射属性Diffuse computes a simple (Lambertian) lighting model. The lighting on the surface decreases as the angle between it and the light decreases. The lighting depends only on the this angle, and does not change as the camera moves or rotates around.漫反射运算是一个简单的(兰伯特)光照模型。对象表面上的光照随着与入射光夹角的减小而减小。光照效果只与这个夹角有关,与摄像机的移动位置与旋转角度无关。
Performance 性能表现Generally, this shader is cheap to render. For more details, please view the Shader Peformance page.通常来讲,这个着色器渲染是廉价的。更多细节,请参考Shader Peformance page.  【来源:互联网】
更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2024-11-10 15:30 , Processed in 0.096432 second(s), 31 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部