Command Palette

Search for a command to run...

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

Five balls: smooth, flat, none, inverted, zero

From the left: smooth, flat, no normal attribute, inverted, all zero. The status bar shows 5 draw calls and 1,440 triangles (288 each); the console lists vertex and normal counts.

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?

Five balls: smooth, flat, none, inverted, zero
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

smooth (shared corners)  vertices: 187 | normals: 187
flat (own corners)       vertices: 864 | normals: 864
no normal attribute      vertices: 187 | normals: none
inverted normals         vertices: 187 | normals: 187
all-zero normals         vertices: 187 | normals: 187
normal of vertex 0 (the north pole): 0.00 1.00 0.00
its length: 1.00