Project 9: Shadow Casting Demo
3D Engineer
Builds on these lessons
Step 1 of 2
Project
Casting a Shadow
Canvas needs shadows enabled, the light needs castShadow, and the mesh needs castShadow too, before any shadow appears.
🎯 Your Task
Please add the exact code shown in the light gray box below to your editor.Do not delete your previous code, just insert these new lines in the correct place!
export default function Scene() {
return (
<Canvas shadows>
<ambientLight intensity={0.4} />
<directionalLight position={[3, 4, 2]} intensity={1.2} castShadow />
<mesh position={[0, 1, 0]} castShadow>
<boxGeometry args={[1, 1, 1]} />
<meshStandardMaterial color="orange" />
</mesh>
</Canvas>
);
}