Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

GetMainLight in shader in URP does not respect light culling mask

Discussion in 'Graphics Experimental Previews' started by JacobFast, Jun 2, 2020.

  1. JacobFast


    Apr 29, 2014

    Light GetMainLight(float4 shadowCoord)
    Light light = GetMainLight();
    light.shadowAttenuation = MainLightRealtimeShadow(shadowCoord);
    return light;

    When using this method there is no way to set a certain light as main for certain material and it does not respect Light.cullingmask settings. All materials receive same main light settings.

    I would expect shader when using this method should set main light with culling mask setting in mind.

    If there is work around i would appreciate it.
    Pawciu and D1234567890 like this.
  2. D1234567890


    Aug 11, 2019
    This feature does work in the built-in renderer. And the feature table for URP does include light culling per layer and per object.

    I have submitted a bug report. I recommend submitting a bug report in cases like this as a fix could have been in the works already :^)