Shadows / Maya
Here are described the settings and best practices to setup beautiful real-time shadows in Verge3D for Maya.
- Preparing Maya Viewport
- Shadow Filtering Types
- Global Settings
- Per-Light Settings
- Per-Object Settings
- Troubleshooting
Verge3D supports shadows for Directional, Point, Spot, and Area lights.
Preparing Maya Viewport
It's recommended to set up Maya's viewport settings as described below to make configuring shadows easier.
Enable the following viewport options:
- Lighting → Use All Lights
- Lighting → Shadows
Make sure you have at least one light source located on your scene.
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 (Poisson Disk)
Stands for Percentage Closer Filtering. Uses pseudorandom Poisson Disk Sampling to eliminate shadow pixelation. 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
Global settings for shadows are located on the Shadows tab 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 2.5. Works only for ESM shadows.
Per-Light Settings
Shadows can be enabled/disabled for each individual light using Maya's native panels. Supported shadow settings are highlighted with green.
- Use Depth Map Shadows
- Must be enabled for shadows to appear in Verge3D.
- Resolution
- Controls how big is the shadow texture (trading between speed and quality).
- Filter Size
- Controls the blurriness ratio for shadows.
- Bias
- Can be tweaked until you get rid of self-shadow artifacts and/or the peter-panning effect.
- ESM Bias
- Controls the 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.
Per-Object Settings
You can also enable and disable receiving and casting shadow on per-object basis.
- Casts Shadows
- Enable/disable shadow casting for this object.
- Receive Shadows
- Enable/disable shadow receiving for this object.
See also Autodesk's official documentation for more information and best practices on using shadows in Maya.
Troubleshooting
Shadows in Verge3D and in the Maya 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 Maya viewport. In order to make configuring shadows easier, follow the instructions described here: Preparing Maya Viewport.
Shadows look too pixelated
- Use higher Resolution values.
- Try to mask low resolution with soft penumbra. Such shadow filtering techniques as PCF and ESM along with properly adjusted Filter Size can make pixelization less prominent.
Shadows are visible in the Maya viewport but not in Verge3D
- In order to enable shadows in Verge3D the Use Depth Map Shadows option must be enabled.
- Very high Bias can partially or completely remove shadows. If that's the case try to lower its value.
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 Filter Size.
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 Filter Size.
- 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 Casts shadows), then the shadows can have no penumbra at all no matter how large Filter Size 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!