Use stencils (maybe) to always render an actor above water

I have a boat actor that goes on water. When it is partially submerged, the water can be seen at the bottom of the boat. I would like for that water (from the Water Experimental plugin) not to be rendered.

I’m pretty sure I can use stencils and a post-process material to define “the water cannot be seen through or in front of the boat, ever.” However, I don’t understand the shader principles well enough to do that.

I cannot use the option “Disable depth test.” The boat actor uses a custom toon shader and the option is greyed out.

Hey there @eje2111! So many people actually mask the water material instead of forcing the boat to ignore depth tests. Here’s a video and a follow-up video as an update to that workflow. I’d watch through the first one all the way then follow along with the second because he goes rather quickly and builds off the original.

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

1 Like

meaning you can use distance field test to mask out water, it needs separate cutout mesh for your boat shape

Thanks! I’m returning to the project that needs this after giving up two years ago. Two years ago, I saw this video (or a similar one) and could not get it to work. I’m much more comfortable with Unreal now. And I had not found a video like the one you shared this time out. I’ll try it and see what happens. Unlike last time, this time, I have a good feeling about it.

I’m astonished, but I actually got it to work! (I needed both videos to get it to work, though.) There is still a wave effect that appears in side the boat, but I should be able to remove it the same way. Anyway, other people can decide what to do about it. This is pretty amazing! Thanks!

Awesome work! And yeah the original video had some changes that needed to be made so he made the second one to correct it. I’m glad it works for you! I’d recommend making a simple mesh (like Luk recommended) that completely covers the boundaries of the boat and use that as the collision and bounds, as it will help with that clipping and when you want to walk around on the boat or handle other collisions it will help immensely. Let me know if you have any questions, have a great one!

I actually use distance field test for the tpp camera outside the boat and when inside I cut a hole in water surface as neither method worked flawlessly in both scenarios.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.