ShadowNodeMaterial
A node material used to receive and render shadows onto a transparent surface. It makes the object it's applied to invisible but shows the shadows cast upon it by other objects, creating a "shadow catcher" effect. [1] It is the node-based version of ShadowMaterial.
Core Advantages
Its core value is the ability to create a "shadow catcher" that can receive shadows on a completely transparent plane. This is crucial for seamlessly compositing 3D models into real-world photo or video backgrounds (e.g., in AR applications), as it allows objects to cast realistic shadows onto the background without needing a visible ground plane. [1]
Common Uses
Creating an invisible ground plane that only receives shadows
In Augmented Reality (AR) applications, to make virtual objects cast shadows on real surfaces
In product visualization scenes, to have a product cast a shadow onto a background image
Seamlessly compositing 3D rendered objects over 2D backgrounds
How to adjust
The material's appearance is primarily determined by the scene's lighting and the objects casting shadows, rather than its own properties. You can adjust the `color` property to tint the shadow (it defaults to black). The `opacity` property controls the intensity or darkness of the shadow; a lower value results in a fainter shadow. For better shadow quality, you may need to adjust the shadow properties of the light source casting the shadow (e.g., `light.shadow.mapSize` and `light.shadow.bias`).
Code Examples
1{/* This plane will be invisible but will catch shadows */}
2<mesh receiveShadow position-y={-1}>
3 <planeGeometry args={[10, 10]} />
4 {/* opacity controls the darkness of the shadow */}
5 <shadowNodeMaterial transparent opacity={0.5} />
6</mesh>