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

    JacobFast

    Joined:
    Apr 29, 2014
    Posts:
    47
    \Library\PackageCache\com.unity.render-pipelines.universal@7.3.1\ShaderLibrary\Lighting.hlsl

    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

    D1234567890

    Joined:
    Aug 11, 2019
    Posts:
    72
    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 :^)