Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 4.4 — Normals
3D Web · Example 2 of 2

The normals helper on a two-panel roof

Left roof: shared vertices, so one averaged normal at the ridge. Right roof: separate vertices, so each panel keeps its own. The blue lines are the helper. The roofs are drawn on both sides.

A normal is a short arrow, one per vertex, that says which way the surface faces. Light is worked out from it. Sharing or splitting vertices decides whether an edge looks smooth or sharp, and a missing, zero or inverted normal gives the most confusing lighting bugs.

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

Make a ball look faceted without copying the geometry, using a material option.

02

Print the normal of vertex 0 of a PlaneGeometry(1, 1) and say why.

Explain it without notes

01

Why does a cube have 24 vertices and not 8?

02

A model you loaded is lit as if the light came from the opposite side. What would you check?

The normals helper on a two-panel roof
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

indexed:      6 vertices, ridge vertex normal: 0.26, 0.97, 0.00
not indexed:  12 vertices, ridge normals: -0.62, 0.78, 0.00 and 0.62, 0.78, 0.00
draw calls: 4 (two meshes and two helpers)
lines: 18