Shadows
BeginnerDesignerArtist Shadows bring significant information and realism to a scene. directional lights, point lights, and spot lights can cast shadows.
Shadow maps
shadow mapping to render shadows. To understand shadow maps, imagine a camera in the center of the sun, so you’re looking down from the sun’s perspective. occluders) is in shadow. shadow map for each light that casts shadows. This tells us how far each visible pixel is from the light. When Xenko renders the scene, it checks the position of each pixel in the shadow map to learn if it can be “seen” by the light. If the light can see the pixel, the light is illuminated. If it can’t, the pixel is in shadow. directional light.
Note
Directional lights page.
The shadow atlas
shadow atlas texture. You can choose how much of the shadow atlas each light uses. The larger the shadow map, the better the shadow quality, but the less space you have for shadow maps from other light sources. Generally, you should give more space to light sources that cast the most visible shadows. The size of each area in the shadow map depends on several factors:
shadowMapSizeFactorbased on theLightShadowMap.Sizeproperty (/8, /4, /2, x1, or x2)lightSize)- -
ShadowMapBaseSizeequals1024The final size of the shadow map is calculated like this:
Troubleshooting — Lights don’t cast shadows.// Calculate the size factorvar shadowMapSizeFinalFactor = shadowImportanceFactor * shadowMapSizeFactor;// Multiply the light projected size by the size factorvar shadowMapSize = NextPowerOfTwo(lightSize * shadowSizeFinalFactor);// Clamp to a maximum sizeshadowMapSize = min(shadowMapSize, ShadowMapBaseSize * shadowSizeFinalFactor);
See also
- Point lights
- Directional lights
- Spot lights
- Troubleshooting — Lights don’t cast shadows
