Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    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:
    65
    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 :^)