SetShadowMode
This functions sets the entity shadow mode, which controls whether the entity casts shadows.
Syntax
- void SetShadowMode(const int mode)
Parameters
- mode: this value may be 0 or a combination of the Light::None, Light::Static, Light::Dynamic, and Light::Buffered flags.
Remarks
Leadwerks uses a deferred renderer to draw any number of lights, all casting dynamic soft shadows. It includes advanced optimizations that can be used to dramatically optimize performance. Understanding how the entity shadow mode works is key to gaining these benefits.
Entities that are part of the scene and don't move (like CSG brushes) should use Light::Static for the shadow mode.
Entities that move around in the scene, like characters or physically interactive objects, should use Light::Dynamic for the shadow mode.
Directional lights should always use Light::Static|Light::Dynamic for the shadow mode. This will ensure the light casts a shadow on both static and dynamic entities.
Point and spot lights that move around the scene should always use Light::Static|Light::Dynamic for the shadow mode. This will ensure the light casts a shadow on both static and dynamic entities.
Point and spot lights that do not move should use Light::Static|Light::Dynamic|Light::Buffered for the shadow mode. This will store the rendered shadows from all static and dynamic entities in two separate shadow maps.
When a dynamic object moves, only the dynamic shadow map has to be redrawn. This can have a huge savings in your shadow render polycount, and greatly increase performance.
Finally, you may wish to include extra lights to add the appearance of indirect shadows. You can set a point or spot light to use Light::Static for the shadow mode, and it will add some extra shadows that enhance the scene, without ever requiring a redraw.