Vixen
02b45cc4
csharp
public sealed class AmbientOcclusionRenderer

Ground-truth-style ambient occlusion: how much of the sky a pixel can actually see.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The term image-based lighting cannot supply on its own. A probe says what arrives from every direction at the point it was baked; it knows nothing about the crease a pixel sits in, the gap under a chair, or the corner where two walls meet — and those are most of what makes a rendered room read as a room. This marches the depth buffer around each pixel and measures the horizon in a few directions.

Half resolution by default, and that is not a quality setting so much as an admission about the signal: occlusion from a hemisphere is low frequency almost everywhere, so the sampling cost halves twice while the visible difference is confined to the sharpest contact edges. It is the standard trade, and a project that wants it at full resolution sets Scale.

It writes occlusion, not colour. What consumes it is whatever multiplies the ambient term — the forward pass's occlusion channel, or a deferred lighting pass. Compositing it into the frame directly would darken direct lighting too, which is the classic mistake that makes an over-occluded scene look dirty rather than grounded.

Fields and properties (11)

  • public required string Depth

    The depth it marches.

  • public required string Normals

    The normals it orients the hemisphere by.

  • public int Directions

    How many directions each pixel searches in.

  • public int Steps

    How far along each direction it steps.

  • public bool BentNormal

    Whether it also writes the average unoccluded direction.

  • public RenderView? View

    Clip space back to view space, for turning depth into a position.

  • public Matrix4x4 InverseProjection

    Clip back to view, when no View supplies it.

  • public float Radius

    How far the hemisphere reaches, in metres.

  • public float Intensity

    How dark the occlusion goes.

  • public float Falloff

    How quickly a distant occluder stops counting.

  • public float Scale

    What fraction of the frame it runs at.

Methods (3)

  • public AmbientOcclusionRenderer()

    Ground-truth-style ambient occlusion: how much of the sky a pixel can actually see.

  • 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 (2)

  • PostEffectFactoryVixen.Rendering.PostFx
  • PostEffectTestsVixen.Rendering.PostFx.Tests