Introduction
In this documentation, we will talk about how you can add and customize shadows in your scene.
This documentation will not cover the topic of billboard shadows, you can read about this here.
When talking about shadows we can differentiate between two kinds: static and dynamic. They require a different workflow and will give different results. We will discuss the possibilities.
Static Shadows
As the name shows, these shadows are static meaning that they can not be moved. Usually, they are calculated into a lightmap. These shadows are more realistic and less heavy on performance.
In this picture, we are using lightmaps to capture the shadows of the leaves. You can learn more about lightmaps here and here.
Dynamic Shadows
Dynamic shadows can be moved and their parameters can be changed. In Aximmety if you wish to have dynamic shadow you need to use dynamic lights too.
The following Dynamic lights can be used to generate shadows:
- Spot Light
- Spot Light GW
- Directional Light
- Directional Light GW
First, you need to turn on the Cast Shadow property in the light source(s):
You can also characterize the shadow that they cast.
- You can decrease/increase the Intensity of the light this will also decrease/increase the perceptive intensity of the shadow.
- You can change the resolution of the shadow by setting the Shadow Map Size property, a higher number means a bigger resolution
- a higher resolution means nicer shadows but they will be slower to render. We usually suggest not to go over 2048.
- you can set how near and far the shadow appears using the Shadow Near Plane and Shadow Far Plane properties.
- We suggest setting it up so it covers a bit more than the region you wish to have shadows in.
- You can also use the Shadow Customized BB property to adjust where the shadows appear.
- This will mark a cube in the 3D space and shadows will only be visible inside it. We suggest giving it a slightly larger cube than the region you wish to have shadows in.
- If you find that the shadows have zig-zaggy artifacts you can increase the Shadow Antialias property to reduce it
- We suggest not going over 4x
- We suggest not going over 4x
- Shadow Softness property can be adjusted to make the edges of the shadow softer
- Shadow Soft Quality makes the blurring of the shadow nicer
- Shadow Bleed Reduc makes the shadow appear darker
Spot Light GW and Directional Light GW have some additional parameters
- GW Shadow Technique Type lets you set the basic characteristic of the shadow
- Hard - will produce hard shadows
- PCF - Tries to eliminate hard zig-zaggy edges of shadows
- PCSS - The shadow gets softer with distance
- Shadow Light Size This property will increase the size of the light from which the shadows are calculated.
- Smaller light sources will cast harder shadows.
- Larger light sources will cast softer, more spread-out shadows
Ambient Occlusion
Ambient Occlusion(AO) or contact shadow appears in tight spaces where less light can enter.
For example: around the sphere and at the back of the wall
When using static shadows AO is usually baked into the lightmap itself.
In some special cases, you may end up getting AO in a separate map you can use any of our shaders that have AO in its name, for example, PBR_IBL_Norm_Light_AO.xshad
If you are using dynamic lights or you think the baked AO is not strong enough you can use one of our screenspace AO modules: Ambient Occlusion / Ambient Occlusion GW
You can learn about how they work here.