Search Unity

Question Can't compile shader because _ShadowMapTexture in cginc

Discussion in 'Shaders' started by agolho, Dec 21, 2022.

  1. agolho

    agolho

    Joined:
    Jul 19, 2015
    Posts:
    2
    Hey folks,

    Here I have a sample from the cginc file. The defining part of _ShadowMapTexture gives me a compiling error. Saying that its undeclared. Any ideas on how to declare it?

    Code (CSharp):
    1. inline fixed SampleShadow(float4 shadowCoord)
    2. {
    3.     #if defined(SHADOWS_SCREEN)
    4.     fixed shadow = UNITY_SAMPLE_SHADOW(_ShadowMapTexture, shadowCoord.xyz);
    5.     return _LightShadowData.r + shadow * (1 - _LightShadowData.r);
    6.     #endif
    7.     return 1.0;
    8. }
    9.  
    10. inline fixed4 ApplyShadow(fixed4 color, float depth, float4 shadowCoord)
    11. {
    12.     fixed attenuation = SampleShadow(shadowCoord);
    13.     fixed shadow = 1 - attenuation;
    14.  
    15.     float blend = 1 - (depth - _ShadowMinDistance) / (_ShadowMaxDistance - _ShadowMinDistance);
    16.     shadow = shadow * saturate(blend) * _ShadowIntensity;
    17.  
    18.     return lerp(color, _ShadowColor, shadow);
    19. }