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

内置着色器指南之标准着色器家族:法线贴图高光着色器

[复制链接]
.    

3797

主题

11

听众

5万

积分

首席设计师

Rank: 8Rank: 8

纳金币
32328
精华
41

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

跳转到指定楼层
楼主
发表于 2013-2-20 17:11:17 |只看该作者 |倒序浏览
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.和 Diffuse Shader类似,计算一个简单的(Lambertian)光照模型。光照强度随着物体表面和光入射角之间夹角的角度减小而减小。光照强度仅依赖于此角度,摄像机的移动和旋转无法改变光照强度。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.使用Normal mapping贴图来表现物体表面细节,而不是通过增加多边形细分表现细节。它实际上没有改变物体的形状,而是采用了一种叫做Normal Map的特殊贴图实现这一效果。在Normal map中,每个像素颜色代表该像素在物体表面的法线角度。然后通过这个法线来计算几何学及光照。当计算物体高光时Normal Map有效地优化了物体模型网格。
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页。
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:此处的Normal Map 是一种正切空间的Normal Map类型。正切空间是一个跟随物体模型表面的空间。在这个空间中,Z轴始终从表面指向外面。Tangent space 相对于另一种 Object space空间类型复杂一些,但是它有一些优势。    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.
    比较适合应用于物体模型的不同区域,或者应用在不同的模型间。 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.Specular 和 Diffuse 使用同样简单的光照模型,另外增加了一个和观察角度相关的反射高光。这个叫做Blinn-Phong 高光模型。它包含了一个反射高光,取决于物体反射高光物体表面角度,光线入射角度和观察角度。这种高光计算方法实际上恰好是模拟实时光源模糊反射的一种方法。高光模糊等级通过检视面板里的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通道用来做Specular Map(反射贴图,多数时候称作'Gloss Map') ,定义物体反光区域大小(物体反光率),Alpha通道中黑色区域反光率为零(完全不反光),白色区域反光率为100%(完全反光)。这在想要让物体的不同区域呈现不同反光率时非常有用。比如:生锈的金属会有比较低的反光率,而精制的磨光金属会有比较高的反光率。口红的反光率比皮肤高,而皮肤比棉质的衣服反光率高。一个精心制作的Specular Map能够给玩家产生巨大影响,印象深刻。
Performance 性能Generally, this shader is moderately expensive to render. For more details, please view the Shader Peformance page.一般情况下,这个Shader比较耗费渲染资源。更多详细资料请查看Shader Peformance页面。
【来源:互联网】
更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

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

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

GMT+8, 2024-11-23 13:06 , Processed in 0.091173 second(s), 32 queries .

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

© 2008-2019 Narkii Inc.

回顶部