Skip to content

Commit 6e8361c

Browse files
authored
doc: troubleshooting on shadow acne (#768)
1 parent 91955fe commit 6e8361c

5 files changed

Lines changed: 88 additions & 0 deletions

File tree

com.unity.toonshader/Documentation~/TableOfContents.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
* [Material Converter](MaterialConverter.md)
2626
* [Samples](SampleInstallation.md)
2727
* [Feature Difference](FeatureModel_en.md)
28+
* [Troubleshooting and Tips](Troubleshooting.md)
2829
* [Known Issues](Known-issue.md)
2930

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
![Example of shadow acne appearing as noisy artifacts in shadowed areas](images/TroubleShooting_ShadowAcne.png)
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+
![Rendering Layers setup showing layer configuration in URP](images/TroubleShooting_Shadow_URPLayers.png)
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+
50.2 KB
Loading
334 KB
Loading

llms.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Unity Toon Shader
2+
3+
> A cel-shading/toon shading solution for Unity supporting multiple render pipelines (Built-in, URP, and HDRP). Features a three-color system with artist-driven Shadow Control Maps and stylized lighting controls.
4+
5+
This package provides professional toon/cel-shading capabilities for Unity projects. The shader system uses a three-color approach (Base Color, 1st Shading, 2nd Shading) with Shadow Control Maps for artist-driven control over where shading appears, independent of lighting direction. The system can blend Unity's built-in shadows with stylized shading using the Shading Step and Feather controls.
6+
7+
## Documentation
8+
9+
All documentation is located in the `com.unity.toonshader/Documentation~` folder.
10+
11+
- [Basic.md](com.unity.toonshader/Documentation~/Basic.md): Core concepts including Three Color Maps and Shadow Control Maps
12+
- [ShadingStepAndFeather.md](com.unity.toonshader/Documentation~/ShadingStepAndFeather.md): Detailed shading controls and system shadow integration, including the "Receive Shadows" feature
13+
- [Troubleshooting.md](com.unity.toonshader/Documentation~/Troubleshooting.md): Common issues, workarounds, and tips including shadow acne solutions
14+
- [Known-issue.md](com.unity.toonshader/Documentation~/Known-issue.md): Known issues and limitations across different render pipelines
15+
- [TableOfContents.md](com.unity.toonshader/Documentation~/TableOfContents.md): Full documentation index
16+
17+
## Key Features
18+
19+
- **Three Color System**: Base Color, 1st Shading (shadow), and 2nd Shading (deeper shadow) for stylized lighting
20+
- **Shadow Control Maps**: Artist-driven texture maps that control where shading appears, independent of scene lighting
21+
- **System Shadow Integration**: Blend Unity's built-in shadow system with stylized shading using "Receive Shadows" and "System Shadow Level" controls
22+
- **Shading Step and Feather**: Precise controls for adjusting transition boundaries between light and shadow areas
23+
- **Multiple Render Pipeline Support**: Works with Built-in Render Pipeline, Universal Render Pipeline (URP), and High Definition Render Pipeline (HDRP)
24+
25+
## Common Issues
26+
27+
### Shadow Acne in URP
28+
29+
When shadows are enabled from lighting, shadow acne may appear where shadowed areas appear bright instead of properly darkened according to shading map settings.
30+
31+
**Solution**: Use rendering layers with custom shadow layers to selectively control which objects receive shadows. This involves enabling Rendering Layers with Custom Shadow Layers in the URP asset, setting up objects with different rendering layer masks, and configuring lights to cast shadows only on specific layers. See [Troubleshooting.md](com.unity.toonshader/Documentation~/Troubleshooting.md) for detailed instructions.
32+
33+
## Optional
34+
35+
- **HDRP Features**: HDRP includes additional capabilities like Box Light support and Toon EV Adjustment that are not available in other render pipelines

0 commit comments

Comments
 (0)