这东西好难找LIGHT_ATTENUATION(a)
shadow 的结果就在这个衰减里,这谁能猜的着,我一点点测出来的,reference也很难找
感谢这位http://blog.csdn.net/candycat1992/article/details/42460959
- #ifdef POINT
- #define LIGHTING_COORDS(idx1,idx2) float3 _LightCoord : TEXCOORD##idx1; SHADOW_COORDS(idx2)
- uniform sampler2D _LightTexture0;
- uniform float4x4 _LightMatrix0;
- #define TRANSFER_VERTEX_TO_FRAGMENT(a) a._LightCoord = mul(_LightMatrix0, mul(_Object2World, v.vertex)).xyz; TRANSFER_SHADOW(a)
- #define LIGHT_ATTENUATION(a) (tex2D(_LightTexture0, dot(a._LightCoord,a._LightCoord).rr).UNITY_ATTEN_CHANNEL * SHADOW_ATTENUATION(a))
- #endif
- #ifdef DIRECTIONAL
- #define LIGHTING_COORDS(idx1,idx2) SHADOW_COORDS(idx1)
- #define TRANSFER_VERTEX_TO_FRAGMENT(a) TRANSFER_SHADOW(a)
- #define LIGHT_ATTENUATION(a) SHADOW_ATTENUATION(a)
- #endif