Raycasting through different Volumes in HDRP?

I have multiple volumes in my scene inside a house and 1 volume covering entire scene outside. I have colliders on them. raycasting is being impacted when clicking on a game object that sits inside another volume. The front door for example swings open into another volume and you can no longer click on it, until you move into that other volume. Is there a way to ignore ray cast from mouse pointer on a volume in HDRP?

I think the usual recommendation is to set up a separate layer for volumes, so that they don’t interact with anything else in your project. From the old post processing package docs:

For best performance, keep your volumes in dedicated layers instead of the default one.

Create the layer, and in Project Settings → Physics, exclude this layer from interacting with any other layer. Finally, in the camera, set the volume layer mask to include only that layer.

When raycasting, simply exclude your volume layer(s) from the mask.

Thank you. I did try that it, but I messed up before I posted. When I set the volumes to volume layer, I guess because I added that volume layer after adding camera, it was not checked off with everything in volume mask. It was all white, over exposed. As soon as I included new volume layer in volume mask with everything, it worked perfect.

For anyone else with this issue. I tested with just 1 global volume, so definitely the raycasts don’t go through two volumes, but they do work fine inside 1 global volume. now I know.

Now that I have that volume mask working will activate other volumes again with physics excluded.

First time with HDRP. Lots to learn.
Thanks again.

1 Like