|
| 1 | +# Troubleshooting and Tips |
| 2 | + |
| 3 | +This page contains common issues, workarounds, and tips for using **Unity Toon Shader** effectively. |
| 4 | + |
| 5 | +## Shadow Acne |
| 6 | + |
| 7 | +When [Receive shadows](ShadingStepAndFeather.md#receive-shadows) is enabled, you may observe **shadow acne** - |
| 8 | +areas within shadows that appear noisy. This is due to self-shadowing artifacts where the shader's shadow |
| 9 | +calculations interact with the geometry of the model, causing small discrepancies in depth that result in visible |
| 10 | +noise. |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +### Workarounds for Universal Render Pipeline (URP) |
| 15 | + |
| 16 | +There are several approaches to address shadow acne in URP: |
| 17 | + |
| 18 | +1. **Use Rendering Layers with Custom Shadow Layers**: This method gives you fine-grained control over which objects |
| 19 | + cast shadows on which surfaces, helping eliminate unwanted shadow artifacts while keeping all objects properly lit. |
| 20 | + |
| 21 | +  |
| 22 | + |
| 23 | + This is an example of a step-by-step setup: |
| 24 | + |
| 25 | + a. **Enable Rendering Layers in URP Asset**: |
| 26 | + - Select your URP Asset |
| 27 | + - Enable [**Rendering Layers**](https://docs.unity3d.com/Manual/urp/features/rendering-layers-lights.html) with |
| 28 | + **Custom Shadow Layers** |
| 29 | + |
| 30 | + b. **Set up the scene**: |
| 31 | + - Add a plane GameObject as the floor |
| 32 | + - Add a sphere with a Toon material. Set its **Rendering Layer Mask** to "Default" |
| 33 | + - Add another sphere with a Toon material. Set its **Rendering Layer Mask** to "Default" and |
| 34 | + "Light Layer 1" |
| 35 | + - Add a plane GameObject above the spheres that will cast shadows. Set its **Rendering Layer Mask** to |
| 36 | + "Default" and "Light Layer 1" |
| 37 | + |
| 38 | + c. **Configure the Light**: |
| 39 | + - Select your Light (typically a Directional Light) |
| 40 | + - Set the light to render to both layers: "Default" and "Light Layer 1" |
| 41 | + - Set the light to only cast shadows on "Light Layer 1" |
| 42 | + |
| 43 | + This configuration allows you to control which objects receive shadows while all objects remain lit, helping |
| 44 | + eliminate shadow acne on specific objects. |
| 45 | + |
| 46 | + For more information, refer to the |
| 47 | + [Universal Render Pipeline documentation](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest). |
| 48 | + |
| 49 | +2. Disable [Receive shadows](ShadingStepAndFeather.md#receive-shadows) entirely on affected materials |
| 50 | +3. Adjust the **System Shadow Level** parameter to reduce the intensity of system shadows |
| 51 | + |
| 52 | + |
0 commit comments