public sealed class EnvironmentTextureA prefiltered environment on the device: the cube, its view and how it is sampled.
Remarks
The step between EnvironmentBaker and EnvironmentLight, and the one that was missing. Prefilter answers with CubeImages — arrays of Vector3 in managed memory, which is what makes the convolution checkable against its own integral — and Prefiltered wants a TextureViewHandle. Nothing turned one into the other, so a project that baked a sky had no way to bind it, and set 0's environment binding had nothing to fill it with.
That is not a cosmetic gap. ForwardPlus declares environment, probes and their two samplers whatever the permutations say, and EffectSetWriter writes every binding of a set or none — so a frame with no environment does not lose its reflections, it loses every draw in the pass. The probe slots fall back to this same cube (see SceneLighting), which is why one baked environment closes four of the set's thirteen bindings.
The same shape as GlobalDistanceFieldTexture and IrradianceFieldTexture, deliberately. Allocate on the first upload, copy through one staging buffer, transition into ShaderRead and stay there. These are not graph resources — they are named into a descriptor set — so nothing else in the frame transitions them and this has to.
Uploaded once, unless something re-bakes. An environment is a property of a level rather than of a frame, so Upload after the first is a no-op until Invalidate says the chain changed. A sky that animates wants a device-side convolution rather than this.
Fields and properties (8)
public PixelFormat FormatWhat the levels are stored as.
public int MipCountHow many roughness levels the chain has.
public int SizeOne side of the finest level, in texels.
public TextureHandle TextureThe cube.
public TextureViewHandle ViewThe whole cube as one view, which is what a descriptor holds.
public SamplerHandle SamplerHow it is sampled: trilinear, clamped, across the whole chain.
public bool IsFilledWhether the chain's contents have reached the device.
public int UploadsHow many times the chain has been copied up.
Methods (6)
public EnvironmentTexture(IGraphicsDevice graphics, IReadOnlyList<CubeImage> prefiltered, PixelFormat format = Rgba16Float)Mirrors one prefiltered chain.
public static EnvironmentTexture Bake(IGraphicsDevice graphics, CubeImage source, int mipCount = 5, int samples = 64)Bakes a chain from one environment and mirrors it.
public void Invalidate()Says the chain's contents changed, so the next upload copies them again.
public bool Upload(ICommandList commands)Copies the chain up, once, into the cube the constructor allocated.
public void Apply(EnvironmentLight light)Points an environment light at this cube.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (2)
- ArenaFrameThirdPersonShooter
- WorldRendererVixen.Engine.Renderer