Excluding part of material and post process volume from underwater effects created by a tube?

Hi all,
I would like to know the principles of how to exclude part of a mesh being rendered if it is contained within another mesh during game play.
An example is a tunnel going underwater. The water volume has a water surface and underside, and a complementary post-process volume to render the fuzziness of being underwater.
If I were to place a tunnel under the water to walk through it much akin to an aquarium, I would like the water (underside) and post process volume to be suppressed whilst inside the tunnel, but still work when peering out the windows of the tunnel to marvel at the underwater environment.

I could propose an idea that a copy of the tube that one could walk through to serve as the ‘bounds’ for which other objects (the post process volume and the underside of the water) are not drawn at all.
I am still yet to get up to speed with terms such as Stencil buffer, Depth Buffer, this and that buffer.

What would be considered the best approach to generally taking a reference mesh and using that to exclude an array of other actors from being rendered if said actors stray inside the reference mesh?
Are there any gotchas that need to be thought of beforehand?

Many thanks all for your assistance.

Christian Kanakis

1 Like