Vixen
dd8b0a81
csharp
public sealed class AmbientCombineRenderer

Puts a split frame back together: direct light times sun visibility, plus the ambient the shading pass held back, rebuilt from screen planes.

Read the guide page for this →

Remarks

The other half of ForwardPlus.SplitOutputs. A split pass writes direct light, emissive and specular ambient to one target and its albedo, normals and f0 to three more, precisely so the screen-space passes have something to modulate: this node multiplies an irradiance plane by the albedo, an occlusion plane into that ambient and a sun-visibility channel into the direct term, and adds a traced reflections plane weighted by the surface's own specular reflectance. The formula is one line — direct × sun + albedo × irradiance × occlusion + reflections × reflectance — and AmbientCombine.rvn states every term's stand-in semantics beside it. The irradiance is a screen plane where the frame publishes one and the scene's own sky where it does not, because the pass withheld the term either way — see Irradiance.

Every plane past the first three is optional. The shader's bindings exist in every variant — a set is written wholly or not at all — so an absent input binds the direct plane as a stand-in and a use… switch at zero makes the term read as "off": occlusion and sun as one, irradiance and reflections as nothing. A document that names no AO node gets unoccluded ambient rather than a frame modulated by whatever the stand-in holds.

Sun visibility multiplies direct and occlusion multiplies ambient — DistanceFieldAoRenderer's own rule, which is why its plane keeps the two in separate channels. Where a shadow map already shadows the sun, the document turns that node's SunShadow off and its channel stays one; the double-application guard is the AO node's knob, not arithmetic here.

Fields and properties (16)

  • public required string Direct

    The split pass's first target: direct light, emissive and specular ambient.

  • public required string Albedo

    Its second: diffuse albedo, the material's own occlusion in alpha.

  • public required string Normals

    Its third: world normal in xyz — a zero vector marks a pixel no surface wrote.

  • public string? Specular

    Its fourth: specular reflectance at normal incidence — the material's f0. Null weighs every surface as a dielectric, which is what this node did before the plane existed.

  • public string? Irradiance

    Screen irradiance over π — what !IndirectDiffuse publishes, and what !ScreenProbeGather's upsample publishes.

  • public string? Occlusion

    !DistanceFieldAo's plane: occlusion in r, sun visibility in g. Null reads both as one.

  • public string? ContactOcclusion

    !Ssao's plane: occlusion in r, a contact-scale term over the field's room-scale one.

  • public bool ContactBentNormal

    Whether that plane is a bent-normal one — direction in rgb, occlusion in alpha — which is what !Ssao writes with BentNormal on.

  • public string? Reflections

    !Reflections' plane: radiance in rgb, validity in alpha. Null blends none in.

  • public SceneLighting? Lighting

    The scene's lighting, whose AmbientSpecular this node owns and whose Environment it reads, or null for a host that would rather write both itself.

  • public float Intensity

    A multiplier on the rebuilt ambient alone — the document's own knob.

  • public string? Depth

    The full-resolution depth, for the bilateral AO upsample. Null keeps the plain linear read.

  • public RenderView? View

    The view whose camera drives the unprojection, or null to set it by hand.

  • public Matrix4x4 InverseViewProjection

    Clip space back to world space, when no View supplies it.

  • public Matrix4x4 InverseView

    View space back to world space, for ContactBentNormal alone.

  • public float PlaneTolerance

    How far off a pixel's plane a reduced texel's surface may stand and still count, in metres.

Methods (2)

  • public AmbientCombineRenderer()

    Puts a split frame back together: direct light times sun visibility, plus the ambient the shading pass held back, rebuilt from screen planes.

  • protected override void Configure(CompositorFrame frame, ParameterCollection parameters, IList<ResourceBinding> bindings)

    Fills in this frame's parameters and bindings.

Used by (6)

  • FrameDocumentTestsThirdPersonShooter.Frame.Tests
  • BentNormalAmbientImageTestsVixen.Graphics.Golden.Tests
  • MultiScatterFurnaceImageTestsVixen.Graphics.Golden.Tests
  • PostEffectFactoryVixen.Rendering.PostFx
  • PostEffectTestsVixen.Rendering.PostFx.Tests
  • StandardFrameTierImageTestsVixen.Graphics.Golden.Tests