Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question HDRP Shadow Caster Pass : Getting light position and light type?

Discussion in 'High Definition Render Pipeline' started by JM_CG, Dec 2, 2023.

  1. JM_CG

    JM_CG

    Joined:
    Apr 20, 2017
    Posts:
    35
    Is there a way to find out during each shadow caster pass for a Lit material the light type (e.g directional/point) and light position being used in the case of point light? Is it set in a shader variable somewhere?

    @SebLagarde @JarkkoUnity
     
  2. Misaki_eKU

    Misaki_eKU

    Joined:
    May 3, 2018
    Posts:
    86
  3. JM_CG

    JM_CG

    Joined:
    Apr 20, 2017
    Posts:
    35
    That partially helps. I think what I am looking for is the name of this constant buffer that gets set for each shadow pass render dispatch so I can access it in the shader along with where its enum is defined. In this RenderDoc example, this is a point light that is going through each of its 6 faces. I can tell its the light as the posiiton is stored in cb1_v3.

    I just want to be able to access this light info in my hlsl shader. PointShadowBuffer.jpg
     
    Last edited: Dec 3, 2023
  4. JM_CG

    JM_CG

    Joined:
    Apr 20, 2017
    Posts:
    35
    Ok the above buffer is actually ShaderVariablesGlobal and I'm using if (UNITY_MATRIX_I_P._44 == 1.0) to identify a light as directional, which is a bit loose and ghetto but gets me over the line.
     
  5. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    244
    You seem to have found the solution to your problem but did you use the #pragma enable_d3d11_debug_symbols ? that would allow renderdoc to show you the shader code and the name of constant buffers