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

Question Is it possible to get nearest point light positions in a custom .hlsl node?

Discussion in 'Shader Graph' started by melos_han_tani, Aug 10, 2020.

  1. melos_han_tani

    melos_han_tani

    Joined:
    Jan 11, 2018
    Posts:
    78
    I was interested in using this data to do custom point-lighting attenuation (the default attenuation is sketchy and doesn't interact well with custom cel shading models).

    I'm using

    Light light = GetAdditionalLight(i, WorldPosition);

    to get my point lights, but investigation of Lighting.hlsl in the URP package shows that there is no distance data included, although there is an array which contains the lighting positions (which I can't figure out how to access.) I considered editing the Lighting.hlsl to expose the needed data but... that seems wrong and weird? Also I feel like doing that might retrigger recompiling every shader.