Skip to content

Commit 6fa754d

Browse files
committed
Add recommendations for 3D light shadow bias (#5340)
* Add recommendations for 3D light shadow bias These are the settings I usually recommend based on my personal experience.
1 parent a3b2611 commit 6fa754d

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

tutorials/3d/lights_and_shadows.rst

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,40 @@ There is a list of generic shadow parameters, each also has a specific function:
5252
- **Color**: Areas occluded are multiplied by this color. It is black by default, but it can be changed to tint shadows.
5353
- **Bias**: When this parameter is too small, self shadowing occurs. When too large, shadows separate from the casters. Tweak to what works best for you.
5454
- **Contact**: Performs a short screen-space raycast to reduce the gap generated by the bias. Contact shadows are only available when using the GLES3 backend.
55-
- **Reverse Cull Faces**: Some scenes work better when shadow mapping is rendered with face-culling inverted.
55+
- **Reverse Cull Face**: Some scenes work better when shadow mapping is rendered with face-culling inverted.
5656

5757
Below is an image of what tweaking bias looks like. Default values work for most
5858
cases, but in general it depends on the size and complexity of geometry.
5959

6060
.. image:: img/shadow_bias.png
6161

62-
Finally, if gaps can't be solved, the **Contact** option can help:
62+
Finally, if gaps can't be solved, the **Contact** option can help (at a performance cost):
6363

6464
.. image:: img/shadow_contact.png
6565

6666
Any sort of bias issues can always be fixed by increasing the shadow map resolution,
67-
although that may lead to decreased performance on low-end hardware.
67+
although that may lead to decreased performance.
68+
69+
.. tip::
70+
71+
If shadow biasing is a problem in your scene, the following settings are a good starting point:
72+
73+
- Enable **Reverse Cull Face**. This reduces shadow peter-panning significantly
74+
and prevents lights from exhibiting shadow acne at grazing angles.
75+
The main downside is that it may cause lighting to leak in some corners.
76+
The other downside is that materials that have their cull mode set to
77+
**Disabled** or MeshInstances with Cast Shadow set to **Double-Sided**
78+
may exhibit shadow acne.
79+
- Set **Bias** to ``-0.01``. The bias should be a negative value when
80+
**Reverse Cull Face** is enabled, but it should be a positive value when it's disabled.
81+
- For DirectionalLight, set the directional shadow **Normal Bias** to ``0.0``
82+
and **Bias Split Scale** to ``0.0``. Depending on your scene, you may also
83+
want to further decrease **Bias** to a value between ``-0.05`` and ``-0.1``.
84+
85+
Following the above tips should make it possible to avoid gaps in shadows without
86+
resorting to contact shadows (which have many issues of their own).
87+
If shadow acne is still visible after performing the above tweaks,
88+
try subdividing your meshes further in your 3D modeling software.
6889

6990
Directional light
7091
~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)