Search Unity

HDShadowAtlas access to light's shadowmap? | camera depth only pass | fog of war w/occlusion

Discussion in 'High Definition Render Pipeline' started by msomeone, Nov 19, 2019.

  1. msomeone

    msomeone

    Joined:
    Mar 14, 2014
    Posts:
    5
    Got stuck when tried to implement "fog of war" with additional occlusion effect - when anything is occluded from character's line of sight - it's also "fogged".
    Got working basic solution - without occlusion, it works simply in postprocess (CustomPass), testing depth buffer against analytical shapes originating in player's head) as seen on attached screenshot:
    analytic_cone_visibility_test.png

    Had two ideas about how one would implement this:

    1) place realtime spotlight source with shadowmap and low luminous intensity (= 0.0001 lumen) into player's head. And access light's shadowmap from CustomPass.
    But HDShadowAtlas and ShadowRequest are not exposed to external world :(
    Any way to fetch light's shadowmap without "hijacking" HDRP code and breaking forward compatibility?

    2) make second camera and force depth-only / depth prepass rendering. place it into player's head, and copy depth buffer during "CustomPass" for second camera & use it in CustomPass of first camera. How one would force "offscreen" camera rendering and depth-pass only?

    Wondering what is the "best practices" approach to implement this on top of HDRP?
     
    Last edited: Nov 19, 2019