Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question How can I access additional light shadow in post process shader?

Discussion in 'Universal Render Pipeline' started by cyanryanlion, Nov 29, 2022.

  1. cyanryanlion

    cyanryanlion

    Joined:
    Feb 17, 2020
    Posts:
    25
    Normally in a shader rendering a mesh I can access the additional light shadow attenuation for a world position by doing something like this:


    int pixelLightCount = GetAdditionalLightsCount();
    for (int i = 0; i < pixelLightCount; ++i)
    {
    Light light = GetAdditionalLight(i, WorldPosition, shadowMask);
    shadow *= light.shadowAttenuation;
    }


    But when rendering in a post process shader the additional light arrays aren't available. I can get the world position of a pixel via the depth buffer info, but how do I then get shadow attenuation of that world position?

    Thank you to anyone who reads over this and could offer any insight.

    For context I'm using Unity 2022.2.0b16, URP 14.0.3 and attempting to make a ScriptableRenderFeature fullscreen effect for volumetric spotlights via raymarching which requires finding the additional light shadow attenuation of any world position.