# SetShadowMappingMode

## Description

Turns shadow mapping on or off, by default this is off. Shadows are only generated by the the global directional light, which can be controlled with the SetSunDirection command. Note that this is not guaranteed to be supported on all devices, you can check for the current device by calling GetShadowMappingSupported. There are currently three shadow modes that can be used, mode 1 uses Uniform shadow mapping which has lower but consistent quality. Mode 2 uses Light Space Perspective shadow mapping (LiPSM) which has higher quality in most cases but if the camera is looking in the same direction as the light then it is no better than Uniform shadow mapping. Light Space Perspective also suffers from shadow shimmering as the camera moves whereas Uniform is more stable. Both have about the same performance. Mode 3 uses Cascade shadow mapping which uses multiple shadow maps to maintain high quality near the camera whilst still allowing lower quality shadows in the distance. This method has much lower performance than the previous two methods but results in better quality shadows in all cases.
Note that when using modes 1 and 2, texture stage 7 on all objects receiving shadow is reserved for the shadow map. When using shadow mode 3 (cascade shadows) then texture stages 4, 5, 6, and 7 are reserved for the shadow maps.

## Definition

SetShadowMappingMode( mode )

void agk::SetShadowMappingMode( int mode )

## Parameters

- mode - 0 to turn it off, 1 to use Uniform shadows, 2 to use LiPSM shadows, 3 to use Cascade shadows