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

HDRP custom shadow injection, best approach

Discussion in 'High Definition Render Pipeline' started by Chris_Webb, Jun 6, 2022.

  1. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    Hello,

    I am looking to add custom shadows to HDRP, but based on the available injection points, I'm not sure what the best method might be.

    The shadows are for volumetric clouds, and I have a precalculated 3D shadow map volume (rather than a cookie like the Unity ones), which should be pretty trivial to apply using the depth buffer, but finding the right way to actually do this is proving mysterious.

    Has anyone tried something like this? What approach did you take?

    Thanks so much,
    Chris
     
    eugene4552 and Ruchir like this.
  2. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    Oops forgot about this. Anyway the best solution I found was just to locally duplicate Deferred.compute and VolumetricLighting.compute, and inject my shadows in the lightloop, and shadow sample respectively. This is quite trivial and easy to maintain without needing to have HDRP as an embedded package.

    To use these you just need to duplicate HDRenderPipelineRuntimeResources locally in your project, and set your custom compute shaders respectively. Then tell HDRP to use these resources.