Shadows / Blender
Here are described the settings and best practices to setup beautiful real-time shadows in Verge3D for Blender.
Contents
- Preparing Blender Viewport
- Shadow Filtering Types
- Global Settings
- Per-light Settings
- Configuring Cascades for Sun Shadows
- Per-object Settings
- Troubleshooting
Preparing Blender Viewport
It's recommended to set up Blender's viewport as described in this section to make configuring shadows easier.
Verge3D aims to resemble Blender's Eevee renderer. Follow these instructions to enable it:
- Ensure that the Render Properties → Render Engine option is set to EEVEE. Eevee is enabled in Blender 2.8+ by default, but for a particular .blend file some other render engine could be used. In such case it's recommended to switch it back to Eevee.
- Set the Viewport Shading option to Rendered.
It's also worth noting that Verge3D doesn't support shadows the same way Blender supports them. In order to achieve soft shadows in Verge3D one can try different shadow filtering methods and adjust the shadow blur radius setting.
Shadow Filtering Types
Shadows in Verge3D look very differently depending on what shadow map filtering algorithm is in use. The Shadow Filtering property located on the Render Properties tab is used to specify the algorithm.
For usage example, check out the Tea Ceremony demo (source files available in the Asset Store).
Basic
Disable filtering, render shadow map as is. This is the fastest method to render shadows.
Bilinear
Use bilinear filtering to smooth adjacent shadow map pixels.
PCF
Stands for Percentage Closer Filtering. Uses multiple shadow map lookups for smoothed shadow rendering. Average quality and performance. Uses pseudorandom Poisson Disk Sampling to eliminate shadow pixelation for PCF shadows. This was made the default setting because it corresponds the most to what you see in the 3D editor viewport.
ESM
Stands for Exponential Shadow Maps. Shadows are smoothest but light leaks are possible. Use ESM Bias setting on lights to remove light leaks artifacts. The performance is comparable to PCF algorithm. ESM shadows can be particularly tricky to set up, therefore see ESM-related issues in the Troubleshooting section.
Which filtering type to choose?
It's recommended to try the default PCF shadows first, because they offer good quality and performance. If you need faster but less quality shadows then try Basic or Bilinear. Try ESM if you want more quality, soft shadows, but the drawback is that they can be tricky to set up (artifact-wise) for a particular scene.
Global Settings
The rendering of the shadows is tuned using the Shadows and Verge3D Settings panels located on the Render tab in Blender.
- Shadows
- Enable/disable shadows for the scene.
- Light Threshold
- Light intensity threshold used to calculate shadow volume distance.
- Shadow Filtering
- Shadow map filtering algorithm. See above.
- Map Side
- Denotes which side of polygons is rendered during the shadow pass. Tweak this value to eliminate self-shadowing artifacts or if you render the plain models (such as leaves or papers).
- ESM Distance Scale
-
ESM shadows scaling factor. Since the ESM filtering algorithm uses
absolute distance values, decrease the scale value if you're working
on a scene which is much bigger than the default cube, and increase
it if your scene is much smaller. Default value is
1
. Works only for ESM shadows. - Cube Size
- Shadow map size for shadows casted from Point, Spot, and Area lights. The higher values give better rendering quality but reduce performance.
- Cascade Size
- Shadow map size for shadows casted from Sun lights. The higher values give better rendering quality but reduce performance.
Per-light Settings
Shadows can be enabled/disabled/tweaked for each individual light using the Shadow and Verge3D Settings panels.
- Shadows
- Enable/disable shadows casted from the light.
- Blur Radius
-
Specify value higher
1
to make your shadows smoother (increase shadow blurriness). This parameter works only for PCF and ESM shadows. - Clip Start
- Near clipping distance, higher values may slightly improve shadow quality.
- Bias
- Main parameter you should tweak to get rid of self-shadow artifacts and/or the "peter-panning" effect.
- ESM Bias
- Bias to reduce ESM light leaking artifacts. Works only for ESM shadows.
For Sun lights there are additional parameters to configure shadow cascades:
- Count
- Number of textures used to render shadow cascades.
- Fade
- Smoothness factor for transition between cascades.
- Max Distance
- End distance (measured from the camera) of the last cascade.
- Distribution
- Higher value increase distribution toward the viewpoint.
- Cascade Margin
- Increase the default value if the shadows from tall or large objects appear truncated.
Configuring Cascades for Sun Shadows
Cascaded shadow maps are fully supported starting from Verge3D 4.6. The recommended recipe to configure them would be:
- Go to active camera view using the View→Cameras→Active Camera menu or Numpad 0 key.
- Tweak the Cascaded Shadow Map parameters.
- Check the shadows in Verge3D.
- Increase the Cascade Margin parameter if the shadows from tall or large objects appear truncated.
For better rendering performance, try to keep the number of cascades (as well as their resolution) low.
Per-object Settings
Shadows can be enabled/disabled for each individual object through the Visibility and Verge3D Settings panels.
- Ray Visibility → Shadow
- Enable/disable shadow casting for the object.
- Receive Shadows
- Receive (render shadows) on the given object.
Troubleshooting
Shadows in Verge3D and in the Blender viewport look different
- Verge3D doesn't use the same shadow rendering techniques as a 3D software can use — mostly for performance reasons. This can include ray-tracing, various post-processing effects and non-realtime methods. That's why there can be differences and shadows won't look exactly the same as in the viewport.
- Verge3D aims to resemble Eevee render engine. In order to make configuring shadows in Eevee easier, follow the instructions described here: Preparing Blender Viewport.
- If using Sun light sources, see Configuring Sun Shadows.
Shadows look too pixelated
- Use higher Cube Size values for Point, Spot, and Area lights. Use higher Cascade Size values for Sun lights.
- If using Sun light sources, try to decrease the Max Distance value as much as possible as long as it fits your scene.
- Try to mask low resolution with soft penumbra. Such shadow filtering techniques as PCF and ESM along with properly adjusted Blur Radius can make pixelization less prominent.
Shadows are visible in the Blender viewport but not in Verge3D
- Shadows are enabled by default, but they could be disabled manually. Make sure that the Enable Shadows option is active. Also, make sure that the Receive Shadows option was not disabled for objects that should receive shadows.
- Very high Bias and sometimes Blur Radius can partially or completely remove shadows. If that's the case try to lower those values.
Shadows have artifacts
- Such artifacts are called "shadow acne" or "self-shadow artifacts". Increase the Bias value to get rid of them.
Shadows have no/small penumbra
- In case of Basic or Bilinear shadows there's no control of the penumbra. Choose the other shadow filtering types instead.
- Increase Blur Radius.
ESM shadows look faded
- Increase the ESM Bias value.
- Increase the ESM Distance Scale value.
ESM shadows look too sharp or have no penumbra
- Increase Blur Radius.
- Decrease the ESM Bias value.
- Decrease the ESM Distance Scale value.
- Such artifacts can appear on a receiver object's edge. It's one of ESM drawbacks. The solution is to avoid such situations.
- If an object receiving shadows doesn't cast shadows itself (e.g. if they are disabled via Shadow Mode), then the shadows can have no penumbra at all no matter how large Blur Radius is. The solution is to enable shadow casting on the receiving object or use an additional shadow casting object as an underlay to fix the penumbra.
ESM Shadows have artifacts
- Decrease the ESM Bias value.
- Decrease the ESM Distance Scale value.
Cascaded shadow maps, shadows are clipped at a certain angle
- Increase the Cascade Margin.
Cascaded shadow maps and ESM shadows, shadows look faded at the intersection of cascades
- Increase the Cascade Margin.
- Increase the ESM Bias value.
- Increase the ESM Distance Scale value.
Got Questions?
Feel free to ask on the forums!