public sealed class DistanceFieldAoRendererOcclusion and a sun shadow, traced through the global distance field.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The companion to AmbientOcclusionRenderer, not a replacement. GTAO searches the depth buffer, so it is sharp, cheap and completely blind to anything off screen — a wall behind the camera does not darken the floor in front of it. This searches the field, so it sees the whole world at the field's own resolution and nothing finer. A frame wants both, multiplied: contact darkening from one, the room from the other.
It traces a sun shadow too, because the march is already paid for. A distance field answers "how much of the sky is blocked" and "how much of the sun is blocked" with the same walk over the same data, and the penumbra falls out of how close the ray passed rather than out of a filter kernel — which is what a cascade cannot do at any resolution.
It binds no part of the clipmap itself. The volumes, their textures and their sampler live in the frame's set 0, put there by GlobalDistanceFieldRenderer — because the field follows the camera and belongs to the frame, not to this pass. What this owns is the depth, the normals and the numbers of its own march. The pair has to agree on one thing and only one: the compose-slot prefix those names are written under.
Occlusion in red, sun visibility in green. Two numbers a shading pass multiplies into different terms, so they are kept apart. Pre-combining them into one "darkness" darkens direct lighting with ambient occlusion, which is the classic mistake that makes a scene look dirty rather than grounded.
Fields and properties (17)
public required string DepthThe depth it reconstructs world positions from.
public required string NormalsThe normals it orients the occlusion integral by.
public string SourceThe shader behind the field slot — what the march actually reads.
public bool SunShadowWhether to trace a sun shadow alongside the occlusion.
public RenderView? ViewThe view whose camera drives the unprojection below, or null to set it by hand.
public Matrix4x4 InverseViewProjectionClip space back to world space, for turning a depth into a position.
public float OcclusionRadiusHow far up the normal the occlusion integral looks, in metres.
public int OcclusionSamplesHow many steps it takes along that.
public float OcclusionStrengthHow dark the occlusion goes.
public Vector3 SunDirectionWhich way the sun is, in world space.
public float SunDistanceHow far to march toward it before calling the point lit.
public float SunSoftnessThe reciprocal of the sun's angular radius. Larger is a sharper shadow.
public float ShadowBiasHow far off the surface a shadow ray starts.
public int ShadowStepsHow many steps a shadow march may take.
public float SurfaceThresholdHow near counts as arrived, for both marches.
public float StepScaleWhat fraction of the reported distance each step actually takes.
public float ScaleWhat fraction of the frame it runs at.
Methods (3)
public DistanceFieldAoRenderer()Occlusion and a sun shadow, traced through the global distance field.
protected override Int2 TargetSize(Int2 frame)The size the effect's own target is, given the frame's.
protected override void Configure(CompositorFrame frame, ParameterCollection parameters, IList<ResourceBinding> bindings)Fills in this frame's parameters and bindings.
Used by (3)
- DistanceFieldAoImageTestsVixen.Graphics.Golden.Tests
- PostEffectFactoryVixen.Rendering.PostFx
- PostEffectTestsVixen.Rendering.PostFx.Tests