Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 19.2 — Debugging Rounds
3D Web · Example 2 of 3

It flickers: what the depth buffer can tell apart

The same formula the GPU uses for a perspective camera and a 24-bit depth buffer. Whether a fight is visible on a given GPU varies; equal steps always risk it.

Debugging rounds hand you a broken scene. Five symptoms cover most of them: it is black, it is slow, it leaks, it is blurry, it flickers. Each has a short checklist, and each check is a measurement: a pixel, a triangle count, renderer.info, the pixel ratio, a depth calculation.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 4 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write a function whyBlack(renderer, scene, camera) that renders, reads the centre pixel and the triangle count, and returns the likely group of causes.

02

Write a leak test: call an action N times and fail if renderer.info.memory.textures grew by more than one.

Explain it without notes

01

Your scene is black. Give the checks you'd run, in order.

02

A configurator gets slower and slower the longer it is used. What's your hypothesis and test?

It flickers: what the depth buffer can tell apart

Console

(nothing was printed)

Expected console output

decal 1 mm above a panel       near 0.01  far 1000  at 30 m, 1 mm apart: steps 16771790 and 16771790 -> SAME: they fight
the same, near raised          near 1     far 1000  at 30 m, 1 mm apart: steps 16234209 and 16234227 -> 18 steps apart
the same, near and far tight   near 1     far 60    at 30 m, 1 mm apart: steps 16492855 and 16492874 -> 19 steps apart
decal 1 cm above               near 0.01  far 1000  at 30 m, 10 mm apart: steps 16771790 and 16771792 -> 2 steps apart
close to the camera            near 0.01  far 1000  at 0.5 m, 1 mm apart: steps 16441835 and 16442505 -> 670 steps apart