Is there any way to use stencils in a masked or opaque material?

Main question: I want to hide the water inside my boat, I am using the Single Layer Water Material which can be either Masked or Opaque. However to use stencils I need to have a Translucent material, which I don’t want to do unless there is no other way.
Is there any way to use stencils in a masked or opaque material?

My alternative:
I have tried to use the Distance Field information (DistanceToNearestSurface node) however it obviously creates a shadow where placed and if I deactivate its shadow casting, distance field shadows or dynamic shadows it stops cutting the hole, which makes sense, but is there a way to use distance field info while not casting a shadow?

Additional info on my alternative Distance Field method:

  • I use disable render in main pass to hide the cutout object
  • Disabling lighting channels only hides the cascaded shadow not the DFAO

I do not want to disable DFAO altogether, I would prefer using a Translucent material or some other alternative.

Spherical Masks or similar would be impractical if there is a lot of boats (I think).
Do you know any other ways to mask out water?

Thank you for your time!

1 Like

Take a look at this Custom Depth and Custom Depth Stencil in UE4 - Superyateam Gamedev