I am currently faced with a dilemma involving a mesh consisting of a THREE.PlaneBufferGeometry
(representing a water surface), with another object on top (a boat). The issue arises when the boat partially enters the water, causing the water to unexpectedly appear inside the boat due to its higher y value.
What steps can I take to resolve this issue?
One possible solution that comes to mind is calculating the interior dimensions of the boat and passing them to the shader of the water surface. This approach would involve hiding any points inside the boat. Is this the most effective strategy, and if so, how can it be implemented?
EDIT: It's important for the water to overlap the sides of the boat as shown in the illustration below:
Current situation: Desired situation:
B A
| | | |
-----|---------|-------- -----| |--------
|_________| |_________|
The goal is to prevent water from being visible inside the boat at point [A], and to hide the lower part of the boat from view at point [B].