Vixen
c7401864
csharp
public sealed class WaterMeshRenderer

Draws every zone's surface into the two planes the water pass reads.

Read the guide page for this →

Remarks

[35 § D4](../../docs/plan/35-water.md#d4-the-surface-is-the-terrains-quadtree-with-a-different-height-source), and the node that makes a wet pixel possible at all. Without it nothing writes WaterSurface or WaterNormal, so § D8's !Water reads a cleared mask, finds no coverage anywhere and passes the frame through unchanged — a water stack that is wired, tested and invisible.

It runs before !Copy and !Water, and after the opaque pass. The order is what the two planes are for: the surface has to be rasterised against the scene's own depth so a lake behind a hill does not draw over it, and the composite has to have both planes before it integrates anything.

⚠ One WaterSurfacePass per zone, not one per frame. A zone owns a window, a field, an info texture and a patch buffer; sharing a pass between two would mean re-uploading both windows every time either moved. Zones that disappear from the fold have their resources dropped at the next build, which is what keeps a level that streams a zone out from leaking a megabyte of staging per visit.

Fields and properties (19)

  • public required string Surface

    The surface plane it writes: device depth in r, coverage in g.

  • public required string Normal

    The normal plane: the surface's world normal in xyz and its foam in a.

  • public required string SceneDepth

    The opaque scene's depth, which the surface is tested against and never writes.

  • public RenderView? View

    The view the patches are selected for.

  • public WaterZoneSystem? Zones

    Where the zones and their fields come from.

  • public float WaterTime

    The simulation's water time, in seconds.

  • public int GridQuads

    How many quads the shared grid patch spans.

  • public TerrainLodRanges Ranges

    Where each level takes over, and where each one morphs.

  • public float FarDistance

    How far past a window the far skirt reaches, in metres.

  • public float EdgeFade

    How wide the band is over which the waves fade at a window's edge, in metres.

  • public WaterMeshSettings Settings

    The shoreline, foam and rest-height numbers the shader's block carries.

  • public EffectPipelineDescriber? Modules

    Where shader modules come from. Set before the first frame that builds.

  • public SamplerCache? Samplers

    Where samplers come from, shared so a frame does not exhaust the device's supply.

  • public IGraphicsDevice? Device

    The device its pipelines, buffers and textures are created on.

  • public int ZonesDrawn

    How many zones the last frame drew.

  • public int PatchesDrawn

    How many patches they selected between them.

  • public int DroppedPatches

    And how many they had to drop. ⚠ Non-zero is a hole in the water.

  • public int BuildCount

    How many frames have declared the pass.

  • public IEnumerable<WaterMeshRenderer.WaterZoneDraw> Draws

    What each zone drew last frame.

Methods (2)

  • 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 (5)

  • WaterDebugDrawVixen.Rendering.Water
  • WaterHorizonImageTestsVixen.Graphics.Golden.Tests
  • WaterMeshOverlayVixen.Rendering.Water
  • WaterRendererFactoryVixen.Rendering.Water
  • WaterSurfacePassTestsVixen.Rendering.Water.Tests