[Unity Shader笔记]渲染路径–Forward渲染路径
(2014-04-22 20:08:25)
unity
renderingpath
forward
游戏
*ForwardBase、ForwardAdd的LightMode只能运行在Came为Forward、DeferredLighting的渲染模式下
*ForwardAdd这个Pass需要和ForwardBase一起使用,否则会被Unity忽视掉
* ForwardBase只对1个有效灯光执行一次
* ForwardAdd对除了ForwardBase用的那个灯光外的所有有效灯光都执行1次,所以会被执行多次 LightMode=Forward中的_WorldSpaceLightPos0,_LightColor0*灯光在ForcePixel模式下才有效*如果只有一个平行灯光,ForwardAdd中使用不到灯光数据*ForwardBase的Pass中,灯光需要是方向光
*ForwardAdd优先点光源,
* ForwardAdd优先灯光比较暗的,ForwardBase优先比较亮的 。他们正好相反
LightMode=ForwardBase(只有这一个的情况下)中的unity_4LightPosZ0[3], unity_4LightAtten0[3], unity_LightColor[3], unity_LightColor3*只对点光源有效
*灯光在ForcePixel,ForceVertex模式下都有效,ForcePixel的优先
*灯光范围必须覆盖目标
*灯光亮度必须大于0*对灯光强度排序,亮的优先。 LightMode=ForwardBase(包含ForwardAdd,Blend Zero One)中的unity_LightColor[3], unity_LightColor3
*只对点灯光有效*当只有一个点灯光时ForcePixel,ForceVertex都有效*当有多个点灯光时,如果其中有是ForceVertex的。则只有ForceVertex有效,ForcePixel无效*当有多个点灯光时,如果都是ForceVertex。则有效
*灯光数据是在世界坐标内 LightMode=ForwardAdd(Blend One Zero)中的unity_LightColor[3], unity_LightColor3*首先需要有两个ForcePixel的方向光或者一个ForcePixel的点光为前提条件
*需要是ForceVertex的点等光才有效*当开始有几个满足效果,把他们一个一个设置为不满足时unity_LightColor[3]会残留一个未被清理的数据,所以建议使用unity_LightColor3 LightMode=ForwardBase(只有这一个的情况下)中的unity_LightPosition[3], unity_LightAtten[3]*没有数据
LightMode=ForwardAdd(Blend One Zero)中的unity_LightPosition[3], unity_LightAtten[3]*没有数据
*有其他材质球时unity_LightPosition[3]会看到那些残留数据 说明*灯光强度:会由灯光的color,intensity,离目标的距离等这些因素影响