There are currently two ways to assign a per object shadow map:
- Via the Environment:PerEntityShadows flow graph node.
- Directly from game code via I3DEngine interface functions.
Object Shadows Flow Graph Node
Create a PerEntityShadows node and assign the target entity to the 'entity' slot. The trigger input will apply the settings to the engine.
Note that the node is stateless w.r.t. the entity, so you can add multiple PerEntityShadow nodes for the same entity. The last one to trigger will be in effect.
There are various configurable settings to tweak the shadow appearance:
- ConstBias/SlopeBias: Can be used to avoid self shadowing artifacts.
- Jittering: Filter kernel size, directly affects shadow softness.
- BBoxScale: Scale factor for bounding box of the selected entity. Can be useful in case the engine bounding box is too small or too large.
- ShadowMapSize: Size of the custom shadow map. Note: automatically rounded to the next power of two.
Per object shadows are subject to a number of restrictions:
- They only affect sun shadows.
- For performance reasons, per object shadows are not sampled on forward geometry (e.g. particles, forward rendered hair and eyes).
e_ShadowsPerObject: 0=0ff, 1=on, -1=don't draw object shadows.