Command Palette

Search for a command to run...

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

It is black: five causes, measured

Pixels and triangle counts, the same on every GPU for these flat cases.

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 is black: five causes, measured
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

fine                   -> centre: orange       | triangles drawn: 12
no light               -> centre: 0, 0, 0      | triangles drawn: 12
camera inside the box  -> centre: 11, 17, 24   | triangles drawn: 12
near plane too far     -> centre: 11, 17, 24   | triangles drawn: 0
box behind the camera  -> centre: 11, 17, 24   | triangles drawn: 0
scale 0                -> centre: 11, 17, 24   | triangles drawn: 12