Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 11.5 — drei Helpers
3D Web · Example 1 of 2

What did the helpers add?

Loading the HDR file takes a moment, so wait for the printout. The helpers are ordinary scene objects and DOM nodes.

drei is a shelf of ready-made R3F parts: controls, environments, shadows, HTML labels, loaders. Each one is plain three.js underneath. Know what each adds to the scene, because some quietly add work to every frame.

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 5 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 the JSX to orbit around a crate with a floor shadow that is drawn once, using your own HDR file.

02

Predict the gl.render count after 30 frames for a scene with <ContactShadows frames={2} />, then check.

Explain it without notes

01

A scene runs at 60 fps; after adding <ContactShadows> it drops to 40. What do you check and what do you change?

02

Why might <Environment preset="sunset"> be a bad idea for production?

What did the helpers add?
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.
scene children: Mesh "crate", Group
inside the crate: Group
inside <ContactShadows>: Mesh, OrthographicCamera
<OrbitControls makeDefault>: OrbitControls | moves the default camera: true
<Environment>: scene.environment is a DataTexture | background: null
<Html> put a real div in the page: true