🌑How to use shadow
Configure a directional light, scene objects, and receiving surfaces so shadows appear correctly, then refine their quality and softness.
A shadow is a depth map from the light's point of view. The GPU draws casters into that map, then tests receivers against it. That is extra work every frame. Use it for the main sun or moon silhouette, not on every fill light.
Which lights can cast
Directional Light
ENGINE.DirectionalLightNode
Yes — main outdoor / sun shadows. Optional CSM for long view distances.
Spot Light
ENGINE.SpotLightNode
Yes — a cone. Extra GPU cost per light that has Cast Shadow on.
Point Light
ENGINE.PointLightNode
Yes — all directions. Extra GPU cost per light that has Cast Shadow on.
Ambient Light
ENGINE.AmbientLightNode
No. Shadow setup is a no-op.
Hemisphere Light
ENGINE.HemisphereLightNode
No. Shadow setup is a no-op.
Rect Area Light
ENGINE.RectAreaLightNode
No. Shadow setup is a no-op.
Keep Cast Shadow on one directional for the world silhouette. Turn it off on decorative point lights. Ambient and hemisphere fill the scene without maps. Adding lights: How to set up a light. Measuring cost: Performance & optimization.
Why a shadow is missing or cuts off
The directional light uses an orthographic shadow camera. Casters outside that box never appear in the map, so they throw no silhouette even when Cast Shadow is on.
Default box on DirectionalLightNode (when CSM is off): shadowCameraLeft / Right / Top / Bottom at ±50, shadowNear 0.1, shadowFar 100. Widen the box or shadowFar if the play space is larger than that. A box that is much larger than the scene wastes resolution (blocky edges).
Also check:
The light's Cast Shadow is on.
The mesh's Cast Shadow (caster) and Receive Shadow (ground) are on.
The mesh is drawn: visible on, hiddenInGame off for Play, not editorOnly if you expect it in Play.
CSM (
useCsmShadows): for large view distances. Only one directional light can drive CSM at a time.csmMaxFarshould stay smaller thanshadowFar. MorecsmCascadeCountcosts more GPU. Leave CSM off for small, fixed scenes.
Performance
shadowMapSize is the map resolution (default 2048, square). Higher is sharper and heavier. Lower is cheaper and blockier. shadowRadius is the PCF kernel radius (edge softness). It does not make shadows longer.
Each extra light with Cast Shadow on adds another map pass. CSM splits that work into cascades (csmCascadeCount, default 4).
Turn Cast Shadow off on small props, particles, and anything the player will not miss. A floor needs Receive Shadow; a sky mesh does not.
Adjust the shadow quality
Select the directional light and change one Inspector value at a time. The engine copies these onto the Three.js shadow: mapSize, bias, normalBias, near / far on the shadow camera, and radius. The renderer uses PCF (THREE.PCFShadowMap) on both WebGL and WebGPU, which is why radius has an effect.
shadowMapSize
Width and height of the depth map, in pixels (same value on both axes). Default 2048. Changing it disposes the old map so the new size applies. Larger = sharper silhouettes, more memory and GPU. Smaller = cheaper, blockier.
shadowBias
Depth offset for the comparison. The engine describes it as a conservative negative bias. A live directional in-project used -0.0005. Too close to zero (or the wrong sign for your setup) shows shadow acne: speckles and flicker on the lit surface. A larger magnitude pulls the silhouette off the mesh (a gap). With CSM on, each farther cascade uses shadowBias * (cascade index + 1) so distant cascades get more bias automatically.
shadowNormalBias
Offset along the surface normal. Use it for self-shadowing on slopes. It is copied to each CSM cascade as-is. It does not lengthen the shadow.
shadowNear / shadowFar
Near and far planes of each shadow camera. Defaults 0.1 and 100. Geometry closer than near or farther than far is not in that map. For CSM, these apply per cascade; keep shadowFar larger than csmMaxFar. The directional node also places its light target at shadowFar * 0.5 along the light direction so the shadow camera overshoots the aim point.
shadowRadius
PCF sample radius (shadow.radius). Default 3. Higher = softer, wider edges. Lower = harder edges. This is not shadow length and not bloom.
shadowCameraLeft / Right / Top / Bottom
Ortho box for standard directional shadows only (CSM off). Defaults ±50. Ignored as the coverage box when useCsmShadows is on — CSM fits cascades from the play camera instead (csmMaxFar, csmLightMargin, csmMode: practical / uniform / logarithmic, csmFade to blend cascade joins).
Disable unwanted shadows
Disable the setting that controls the shadow you want to remove.
To remove every shadow from the directional light, disable Cast Shadow on the light.
To remove one object's shadow, disable Cast Shadow on that object.
To stop a surface from displaying shadows, disable Receive Shadow on that surface.
What You've Done
The directional light and scene objects now work together to cast and receive shadows. You can refine the result per object or from the light without affecting unrelated scene elements. If silhouettes vanish at the edge of the level, widen the shadow camera or shadowFar before raising shadowMapSize.
Last updated
Was this helpful?

