Disable in-front camera volumetrics lights

Hi there,

I’m using HDRP 10.5 on Unity 2020.3 and I would like to know if it’s possible to avoid displaying the volumetric lights when your camera is inside?

For example in my picture, I want that my camera to see the 5 godrays in front on it but not the one we are under?

Any tricks to do that?

I’m not sure if I understand but do you want that fog closer to camera to disappear/not be visible?

Yes indeed :slight_smile: In fact, when we are under the fog, it’s not very pleasant to play, but we want to keep it when we are not inside because is much attractive

Currently, there is no concept of negative fog volume in HDRP so I don’t think so that it’s possible.
One way could be to decrease overall fog density so that only far away object look like they are influenced by fog but I guess it would be too thin in your scenario.
Another method could have been to attach a volume to the player itself and inversing the blend to make it thin on the inside but that has problem of its own https://forum.unity.com/threads/volumetric-fog-strange-black-ghosting-effect.1115443/
So I don’t think I would be able to help with that :frowning:

Hey, a cheap workaround is to attach a meshrenderer to your camera, and make sure it casts shadows (either “On” or “Shadows only”). This will have the effect of blocking the light, and the area around the camera will not have illuminated fog as a result.

Thanks for the idea, it works but to do it properly we need to create a “big” plane to mask all the light and it create weird shadows from the other light sources :confused:

And if we reduce the size of the plane we do not get a clear benefit

You can use the light layer system for shadows btw, this way the mesh you use to “protect” the camera, only cast shadows from specific lights, but not from the rest.

https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@12.0/manual/Light-Layers.html#shadow-light-layers

Yes we tried, but it does not solve our problem. Because of the scale of the plane, when we are close to the border of the godray, the shadow mask the next rays :confused:

The idea was really good but in our case the graphical result is not as good as we want :confused:

7260757--875938--upload_2021-6-22_16-23-25.jpg