How do I bool the water in a floating object?

Hey crowd,

I want to animate a small and open sailing boat for a VR experience. My goal is to sit on/in the boat and experience sailing in heavy winds. My problem is that the ocean is clipping the geometry of my boat. Does anyone have a good idea on how to keep the water out of the hull and from clipping into the boat.?

This would be useful for any hollow floating object like barrels or boxes… I set up my 3D geom in C4D where I can easily bool the Water, but as soon as I animate the oceanwaves, the geometry at some point will again show on the inside of the open boat.

Thank you for trying to help me.
Cheers Linus

The basic idea is to use a “depth mask,” i.e., a shader which draws into the depth buffer but is otherwise invisible. You use this to draw an object that represents the inside (or just “top”) of your boat, after drawing the boat itself, but before drawing the water. The water will then not draw inside your boat, because as far as the water renderer can tell, that would be behind existing geometry.

You can find a (somewhat old but hopefully still working) demo project on the wiki here.

1 Like

also, check out Mistal’s water effects… I don’t think it’s on the asset store yet, its a WIP, but on the forums… let me do a quick search

Wow, guys - thanks a lot for your approaches. I understand how you´d solve that issue. awesome, great help.
cheers Linus

1 Like

Hi Linus. If the player won’t be able to poke their head over the edge (i.e. if it’s fixed position VR), a simpler solution might be to just draw the boat on top of the ocean. The simplest way to do this would be multiple cameras, one rendering just the ocean and the other (set to a higher depth) for just the boat. Alternatively you could write a custom shader for the boat geometry to render it on top of the ocean.

Again, this’d only work if you can’t move your camera/head over the side of the boat.

Can you simply cut a hole in your water for the boat and move the water itself with it? I watch this guy on Youtube: https://www.youtube.com/playlist?list=PLYfhW_P-MkU7vBmWwwyqdIWNDzXfEZwnO and I’ve seen mulitple instances where developers did some really sneaky things to portray water. Several of them did, in fact, move a water plane with the character, rather than having the character move through it.