+1 vote

Hello together,

I am planning on creating a game that takes place mainly on the water and in 3D. I was hoping to add interiors below sea level to the boats in this game. The problem is that the water plane would be rendered inside the boat when viewed from above.

To solve this it would be really awesome to have the ability to set some transparent plane that stops the water from being rendered. Unity achieves this by using something called a depth mask.

depth mask example

Now that I've layed out my problem lets come to my question(s). I hope it's ok to ask all of them in ne question as they're basically all the same question.

  • Is it possible to achieve something like this in godot
  • If it's not possible how would I achieve my goal (interior without water) in Godot

Here are some alternatives that might achieve the same effect

  • Use a water-plane with a ship sized hole (not so good with multiple ships and ship sizes)
  • Render the interior via render-to-texture everywhere it should be visible (expensive)

Thanks in advance

asked May 14 in Engine by MagnusS (13 points)

1) Draw the boat
2) Draw whatever is inside the boat (passengers...)
3) Draw a mesh hull enclosing the boat, but only write it to the depth buffer, no color (not even transparency because that would break draw order)
4) Draw the sea: due to 3), it won't overlap with the inside of the boat's hull.

Now I wonder if step 3) is possible to do in Godot... if not, it could be a feature request. We would need a depth_only shader render mode.

Yeah I was trying something like that the other day. Didn't work out. But then I realized a project setting called depth pre-pass. With that on, the depth buffer is written before any color is written. I wonder what happens if I disable that?

Well that didn't work out either. I guess it's not a feature yet. I second what Zylann said. If you really want it, make a feature request.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.