Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug URP GetAdditionalLight() in custom node not returning directional information for punctual lights

Discussion in 'Shader Graph' started by brn, Apr 23, 2021.

  1. brn

    brn

    Joined:
    Feb 8, 2011
    Posts:
    320
    Just posting this here to see if anyone else is having this problem in 2020.3 and 2021.1.4

    Looks as if the w component of the LightPositionWS in Light GetAdditionalPerObjectLight(int perObjectLightIndex, float3 positionWS) is not set correctly.

    float3 lightVector = lightPositionWS.xyz - positionWS * lightPositionWS.w;

    from Lighting.hlsl

    In short Spot and Point Lights end up behaving like a fixed Directional.
    It must be working to some degree because the Lit Master stack behaves properly.

    I'll check this further and post up more info.

    If anyone else is having the same issue I'll submit a bug report and request a fix. Its a fundamental problem and makes working with custom lighting on anything but the main light problematic.

    If you can confirm that you have custom lighting working properly on additional lights in either 2020.3 and 2021.1.4 that would be just as handy and I'll accept that the problem is some where between the keyboard and my chair.

    Cheers,
    Brn
     
  2. cosydark_unity

    cosydark_unity

    Joined:
    Oct 22, 2022
    Posts:
    1
    Wow it's been two yearsXD.
    please try:
    GetAdditionalPerObjectLight(int perObjectLightIndex, float3 positionWS, float4(1,1,1,1));
    instead