public sealed class GlobalDistanceFieldTextureThe GPU's copy of a GlobalDistanceField: one volume texture per level.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The clipmap itself references no device, and this is why. Everything about what a field says — the bake, the composite, the snapping, the tracer — is arithmetic with closed-form answers, and it lives in an assembly that could not open a device if it wanted to. What is left over is this: allocate, stage, copy, and name. Splitting it that way is what lets the hard half be checked against a sphere's own equation instead of against a screenshot.
A texture per level rather than one atlas. A three-dimensional texture cannot be an array layer, so the levels cannot be slices of one resource — they are separate textures bound together, exactly as ReflectionProbe's cubes are. An atlas packing them along Z would work and would cost a manual filter at every level boundary, because hardware trilinear does not know where one level stops.
Sampled with linear filtering and clamped at the edges. Linear because the whole point of a sampled field is that the hardware interpolates it for free; clamped because a sample walking off a level must read that level's edge rather than wrap to the far side of the world, which is geometry on the wrong side of the camera.
Stored as R32Float, deliberately for now. Half would hold a clipmap level's range to well inside a cell, and a narrow band of bytes is what Unreal ships — but this is the format that matches the CPU field exactly, so a readback can be compared against it without a quantisation step in between to argue about. The memory is not the reason to hurry: four levels of 32³ is half a megabyte.
Fields and properties (5)
public GlobalDistanceField FieldThe clipmap this mirrors.
public bool IsCreatedWhether the textures exist yet.
public int UploadsHow many times the whole clipmap has been copied up.
public SamplerHandle SamplerHow the volumes are sampled.
public PixelFormat FormatWhat each sample is stored as. Fixed once the textures exist.
Methods (8)
public GlobalDistanceFieldTexture(GlobalDistanceField field)Mirrors one clipmap.
public TextureHandle Level(int level)One level's volume texture.
public TextureViewHandle LevelView(int level)One level's view, which is what a descriptor actually holds.
public void Upload(IGraphicsDevice graphics, ICommandList commands)Copies every level up to the device, creating the textures if they are not there.
public void Apply(ParameterCollection parameters, string shaderName)Writes the names a shader reads the clipmap through.
public static string LevelBinding(int level, string shaderName)The shader's name for one level's volume texture.
public static string SamplerBinding(string shaderName)The shader's name for the sampler all the levels share.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (8)
- ArenaIlluminationThirdPersonShooter
- DistanceFieldDeviceTestsVixen.Graphics.Golden.Tests
- ForwardFrameTestsVixen.Rendering.Tests
- GlobalDistanceFieldRendererVixen.Rendering
- GlobalDistanceFieldRendererTestsVixen.Rendering.Tests
- GlobalDistanceFieldTextureTestsVixen.Rendering.Tests
- ReflectionTraceDeviceTestsVixen.Graphics.Golden.Tests
- SurfaceCacheRadiosityDeviceTestsVixen.Graphics.Golden.Tests