Cutout Volumes
With cutout volumes you can cut water out from custom area in water surface.
You will need to enable and configure cutting on each water surface separately.
Create Cutout Volume
Method #1:
- Select any 3D object.
- Click three dots on MeshRenderer component to open its' context menu
- Use Create Cutout Volume option.
Method #2:
- Create empty game object.
- Add
WaterCutoutVolume
component. - Configure its shape.
You can choose between 3 possible shapes: procedural box, procedural sphere and custom mesh.
If you decide to use custom mesh, remember it should be:
- Simple - preferably max 63 vertices
- Convex
- One-sided - you can't see any face from inside; typical case but important to note it here
Internally, they create also triggers so the physics system is aware of cutout volumes.
It means that e.g. if ship enters cutout volume, it will stop floating on this surface and fall down.
(read more: Floating Body and Water Sampler)
Although physics behaviour is constant, you can can configure how cutout volume is processed visually on each surface.
They are two different things - cutting out from physics and from rendering.
Cutout Culling Mode
For each surface you can determine how cutout volumes will be culled from rendering.
Each mode has pros and cons.
Possibilities are:
- None - simple mode that always clips water if there is cutout geometry on screen.
- you can have as many volumes visible on screen as you want.
- they can intersect each other as you want.
- Front - mode that doesn't clip water if cutout geometry is behind water surface.
- you can have as many volumes visible on screen as you want.
- they cannot intersect each other - if you want to make complex cutout volumes, then make few separate meshes and place them side-by-side with like 0.01 margin, otherwise you may experience visual glitches.
- Perfect - mode that perfectly clips water (see comparison screenshot below)
- you can have only one volume visible on screen, otherwise you may experience visual glitches even if multiple meshes do not intersect each other.
Reversed Cutout
For water surface you can enable reversed cutout.
As it says, cutout will work opposite - water will be visible and physics on this surface will be processed only inside volume.
Using this method you can create e.g. water-in-water.
Practical example is to cutout water from ship interior, create second water surface with reversed cutout and put it inside ship - now you have separate water surface inside ship that you can dynamically change height level to simulate sinking ship.