getShadowMaterial
An internal material factory function that automatically creates and provides an efficient, correct, and specialized material for rendering shadow maps.
Core Advantages
It fully automates the complex and error-prone process of creating shadow materials. It ensures correctness by handling different light types and optimizes performance with a built-in caching system, freeing developers from the low-level details of shadow generation.
Common Uses
Generating parallel shadows for directional lights (e.g., the sun).
Generating perspective shadows for spotlights (e.g., a flashlight).
Generating omnidirectional shadows for point lights (e.g., a light bulb), automatically handling complex depth encoding.
How to adjust
This function cannot be adjusted, but its output is determined by the type of `light` object passed to it. For example, passing a `DirectionalLight` results in parallel shadows, while passing a `PointLight` results in perspective-correct omnidirectional shadows, as the function transparently switches to a more complex material for you.
Code Examples
1// Conceptual usage inside the renderer:
2const shadowMaterial = getShadowMaterial( myLight );