|
|
|
|
|
|
static float4 debugLighting; |
|
|
|
|
|
|
|
int _LightIndexForShadowMatrixArray; |
|
|
|
int _useLegacyCookies; |
|
|
|
|
|
|
|
void OnChipDeferredCalculateLightParams ( |
|
|
|
unity_v2f_deferred i, |
|
|
|
|
|
|
|
|
|
|
float4 uvCookie = mul (unity_WorldToLight, float4(wpos,1)); |
|
|
|
colorCookie = tex2Dlod (_LightTexture0, float4(uvCookie.xy / uvCookie.w, 0, 0)); |
|
|
|
[branch]if (_useLegacyCookies) { |
|
|
|
colorCookie.xyz = 1; |
|
|
|
} |
|
|
|
|
|
|
|
float atten = colorCookie.w; |
|
|
|
atten *= uvCookie.w < 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined (DIRECTIONAL_COOKIE) |
|
|
|
colorCookie = tex2Dlod (_LightTexture0, float4(mul(unity_WorldToLight, half4(wpos,1)).xy, 0, 0)); |
|
|
|
[branch]if (_useLegacyCookies) { |
|
|
|
colorCookie.xyz = 1; |
|
|
|
} |
|
|
|
atten *= colorCookie.w; |
|
|
|
#endif //DIRECTIONAL_COOKIE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined (POINT_COOKIE) |
|
|
|
colorCookie = texCUBElod(_LightTexture0, float4(mul(unity_WorldToLight, float4(wpos,1)).xyz, 0)); |
|
|
|
[branch]if (_useLegacyCookies) { |
|
|
|
colorCookie.xyz = 1; |
|
|
|
} |
|
|
|
atten *= colorCookie.w; |
|
|
|
#endif //POINT_COOKIE |
|
|
|
#else |
|
|
|