pub enum DebugView {
Shaded,
Heatmap,
LodTint,
Normals,
AmbientOcclusion,
Motion,
BentNormal,
ShadowAtlas,
Cascades,
}Expand description
Which picture the colour pass draws instead of the shaded one.
The engine’s debug views, as one value rather than as independent booleans,
because they are not independent: every one of them rides in a single lane of
the frame’s uniform block and the shaders test the thresholds outermost
first, so a renderer with two of them set draws exactly one.
ForwardRenderer::debug_view is where that order lives, and this is what it
answers with — so a menu row, a debug panel and the picture cannot disagree
about which view is on.
The declaration order is not the precedence — each view was appended as
it arrived, and ForwardRenderer::debug_view is the one place the order is
decided. The sentinels in
FrameUniforms ascend with it, though:
see its HEATMAP_VIEW_ON, and the shaders test the outermost threshold
first.
Variants§
Shaded
The lit picture. What every frame draws unless a caller asked otherwise.
Heatmap
Each cluster shaded by the projected screen-space error the LOD
selection judged it on — ForwardRenderer::set_heatmap.
LodTint
Each cluster tinted by the DAG level it was decimated to —
ForwardRenderer::set_lod_view.
Normals
World-space surface normals — ForwardRenderer::set_normals_view.
AmbientOcclusion
The ambient-occlusion channel alone, as grey —
ForwardRenderer::set_occlusion_view.
Motion
The motion vector each fragment wrote, stretched and centred on grey —
ForwardRenderer::set_motion_view.
BentNormal
The bent direction the occlusion channel carries beside its scalar, as
n * 0.5 + 0.5 — ForwardRenderer::set_bent_normal_view. Wins over
every other view.
ShadowAtlas
The sun’s cascades and the lit tiles beside them — the D32Float shadow
atlas itself, letterboxed over the finished frame with a border round
every occupied slot — ForwardRenderer::set_atlas_view.
The one view that is a pass rather than a branch in mesh.slang, and
therefore the one whose lane is the off sentinel: the colour pass draws
the shaded picture exactly as it always did and crate::atlas_view
replaces it afterwards. That module’s header is where the placement is
argued.
It resolves below every view above and above Self::Cascades — see
ForwardRenderer::debug_view.
Cascades
The shaded picture tinted by the cascade each sun-lit fragment’s shadow
was sampled from, with the cross-fade band drawn as the blend of the two
— ForwardRenderer::set_cascade_view.
Loses to every other view, and it is the only one that does. The views
above draw something instead of the shaded picture; this one draws the
shaded picture and multiplies it, so there is nothing left for it to
modulate as soon as one of them is on. See
ForwardRenderer::debug_view.