public sealed class UnderwaterRendererThe waterline: what a camera straddling the surface sees, divided by a curve.
Remarks
[35 § D9](../../docs/plan/35-water.md#d9-underwater-is-a-post-process-volume-and-the-waterline-is-named-as-the-hard-part)'s second half, and the document warns about it twice. "Designing the volume path first and discovering the waterline second is how you get a system where the transition is a hard cut and the fix is architectural." The volume path is UnderwaterShape over doc 32's fold and it grades the whole frame; this is the other feature, which a fold cannot be.
⚠ A fold produces one weight and a waterline is a curve. A camera half in the water needs two treatments in one frame divided by the intersection of the wave surface with the near plane — which is a per-pixel question, and no number the volume system can produce is an answer to it.
⚠ The local surface plane rather than the wave sum, and the approximation is stated. The exact answer needs the info texture and the Gerstner sum bound into a post-process node, which is a second place for § D2's seam test to have to hold. Over the few centimetres a near plane spans, a wave is its own tangent plane to well under a millimetre. What it costs is a crest smaller than the near plane passing the camera, which is spray rather than a waterline.
⚠ The plane comes from the same WaterQuery the volume fold and the buoyancy solver read, at the same water time — § D2 applied to one more consumer. A waterline drawn against the rest height would sit at mean sea level while the drawn surface moved around it, which reads as the camera being wrong rather than the line being wrong.
⚠ The distortion and the caustics are the volume's and not the lens's, which § D9 says outright: they are driven by the submersion depth the fold computes, so a head just under the surface wobbles and one at ten metres does not. A lens property would wobble a cutscene camera flying over the lake.
Fields and properties (34)
public required string OutputThe target it writes — the frame's scene colour.
public required string BehindThe copy of the frame so far, which is what it grades.
public required string SceneDepthThe opaque scene's depth, which says how far the fog has to reach.
public required string SurfaceThe surface plane: device depth in r, coverage in g.
public RenderView? ViewThe view the camera matrices are derived from, or null to set them by hand.
public WaterZoneSystem? ZonesWhere the zones — and therefore the local surface plane — come from.
public Matrix4x4 InverseViewProjectionClip back to world, when no View supplies it.
public Vector3 CameraPositionWhere the camera is, which the path lengths are measured from.
public Vector3 SurfacePointA point on the surface near the camera. Set from Zones when there is one.
public Vector3 SurfaceNormalThe surface's normal there, which is what tilts the waterline with the swell.
public float SubmersionHow far below the surface the camera is, in metres. Negative is above.
public float WaterlineFeatherHow wide the waterline's fade is, in metres.
public Vector3 ScatteringHow much light the medium scatters out of a ray per metre, per channel.
public Vector3 AbsorptionHow much it absorbs per metre, per channel.
public float PhaseGHenyey–Greenstein anisotropy, carried so the medium is one description.
public Vector3 SkyColourWhat arrives from the whole sky. ⚠ Without it everything below the surface is black.
public Vector3 BehindScale§ D8's scale on what shows through.
public bool DistortionWhether what is seen is refracted at all.
public float DistortionAmountHow far the refraction wobble displaces what is seen, in UV.
public float DistortionScaleHow many wobbles across the screen, and how fast they travel.
public float DistortionSpeedHow fast the wobble travels.
public bool CausticsWhether the moving caustic bands are added.
public float CausticAmountHow bright they are.
public float CausticScaleHow large a caustic cell is.
public float CausticSpeedHow fast the pattern drifts.
public float CausticDepthHow deep the caustics fade out over, in metres.
public float WaterTimeThe simulation's water time, in seconds.
public EffectPipelineDescriber? ModulesWhere shader modules come from. Set before the first frame that builds.
public SamplerCache? SamplersWhere samplers come from, shared so a frame does not exhaust the device's supply.
public DescriptorAllocator? AllocatorWhere the pass's descriptor sets come from.
public IGraphicsDevice? DeviceThe device its pipelines and its uniform block are created on.
public FullScreenRenderer PassThe pass this node is, for a host that wants to look at what it did.
public int BuildCountHow many frames have declared the pass.
public bool IsSubmergedWhether the last build found the camera under water at all.
Methods (3)
public UnderwaterRenderer()Creates the node.
protected override void Build(GraphicsCompositor compositor, CompositorFrame frame)Declares this node's render-graph passes.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (3)
- UnderwaterPassImageTestsVixen.Graphics.Golden.Tests
- UnderwaterPassTestsVixen.Rendering.Water.Tests
- WaterRendererFactoryVixen.Rendering.Water