1. 程式人生 > >unity shadow

unity shadow

enc -c shadow ati ifd tex col fin art

這東西好難找LIGHT_ATTENUATION(a)

shadow 的結果就在這個衰減裏,這誰能猜的著,我一點點測出來的,reference也很難找

感謝這位http://blog.csdn.net/candycat1992/article/details/42460959

  1. #ifdef POINT
  2. #define LIGHTING_COORDS(idx1,idx2) float3 _LightCoord : TEXCOORD##idx1; SHADOW_COORDS(idx2)
  3. uniform sampler2D _LightTexture0;
  4. uniform float4x4 _LightMatrix0;
  5. #define TRANSFER_VERTEX_TO_FRAGMENT(a) a._LightCoord = mul(_LightMatrix0, mul(_Object2World, v.vertex)).xyz; TRANSFER_SHADOW(a)
  6. #define LIGHT_ATTENUATION(a) (tex2D(_LightTexture0, dot(a._LightCoord,a._LightCoord).rr).UNITY_ATTEN_CHANNEL * SHADOW_ATTENUATION(a))
  7. #endif
  8. #ifdef DIRECTIONAL
  9. #define LIGHTING_COORDS(idx1,idx2) SHADOW_COORDS(idx1)
  10. #define TRANSFER_VERTEX_TO_FRAGMENT(a) TRANSFER_SHADOW(a)
  11. #define LIGHT_ATTENUATION(a) SHADOW_ATTENUATION(a)
  12. #endif

unity shadow