Vixen
02b45cc4
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.

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

Remarks

The other half of ForwardPlus.SplitOutputs. A split pass writes direct light, emissive and specular ambient to one target and its albedo and normals to two 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 blends a traced reflections plane over the result by its own validity. The formula is one line — direct × sun + albedo × irradiance × occlusion, reflections lerped over — and AmbientCombine.rvn states every term's stand-in semantics beside it.

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 (8)

  • 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? Irradiance

    Screen irradiance over π — what !IndirectDiffuse publishes, and what !ScreenProbeGather's upsample publishes. Null contributes no ambient at all.

  • 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 string? Reflections

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

  • public float Intensity

    A multiplier on the rebuilt ambient alone — the split-mode seat of ambientIntensity.

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 (3)

  • FrameDocumentTestsThirdPersonShooter.Frame.Tests
  • PostEffectFactoryVixen.Rendering.PostFx
  • PostEffectTestsVixen.Rendering.PostFx.Tests