学习Unity3d Shader笔记:用到的一些对象和关键字纪录

来源:互联网 发布:java商城项目 编辑:程序博客网 时间:2024/06/05 22:35
SurfaceOutput

struct SurfaceOutput 

{

    half3 Albedo; //反射率

    half3 Normal; //法线

    half3 Emission; //自发光,用于增强物体自身的亮度,使之看起来好像可以自己发光

    half Specular; //镜面

    half Gloss; //光泽

    half Alpha; //透明

} ;




Properties

定义属性块,其中可包含多个属性,其定义如下
name ("display name", Range (minmax)) = number
Defines a float property, represented as a slider from min to max in the inspector. 
定义浮点数属性,在检视器中可通过一个标注最大最小值的滑条来修改。
name ("display name", Color) = (number,number,number,number)
Defines a color property. 
定义颜色属性
name ("display name", 2D) = "name" { options }
Defines a 2D texture property. 
定义2D纹理属性
name ("display name", Rect) = "name" { options }
Defines a rectangle (non power of 2) texture property. 
定义长方形(非2次方)纹理属性
name ("display name", Cube) = "name" { options }
Defines a cubemap texture property. 
定义立方贴图纹理属性
name ("display name", Float) = number
Defines a float property. 
定义浮点数属性
name ("display name", Vector) = (number,number,number,number)
Defines a four component vector property. 
定义四个向量组成的属性



表面着色器中的自定义光照模式

  • half4 LightingName (SurfaceOutput s, half3 lightDir, half atten); 
  • 这是在正向渲染路径(forward rendering path)中使用的光照模式。它不是取决于视图方向的(view direction)。例如:漫反射(diffuse)。
  • half4 LightingName (SurfaceOutput s, half3 lightDir, half3 viewDir, half atten);
  • 这是在正向渲染路径(forward rendering path)中使用的光照模式。它取决于视图的方向(view direction)。
  • half4 LightingName_PrePass (SurfaceOutput s, half4 light); 
  • 这是在延时光照路径(deferred lighting path)中使用的。
  • //lightDir :点到光源的单位向量   viewDir:点到摄像机的单位向量   atten:衰减系数

  • 0 0
    原创粉丝点击