Vixen
c7401864
csharp
public sealed class WaterInfoTexture

The interchange, on the device: surface height, flow in two channels, and the ground beneath.

Read the guide page for this →

Remarks

[35 § D3](../../docs/plan/35-water.md#d3-the-water-info-texture-is-the-interchange-and-it-is-a-zone-render). Every consumer wants a field over the ground plane rather than a set of bodies — the material wants depth for its colour and its shoreline, the vertex stage wants attenuation, the foam wants the gradient, the ripple simulation wants a boundary — and none of them wants to iterate bodies per pixel.

⚠ Depth is not a channel, and that is the rule rather than a saving. How deep the water is at a texel is the surface minus the ground, computed where it is used. Storing it would be a third number that can disagree with the two it came from, and the frame it disagrees on is the one where the shoreline is in a different place for the material than for the wave attenuation.

Uploaded from WaterField rather than rendered into. § D3 describes a top-down render with every body drawing through a material; that is faster and it is a second rasterisation of the same bodies, one for the picture and one for the boat, with nothing holding the two together. See WaterZoneState — the field is re-rasterised a hundred frames apart, so what this costs per frame is nothing.

⚠ It uploads only when the field changed, and UploadCount is what says so. A texture re-uploaded every frame is a megabyte a frame across the bus to say what it already said — which does not show up in a picture, only in a capture.

Fields and properties (7)

Methods (5)

  • public WaterInfoTexture(IGraphicsDevice device, in WaterZone zone)

    Creates the texture for a zone.

  • public bool Stage(WaterZoneState state)

    Stages a zone's field for upload, if it has been rasterised since the last one.

  • public void Record(ICommandList commands)

    Records the copy of whatever Stage last staged.

  • public static PixelFormat Format(WaterInfoPrecision precision)

    Which format a precision is.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (3)

  • WaterInfoTextureTestsVixen.Rendering.Water.Tests
  • WaterMeshRendererVixen.Rendering.Water
  • ZoneVixen.Rendering.Water