Hello
I’m trying to make a spotlight use the R channel instead of alpha in cookie textures.
I tried changing AutoLight.cginc file but I’m not seeing any changes when I rebuild my shader. I tried changing the cookie textures to fixed4 instead of fixed. Then I removed the .w from the UnitySpotCookie function and tried using the R channel as the alpha.
I changed the bolded parts:
#ifdef SPOT
uniform sampler2D _LightTexture0;
uniform unityShadowCoord4x4 _LightMatrix0;
uniform sampler2D _LightTextureB0;
// Changed fixed to fixed4
inline fixed**4** UnitySpotCookie(unityShadowCoord4 LightCoord)
{
// Removed .w at the end of the function
return tex2D(_LightTexture0, LightCoord.xy / LightCoord.w + 0.5**);**
}
inline fixed UnitySpotAttenuate(unityShadowCoord3 LightCoord)
{
return tex2D(_LightTextureB0, dot(LightCoord, LightCoord).xx).UNITY_ATTEN_CHANNEL;
}
#define UNITY_LIGHT_ATTENUATION(destName, input, worldPos)
unityShadowCoord4 lightCoord = mul(_LightMatrix0, unityShadowCoord4(worldPos, 1));
// Added .r at after UnitySpotCookie
fixed destName = (lightCoord.z > 0) * UnitySpotCookie(lightCoord).r * UnitySpotAttenuate(lightCoord.xyz) * SHADOW_ATTENUATION(input);
#endif
Could someone help me out?