public sealed class UnderwaterShapeA zone's water, below its surface, as a post-process volume's containment test.
Remarks
[35 § D9](../../docs/plan/35-water.md#d9-underwater-is-a-post-process-volume-and-the-waterline-is-named-as-the-hard-part), and it costs the shape generalisation and nothing else. [32](../../docs/plan/32-post-process-volumes.md) built the optional-field settings, the priority, the blend radius and the per-frame fold; underwater is a volume whose shape is the water, below its surface, and this is that shape. Nothing about the volume path changes, which is what [§ B2](../../docs/plan/35-water.md#b2-doc-32s-volumes-are-boxes)'s generalisation bought.
⚠ Per zone rather than per body, and that diverges from the reference deliberately. Unreal hangs an UnderwaterPostProcessSettings on each water body, so a river running into a lake is two volumes an author has to keep in agreement and a camera at the mouth is inside both. The zone's field has already resolved every body once — that is what § D3 exists for — so "am I under water" is one question about a field rather than N questions about bodies, and a river mouth grades as one place because it is one place.
⚠ It reads the surface at the water time it was built with, waves included. A test against the rest height would put the boundary at the mean sea level, and a camera sitting in a swell would cross it half a second before and after the water actually reached it. Which is also why the shape is rebuilt per frame rather than cached: the surface moves.
It does not answer the waterline. A fold produces one weight for the whole frame, and a camera straddling the surface needs two treatments divided by a curve — which is the mask !Water writes in alpha, read per pixel. § D9 separates the two explicitly because designing the volume path first and discovering the waterline second is how the transition ends up a hard cut whose fix is architectural.
Methods (2)
public UnderwaterShape(WaterZoneState state, in WaterWaveSpectrum spectrum, float waterTime, WaterAttenuation attenuation = default(WaterAttenuation), float feather = 2)Builds the shape for one zone, at one water time.
public bool Contains(Vector3 world, out float distanceOutside)
Used by (2)
- UnderwaterShapeTestsVixen.Rendering.Water.Tests
- WaterZoneSystemVixen.Rendering.Water