Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 4.1 — Built-in Geometries
3D Web · Example 2 of 2

Segments are the price: five balls

The same radius five times. The fourth ball uses the defaults.

three.js ships ready-made shapes: box, sphere, cylinder, torus, plane, capsule and tube. Each is a grid of vertices joined into triangles, and the segment numbers you pass decide how round it looks and how many triangles it costs.

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

Build a CylinderGeometry for a bike tube with radius 0.02 and length 0.5, with 8 sides. Print its triangle count, then predict what 16 sides gives and check.

02

You need a bell for the bike: a dome. Which built-in shape would you start from, and how would you cut it in half?

Explain it without notes

01

Why does the default sphere have 960 triangles but only 561 vertices?

02

A shape is missing from your scene and there is no error. Name three geometry-side things you would check.

Segments are the price: five balls
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

6 x 4 -> 36 triangles (formula 36)
12 x 8 -> 168 triangles (formula 168)
20 x 12 -> 440 triangles (formula 440)
32 x 16 -> 960 triangles (formula 960)
64 x 32 -> 3968 triangles (formula 3968)
drawn: 5 draw calls, 5572 triangles
geometries on the GPU: 5