Light Culling Mask does not work in URP

Hello.

Using Unity 2020.3.7.

Light Culling Mask does not work in URP.

  1. I added 2 layers. ( Character , Background )
  2. Set the layer of the character object to character.
  3. Added directional light.
  4. Set the culling mask of the directional light to background.
  5. A light is applied to the character object.
  • In the shader code we are doing additional lights calculations.

Does anyone know why not?
If not, is there any other way?

thanks

I found the cause.

I am using custom shaders.

Light mainLight = GetMainLight();
half NdotL = dot(input.normalWS, mainLight.direction);
half3 lightColor = mainLight.color;

Since we only use directional lights, we don’t use distance Attenuation.
For other layers, the distance Attenuation value is 0.

Light mainLight = GetMainLight();
half NdotL = dot(input.normalWS, mainLight.direction);
half3 lightColor = mainLight.color * mainLight.distanceAttenuation;

thanks