unity shadow
阿新 • • 發佈:2017-10-20
enc -c shadow ati ifd tex col fin art
這東西好難找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
unity shadow