纳金网

标题: Unity的shader,帮助手册(二) [打印本页]

作者: 会飞的鱼    时间: 2011-12-19 17:20
标题: Unity的shader,帮助手册(二)


We'll start with a very basic shader:

  下面开始介绍一个基础的shader范例:
Shader "Tutorial/Basic" {   

     Properties {   

         _Color ("Main Color", Color) = (1,0.5,0.5,1)   

     }   

     SubShader {   

         Pass {   

             Material {   

                 Diffuse [_Color]   

             }   

             Lighting On   

         }   

     }   

}  

Shader "Tutorial/Basic" {

     Properties {

         _Color ("Main Color", Color) = (1,0.5,0.5,1)

     }

     SubShader {

         Pass {

             Material {

                 Diffuse [_Color]

             }

             Lighting On

         }

     }

}


This simple shader demonstrates one of the most basic shaders possible. It defines a color property called Main Color and assigns it a default value of rose-like color (red=100% green=50% blue=50% alpha=100%). It then renders the object by invoking a Pass and in that pass setting the diffuse material component to the property _Color and turning on the vertex lighting.

  这个shader范例只是众多shader中最基本的一个,它定义了一个颜色性质,名称为Main Color,并指定了玫瑰色的效果(red=100% green=50% blue=50% alpha=100%),在调用时会跳过Diffuse的材质设定(_Color)并开启顶点光源
To test this shader, create a new material, select the shader from the drop-down menu (Tutorial->Basic) and assign the Material to some object. Tweak the color in the Material Inspector and watch the changes. Time to move onto more complex things!

  要测试这个shader,你可以建立一个新的材质,并于Shader下拉菜单选择(Tutorial->Basic),再把这个新材质指定到物件上,拖拉材质检视器的颜色表并查看其变化。是时候研究更复杂的事情了!
Basic Vertex Lighting

If you open an existing complex shader, it can be a bit hard to get a good overview. To get you started, we will dissect the built-in VertexLit shader that ships with Unity. This shader uses fixed function pipeline to do standard per- vertex lighting.
作者: 奇    时间: 2012-2-26 23:32
爱咋咋地!

作者: 奇    时间: 2012-4-5 23:28
凡系斑竹滴话要听;凡系朋友滴帖要顶

作者: 浩劫    时间: 2012-4-6 19:31

作者: 未完结    时间: 2012-4-6 19:34
爱生活,爱纳金网,爱web3D。。。。
作者: 奇    时间: 2012-4-30 23:21
我无语!

作者: 奇    时间: 2012-6-4 23:18
我就看看,我不说话

作者: 奇    时间: 2012-6-19 23:22
先垫一块,再说鸟

作者: tc    时间: 2012-9-3 01:25
非常感谢,管理员设置了需要对新回复进行审核,您的帖子通过审核后将被显示出来,现在将转入主题

作者: tc    时间: 2012-9-26 23:30
好可爱的字,学习了

作者: tc    时间: 2013-2-5 23:36
不错哦,谢谢楼主

作者: pochenshu    时间: 2013-2-25 17:15
爱生活,爱纳金网,爱web3D。。。。





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