public sealed class GlobalDistanceFieldRendererKeeps the clipmap over the camera, on the device, and named in the frame's set.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The node that joins the three halves that already existed and never met: a GlobalDistanceField that knows how to composite itself, a GlobalDistanceFieldTexture that knows how to copy one up, and a shader that knows how to read one. Everything here is sequencing.
It recomposites when the answer would change, not every frame. A composite is every cell of every level against every instance — the most expensive thing in the frame by a wide margin — and a camera that has not crossed a cell boundary would get the same numbers back. The levels are snapped to their own grids precisely so that "has anything moved" is a comparison rather than a guess, and this is what cashes that in: a still camera composites once and then never again.
The names are written every frame regardless. They are cheap, they are the frame's answer to "where is the clipmap now", and a set rebuilt for another reason would otherwise bind whatever the last frame left. Re-asserting a value that has not changed does not bump ParameterCollection.Version, so it does not cost an upload either.
The view position is the host's, not the camera's. It is usually the camera and does not have to be: a clipmap centred slightly ahead of a fast-moving camera has the geometry it is about to need rather than the geometry behind it. Taking it from RenderView would make that impossible to express, so the default is to follow the view and the property is there to override it.
Fields and properties (13)
public GlobalDistanceField? FieldThe clipmap to keep. Null does nothing at all.
public GlobalDistanceFieldTexture? TextureIts mirror on the device, made on the first record.
public SceneConstants? SceneConstantsWhere the names go — the frame's set 0.
public string ShaderNameThe compose-slot prefix the clipmap's names are written under.
public IList<string> PassesAny further prefixes the same clipmap is written under.
public IList<DistanceFieldInstance> InstancesWhat the clipmap covers.
public int InstancesVersionBumped by whoever changes Instances, to say the composite is out of date.
public Vector3? ViewPositionWhere to centre the clipmap, or null to follow the view.
public RenderView? ViewWhose position to follow when ViewPosition says nothing.
public IGraphicsDevice? DeviceThe device its texture is made on, or null to take the frame's.
public long ReusedHow many cells the last recomposite kept rather than recomputed.
public int CompositesHow many times the clipmap has actually been recomposited.
public bool ParallelWhether the composite may use more than one thread.
Methods (3)
protected internal override void Build(GraphicsCompositor compositor, CompositorFrame frame)Declares the pass that composites the clipmap and copies it up.
protected internal override void Record(GraphicsCompositor compositor, RenderDrawContext context)Records this node's work into a pass somebody else opened.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (6)
- ArenaThirdPersonShooter
- ArenaIlluminationThirdPersonShooter
- CompositorAssetTestsVixen.Rendering.Tests
- CompositorBuilderVixen.Rendering
- DistanceFieldAoImageTestsVixen.Graphics.Golden.Tests
- GlobalDistanceFieldRendererTestsVixen.Rendering.Tests