Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Grabbing Point Light intensity in URP Shader

Discussion in 'Universal Render Pipeline' started by psuong, Jun 1, 2022.

  1. psuong

    psuong

    Joined:
    Jun 11, 2014
    Posts:
    118
    In the builtin render pipeline _LightColor0 is a pretty convenient variable, if you want to grab the color/intensity of a light. However, in URP, _LightColor0 is no longer valid for point lights, instead they are grabbed via GetAdditionalLights in Lighting.hlsl.

    In the light struct, the color variable, is equal to the Light's baseColor * intensity. If the baseColor and intensity can be any value, is there a convenient way to determine the intensity of the point light?

    I'm currently on URP 12.1.6.
     
    Sam_Hedges likes this.
  2. honeyeoz

    honeyeoz

    Joined:
    Nov 10, 2020
    Posts:
    2
    I use this experience formula to calculate intensity value.

    0.299 * light.color.r + 0.587 * light.color.g + 0.114 * light.color.b
     
  3. honeyeoz

    honeyeoz

    Joined:
    Nov 10, 2020
    Posts:
    2
    BTW how to get point light range value in urp shader?