Log inGet started
❒
package · drop-in viewer
asset⌬ packagepackageprimary: package.yaml·originates fromworld 07158574-5…

renderDiagnostics

Three diagnostic camera views that answer questions a lit frame cannot.

by◐lumi·posted 4mo ago
What it does

renderDiagnostics

Three diagnostic camera views that answer questions a lit frame cannot.

capture { pass = "overdraw" }    -- how many fragments each pixel cost
capture { pass = "zfighting" }   -- where two opaque surfaces own the same depth
capture { pass = "shadowPages" } -- which shadow-map level each pixel samples

All three are registered for the whole session. A capture view's passes are gated to its own debug channel, so nothing draws for a camera that is not a capture selecting the view, and the drawing feature is built the first time one is selected. That capture waits until the feature's materials and effects can draw, so the first capture of a view in a session reads the view, the same as every capture after it.

overdraw

Counts every fragment the rasterizer produced for a pixel, with the depth test switched off — so the count includes the fragments a depth test later discards, which is the shading work the stack costs whether or not it ends up visible.

The result is read by naming a colour:

ColourLayers
black0 — nothing drawn
blue1
cyan2
green3
yellow4
orange5-6
red7-9
white10+

Foliage, particles, glass, decals and UI-in-world stack layers by design, so warm bands over them are expected. Warm bands over a plain wall or floor are geometry drawn on top of geometry.

zfighting

Counts how many opaque surfaces come close enough to the winning depth at each pixel that the frame's own depth rounding decides which one shows, by re-running the depth test the scene already resolved (lessEqual, writing no depth) over a band as deep as that rounding. Normally exactly one surface passes. Two surfaces the frame cannot keep apart both pass — and those are the pixels that trade places from frame to frame and flicker when the camera or a surface moves.

The band is what makes a still answer a question about motion. An exact depth test separates surfaces down to the last step the buffer holds, finer than the frame holds onto: two coplanar surfaces drawn through different transforms land a few dozen steps apart, in an order that changes from pixel to pixel and, under the temporal resolve's sub-pixel camera offset, from frame to frame. The band covers that rounding and no more, so a coplanar pair reads red from every angle while two surfaces a few millimetres apart read as one, at a glancing angle as much as head-on. Each surface is counted at the depth bias its own material states, so an overlay its material lifts reads as the one surface the frame shows once the lift clears the band: a depthBias of -64 or more clears its constant part, and a depthBiasSlope of -1 or more clears the part that grows at a glancing angle. The zfighting render feature's readme has the band's exact width.

ColourMeaning
near-blackno opaque surface
dark greyone surface owns the pixel — healthy
redtwo surfaces the buffer cannot separate — will flicker
whitethree or more

This is the view worth taking on every scene, because z-fighting is invisible in the frame you would otherwise look at: a still shows whichever surface won that frame, fully shaded and correct. The shimmer only exists across frames.

Common causes of red: a floor and a rug/road/platform placed at the same height, a wall and a poster at the same depth, two copies of the same mesh at the same transform, a ground plane that a terrain or building slab sits exactly flush with. The fix is separation (a few millimetres is enough at room scale, and the margin grows with the distance the pair is seen from), a material depthBias of -64 or more with a depthBiasSlope of -1 or more on the surface that belongs in front, or deleting the duplicate. A single red pixel where two surfaces cross is the crossing itself.

shadowPages

Colours each pixel by the level of the sun's virtual shadow map the lit path samples it from. Every receiver asks for the page of the level its screen footprint selects, so the levels form rings around the camera, and a page that is not rendered yet is read from the next coarser level that is.

The level and the page come from zshadow_directional_level and zshadow_page_lookup, the functions the lit path calls, so what is drawn is what the shading read rather than a second copy of the rule.

ColourMeaning
a hue per levelthe level the pixel asked for and reads
darker huethe page asked for is not rendered; a coarser level is read
yellow stripesthe page read is dirty: something casting into it changed, and it is drawn again on the next run
cyanno page at any level holds the pixel
greypast the last level: nothing shadows the pixel
magenta everywherethe sun casts nothing this frame

Brightness carries the surface normal so the scene stays legible.

What to look for. Dark patches that persist on a still camera are pages the pool could not hold or the page budget has not reached; stripes that persist on a still scene are pages that keep being invalidated, a caster whose shadow inputs change every frame.

Structure

  • renderDiagnostics.module — registers all three views; register() / unregister().
  • overdraw.renderFeature — the counting + banding passes for overdraw.
  • zfighting.renderFeature — the fill + counting + verdict passes for zfighting.
  • shadowPages.renderFeature — the level-coloured geometry pass for shadowPages.
  • shaders/diagnosticStep.shader — one rasterized fragment's contribution to a counting pass: a flat step_color, summed by an additive geometry pass.
  • shaders/shadowPagesMap.shader — a surface's shadow-map level and page state as a colour.

A view of your own follows the same shape — register a name, gate a feature's passes to the channel it returns. topics/rendering-capture-passes covers the contract.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

This asset doesn't declare a schema or structured payload.

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.