Build Tips
intermediate performanceGlobal Snow & Rain 3 · Troubleshooting & FAQ
Global Snow draws the snow with one main shader, Hidden/GlobalSnow, that contains many features. Unity compiles one version of the shader, called a shader variant, for each combination of features that the project can turn on. The first build can take a long time, mostly with Direct3D 11 on Windows. Later builds use the shader cache and are faster. You can reduce the number of variants, and the build time, by removing the features that your project does not use.
Shader Keywords
Each feature of the inspector uses one shader keyword.
| Keyword | Feature in the inspector |
|---|---|
GLOBALSNOW_ZENITHAL_COVERAGE | Use Zenithal Coverage. |
GLOBALSNOW_COVERAGE_MASK | Coverage Mask. |
GLOBALSNOW_FLAT_SHADING and GLOBALSNOW_RELIEF | Complexity set to Flat Shading or Relief Mapping. Normal Mapping uses neither of them. |
GLOBALSNOW_FOOTPRINTS | Footprints. |
GLOBALSNOW_TERRAINMARKS | Collision Marks. |
GLOBALSNOW_RAIN | Rain, Puddles and Wall Wetness. |
GLOBALSNOW_FROST | Frost. |
GLOBALSNOW_LAYER | Snow Accumulation. |
Edit the Shader
- Open
Assets/GlobalSnow/Runtime/Resources/GlobalSnow/Shaders/GlobalSnow.shader. - Search for the keyword. It can appear in more than one pass, so change every line where it appears.
- If your project never uses the feature, add
//at the start of the line. The feature then stays off, even if you turn it on in the inspector. - If your project always uses the feature, replace the line with
#define, the keyword and the value 1, for example#define GLOBALSNOW_LAYER 1. The feature then stays in the shader in every scene. - For Complexity, remove from the line the keywords of the modes that you do not use. If you use only one mode, apply step 3 or step 4 to the whole line.
For example, this line of the main pass adds the Frost feature:
#pragma multi_compile_local_fragment _ GLOBALSNOW_FROST
If your project never uses Frost, change it to:
// #pragma multi_compile_local_fragment _ GLOBALSNOW_FROST
Each keyword that you remove this way halves the number of variants of the pass. For example, in Unity 6.0 the main pass can have up to 2,304 variants, and without Rain and Frost it has 576.
GlobalSnow.shader, so apply your changes again after each update.
Next Steps
- Performance Tips - settings that reduce the cost of Global Snow at runtime.
- Parameters - every option of the inspector.
Suggest an improvement
Help us improve this documentation page.