Shadows / 3ds Max
Here are described the settings and best practices to setup beautiful real-time shadows in Verge3D for 3ds Max.
Contents
- Preparing Max Viewport
- Shadow Filtering Types
- Global Settings
- Per-Light Settings
- Per-Object Settings
- Troubleshooting
Preparing Max Viewport
It's recommended to set up Max's viewport as described in this section to make configuring shadows easier.
Enable the following viewport options:
- Lighting and Shadows → Illuminate with Scene Lights
- Lighting and Shadows → Shadows
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 Verge3D Export Settings panel is used to specify the algorithm.
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 pseudorandom Poisson Disk Sampling to eliminate shadow pixelation. This shadow filtering technique is the default since 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
Global settings for shadows are located in the Verge3D Export Settings menu.
- Shadow Filtering
- Shadow map filtering algorithm. See above.
- 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 0.3. Works only for ESM shadows.
Per-Light Settings
Shadows can be enabled/disabled for each individual light using 3ds Max's native panels. Supported shadow settings are highlighted with green.
- Target Distance
- Can affect the distance at which shadows stop rendering. Available only for spot and directional lights. Tweak it only if you deal with the shadow clipping issue from the Troubleshooting section.
- On
- Enable/disable shadows.
- Shadow Map
- Must be selected in the dropdown for shadows to appear in Verge3D.
- Falloff/Field
- Defines the shadow volume (the less the better). Available only for spot and directional lights.
- Bias
- Can be tweaked until you get rid of self-shadow artifacts and/or the peter-panning effect.
- Size
- Controls how big is the shadow texture (trading between speed and quality).
- Sample Range
- Controls the blurriness ratio for shadows.
- Shadow Bias
- Additional bias setting similar to Bias. Used 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.
- Count
- Number of cascades to use. More cascades means better shadow accuracy, but lower frame rate.
- Fade
- If is greater than 0, then the size of each cascade (distance interval) is increased so that neighboring cascades overlap. Fade is then applied in the overlapping area to provide a smooth transition between cascades. Higher values mean that the cascade size is increased more, which reduces the available shadow resolution within the cascade as some of it is used in the overlap region. Do not use this parameter if you do not need it (set it to 0).
- Distribution
- Puts more resolution towards the near clip plane. Only works in perspective view.
- Cascade Margin
- Set larger values only if the shadows of tall or big objects appear truncated.
- Max Distance
- Controls how far shadows are visible from the camera. Keep it low to maintain better resolution.
Per-Object Settings
You can also enable and disable receiving and casting shadow on per-object basis.
- Receive Shadows
- Enable/disable shadow receiving for this object.
- Cast Shadows
- Enable/disable shadow casting for this object.
You may check out the following video explaining how to setup shadows in 3ds Max.
See also Autodesk's official documentation for more information and best practices.
Troubleshooting
Shadows in Verge3D and in the Max 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-traycing, 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 the Max viewport. In order to make configuring shadows easier, follow the instructions described here: Preparing Max Viewport.
Shadows look too pixelated
- Use higher Size values.
- If using directional light sources, try to decrease the Falloff/Field parameter 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 Sample Range can make pixelization less prominent.
Shadows are visible in the Max viewport but not in Verge3D
- In order to enable shadows in Verge3D the shadow map type dropdown must be set to Shadow Map.
- Very high Bias, Shadow Bias and sometimes Sample Range 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 and/or the Shadow Bias values 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 Sample Range.
Shadows from spot and directional lights are clipped
- Increase the Target Distance value.
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 Sample Range.
- 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 Cast Shadows), then the shadows can have no penumbra at all no matter how large Sample Range 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!