Create Shadows in Custom Pass

I’m creating volumetric clouds in a custom pass, including shadows. However, right now I’m just rendering the shadows by darkening an area of the screen. The problem is that the shadows aren’t impacted by the scene color, so they come out black, whereas other shadows in the scene have a more consistent color:

In the image above, my cloud shadow colors are black on a white surface, and the cube’s shadow is a blue/purple, which matches the sky and environment much better.

How can I make my custom shadows a similar color to the ones rendered by default? My instinct is to somehow insert my custom shadows into the HDRP shadow atlas, but I can’t see how to do that. Any advice is appreciated!

1 Like

Hello,

Right now, it’s not possible to render objects In HDRP shadow maps using custom passes without modifying the code of the package itself. Furthermore in your case using HDRP shadow maps will not be helpful because HDRP doesn’t support opacity in shadow maps, so you’ll lose this soft cloudy effect in the shadow if you use shadow maps.

Instead, you can try to use a cookie texture on the directional light. It comes with the downside that your shadows are projected on all the surfaces hit by the directional light (even above the clouds) and that it doesn’t work with other kinds of lights but your opacity shadow map will be properly integrated with HDRP lighting (ambient probe, reflection probe, scene lights, etc.)

1 Like