Vixen
02b45cc4
csharp
public sealed class SkyRenderer

The background, drawn as the environment the scene is lit by rather than as a colour.

Read the guide page for this →

Remarks

The node kind a document needed before a frame could have a sky at all. Every other full-screen pass reads what an earlier pass wrote, and a sceneTextures: line can hand a graph resource to a shading pass — but the environment cube is neither: it is baked before the frame graph exists and it outlives every frame, so no document could name it and every frame ended up clearing to a colour somebody typed beside a cube somebody baked. Two opinions about one sky, drifting apart at the first retune.

What makes it possible is set 0. Sky.rvn declares the cube [PerFrame], and SceneConstants writes that set for whatever effect is about to bind it — under the effect's own name, so declaring environment in the shader is the whole of the wiring. A full-screen pass already binds set 0; nothing new crosses the boundary.

⚠ It writes an existing target and does not declare one. Naming the frame's own HDR colour is what puts the sky behind the scene: this runs first, fills every pixel, and the opaque pass that follows loads rather than clears. A pass that declared a target of its own would need a composite to get it into the frame, which is a second full-screen pass to avoid one clear.

No depth, and no depth test. A sky drawn last would need the depth buffer as a read and a discard per pixel; drawn first it costs one write of the target, which on any hardware made this century is cheaper than the alternative and is what every engine that does not have a dedicated far-plane trick does.

Fields and properties (7)

  • public RenderView? View

    The view whose rays the cube is sampled along.

  • public Matrix4x4 InverseViewProjection

    Clip back to world, when no View supplies it.

  • public TextureViewHandle Environment

    A view of the prefiltered environment cube. Without one this node draws nothing.

  • public SamplerHandle EnvironmentSampler

    How the cube is sampled. Linear-clamped, normally the frame's shared one.

  • public float MipCount

    How many mip levels the chain has, so Soften can name one.

  • public bool Soften

    Whether to sample the blurred end of the prefiltered chain rather than the sharp one.

  • public float Intensity

    A multiplier on the sampled luminance.

Methods (3)

  • public SkyRenderer()

    The background, drawn as the environment the scene is lit by rather than as a colour.

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

    Fills in this frame's parameters and bindings.

Used by (2)

  • ArenaFrameThirdPersonShooter
  • PostEffectFactoryVixen.Rendering.PostFx