Scene Setup (Forward Rendering Path mode)
Sun: make sure you have a proper directional light assigned as the Sun. It’s necessary to compute relief and occlusion effects. Global Snow will pick a directional light automatically for you but ensure this is the good one.
Global Snow uses custom replacement shaders to render the snow over the scene geometry. By default all opaque objects will be covered by snow (see FAQ section for exclusion options). The following setup parameters will help some common shaders work with Global Snow:
Update Speed Tree: enable this option to support SpeedTree and SpeedTree billboard objects.
Remove Leaves: enables a SpeedTree variant shader that removes tree leaves. For best results, it’s recommended that you use custom Winter tree models. However this option allows you to quickly prune all tree leaves if you want.
Billboard Coverage: specifies the amount of snow over tree billboards and grass objects.
Opaque Cutout: by default, opaque objects will be covered by snow. But some shaders expose holes or transparent parts of a texture and still they use the Opaque rendertype. Enabling this option will force GlobalSnow to discard those transparent pixels preventing them from being covered by snow (in this case a transparent pixel needs to have RGBA=0,0,0,0 value). Some trees may require you to to enable this option so their leaves render appropriately with Global Snow.
Fix Materials: this option will force all materials to expose a RenderType tag. It’s a good recommendation for shader developers to specify a RenderType per shader. However not all shaders expose this tag. Because of this, it’s possible that some objects get clipped by the snow. If this happens to your scene, enable this option to force all non-transparent materials to expose an Opaque render type.
Force VR SPSR: this option is only available in Unity 5.5 or higher. Will enable compatibility with OpenVR. Don’t use if your VR SDK is Oculus.
Scene Setup (Deferred Rendering Path mode)
Sun: make sure you have a proper directional light assigned as the Sun. It’s necessary to compute relief and occlusion effects. Global Snow will pick a directional light automatically for you but ensure this is the good one.
Forward Rendering: enable this option to override deferred rendering and use the forward rendering mode of Global Snow.
Deferred Camera Event: this option specifies when the snow shader passes will be executed. By default this setting is BeforeReflections and that should be the “good setting”. However, if you disable deferred reflections in Graphics Settings, you will need to change this to “Before Lighting”.
FP Normals Buffer: enable this option to use floating-point backed normal buffer (16 bit precision) instead of normal 8-bit precision. Use it only if you see snow artifacts in the distance.
Allow Batched Meshes: this option is only used when excluding objects from snow coverage (ie. using the Layer Mask field). If the excluded objects are part of static batching, Global Snow detects this situation and uses the mesh from the collider itself. However, since the mesh collider usually is a low resolution version of the original mesh, this can produce artifacts. In this case, either disable static batching or enable this option to force Global Snow to exclude the entire batched mesh.
Unity standard tree and billboards (only in deferred mode)
-
Inside the folder Resources/Workflow_Deferred/Shaders/Grass & Billboards you can find a package containing shader replacements for the default grass and tree billboards in case you need to support them.
-
Also you can use the alternate “TreeOpaque Soft Occlusion Bark” shader located inside the same folder (subfolder Tree).
-
SpeedTrees are supported in this mode so you don’t need to change them.
Quality
This section offers main quality/performance options:
Best Quality: uses a high resolution coverage texture, relief shading, occlusion and glitter effects.
Medium: uses a smaller resolution coverage texture, relief shading, occlusion and glitter effects. It also enables Distance Optimization option with a default value of 500m.
Fastest: uses a smaller coverage texture and flat shading (which still looks good!). It also enabled Distance Optimization beyond 100m.
Note that these presets just apply some factory values to other settings across the inspector. They are provided for convenience, as shortcuts to other options.
Distance Optimization: when enabled, a secondary simpler and faster algorithm is used to render the snow beyond some given distance from the camera. A “Tint” option allows you to specify the color for the far distance snow. Since this algorithm is not physically-based, the snow rendered this way is not influenced by ambient light nor global illumination. It can’t also receive shadows. Additional options are self-describing (pass mouse cursor over the option label to get a short description).
Coverage
This section allows you to customize where and how the snow will be rendered:
Layer Mask: determines which objects can be “painted” with snow. By default, all transparent objects are excluded since snow is rendered before transparent queue.
Zenithal Mask: determines which objects can occlude other beneath them. By default, any object will cancel any snow on other objects beneath them. Make sure to exclude any particle system here both to improve performance and to reduce coverage issues.
Ref Exclusion Layer: this is the number of the layer, used during the rendering of snow, for objects that have been marked specifically to be excluded by snow. Use a layer number that you don’t use in your project.
Exclusion Double Sided: enable this option when excluding double-sided objects from snow.
Default Exclusion Cut Off: cut off threshold applied to excluded objects. Useful if you exclude semi-transparent objects (ie. objects with holes or transparent sections in their textures).
Use Fast Mask Shader: by default, Global Snow uses a fast mask shader to exclude snow from designed objects. However, if the object uses a custom shader with vertex animation, you need to disable this option so the original material is used to perform the exclusion.
Minimum Altitude and Altitude Scatter: specify the starting altitude for the snow. Use Altitude Scatter to make the snow appearance more realistic. Note that above the minimum altitude, the snow will always appear. There’s no “maximum altitude”.
Vegetation Offset: specify a value to be added to the minimum altitude for trees and grass. With this option you can enforce vegetation to be covered by snow on greater altitude than terrain starts showing snow.
Coverage Extension: a value of 1 means an area of 256×256 meters around the camera position. A value of 2 means an area of 512×512 meters. This parameter along with Coverage Quality determines the final resolution of the snow coverage.
Coverage Quality: determines the size of the internal texture used for snow coverage computation. A value of 1 uses a 512×512 texture, a value of 2 uses 1024×1024 texture and a value of 3 uses a 2048×2048 texture.
Smooth Coverage: enabling this option will smooth the coverage producing more pleasant results.
Coverage Mask: you can use a texture as a mask to specify the areas of the world that will be covered by snow. This feature assumes that terrain is centered around 0,0 position. The alpha channel of the texture will be used to determine where can be snow (1=snow, 0=no snow). The world size parameter specifies the mapping size of the texture over the world. For instance, a texture of 2048×2048 pixels with a World Size of 2048×2048 will have a mapping of 1 meter per pixel (the Y-coordinate is ignored).
Appearance
This section allows you to customize the appearance of the snow itself:
Snow Complexity: Flat shading is the fastest and produces a flat and easy looking snow. Relief mapping uses a limited raytracing algorithm to simulate 3D waves over the snow.
Occlusion: adds extra local shadows to the snow. Only available when relief shading is used. This option is useful when the Sun is high in the sky because from the zenith the snow will look very bright and white without occlusion.
Glitter Strength: controls the amount of glittering over the snow. Glitter tends to glow stronger when facing Sun.
Slope Options: customize the borders of the snow-covered areas, useful for adjusting the look of snow covered cliffs and mountains. Note that this feature only works on DX11 and OpenGLCore compatible graphics.
Max Exposure: let you limit the amount of light that the snow will reflect avoiding over exposure when Sun is very high, or its light intensity is greater than 1. Note that this is an artificial change and can produce odd results if abused when compared with the rest of non-covered geometry.
Features
This section allows you to unlock special Global Snow features:
Footprints: footprints are human-shaped footprints decals that are printed over the snow. This feature is interesting to help the player walk over large distance and be able to return over the same path. Although Global Snow only supports adding footprints at the camera position, it could be modified to add custom footprints over other areas.
-
Enable FPS Footprints to add automatically footprints after your FPS character moves.
-
Use Duration parameter to customize the fade out duration of the footprints.
Terrain Marks: this feature allows you to cause small or medium impacts over the snow.
-
Choose the default size in meters for the radius of the mark.
-
The maximum Extents is the size of the internal control texture that’s used to render marks over the terrain – increase to have a greater area of non-repetitive marks.
-
View distance allows you to control the rendering distance of the terrain marks.
-
Enable FPS Marks to leave automatic footprint tracks using terrain marks.
Snowfall: enable this parameter to instantiate the SnowParticleSystem prefab located in Resources/Common/Prefabs. This particles system will emit snowflakes at Intensity rate. You can customize the look and behaviour of the snow particle system modifying the prefab itself. Enable “Use Illumination” to change the particle material to a Standard Shader material which will be affected by Global Illumination.
Snow Dust: similar to Snowfall, this custom particle system simulates the wind effect over snowed terrain. The effect intensity is modulated with the snow dust slider and the vertical offset (altitude vs current camera altitude). Also, the snowfall speed option influences the speed of the dust system. Feel free to customize the prefabs located in Resources/Common/Prefabs folder.
Camera Frost: adds a screen-space frosting effect which can be customize by intensity and screen spread. Useful to add a temperature sense to the player.
Snow Marks on Terrain
Global Snow detects collisions with the terrain and takes care of snow marks. It does by attaching a GlobalSnowCollisionDetector script to your terrain gameobjects. If you have custom terrain objects or create them at runtime or you want snow marks on other kind of surfaces, just add the collision detector script to those objects using AddComponent<GlobalSnowCollisionDetector>().
Once a collision occurs, Global Snow will render the mark on a special texture used during the screen space effect. By default, Global Snow will use the settings specified in the Global Snow inspector:
You can also customize the marks effect per object. Add a GlobalSnowColliderExtraInfo script to your gameobject:
The settings of the Collider extra info script override the default settings from Global Snow inspector:
-
Mark Size: the snow mark size for each impact of this object on the ground.
-
Collision Distance Threshold: minimum distance vs last impact to consider adding a new mark on the ground.
-
Is Footprint: if enabled, only one “stamp” of the mark will be added to the ground. This creates discontinuities on the ground. For example, a creature with feet should have a collider on each foot and the isFootprint enabled so a single footprint is left behind. However, rolling objects, rocks or vehicles should have this property disabled so they leave a continuous trailing mark on the snow.
-
Step Max Distance: the distance at which a new trail starts. For example, if a player jumps or teleports, the trail should not be connected to the new location. This is the maximum distance for which a trail could be connected.
-
Rotation Threshold: useful for wheels. This is the minimum rotation degrees to consider stamping a new mark. Objects leave marks on the snow when they move on the ground or rotate. So, this setting controls the rotation in the same way that Collision Distance Threshold controls the minimum distance travelled to consider a new stamp on the ground.
-
Ignore This Collider: use it to ignore snow marks caused by this collider.
Configuring humanoid characters to leave footprints on snow
By placing a collider on each foot and using the Global Snow Collider Extra Info, a snow mark will be left when each foot touches the ground as explained in this video:
Moving Objects (characters, vehicles, etc.)
Global Snow works with g-buffers and by default it doesn’t differentiate moving objects from static objects. Snow on moving objects can look strange on certain moving objects since snow will show alterations as the object moves. To avoid this issue, you have two options:
Step 1) Exclude snow on the moving object. You can do so by assigning the object or prefab to a exclusion layer in Global Snow coverage section. This way the object won’t receive the normal snow that Global Snow renders over the scene. Another way to exclude gameobjects from Global Snow is adding the Global Snow Ignore Coverage script to the gameobject itself (note that when using the exclusion options, the result might not be accurate in SceneView due to how CommandBuffers work – always verify the result in the GameView).
Step 2) Use a snow custom shader. If you want the moving object to show some snow, use the GlobalSnow/Moving Object Snow/Opaque shader included in the asset. This shader is a Standard shader-based shader that integrates snow features on it. The benefit of this shader is that the rendered snow on top of the moving gameobject doesn’t change its shape when the object or character moves, which produces a more realistic effect.
This shader includes a few appearance options as you can check in the screenshot above, including Snow Tint Color, Coverage (amount of snow), Snow Scale, Scatter, etc. Experiment with the different settings until you get the desired result.
Step 3) If the moving object is a vehicle and you want Global Snow to leave snow tracks after its wheels, add the Global Snow Collider Extra Info to the root of the vehicle gameobject. This script takes care of checking the contact points of wheels and ground and report those hits to Global Snow.
Snow Volumes
Global Snow volumes are special areas where snow can be completely disabled. When the player enters a snow volume, the snow disappears and when he exists the area, the snow script is re-enabled automatically.
To add a Global Snow Volume to your scene, just drag & drop the GlobalSnow Volume prefab from the GlobalSnow/Resources/Prefabs folder.
Position the volume in your scene as you do with a normal object. Change the collider scale to match the desired area size.
Mask Editor
Another way to remove/add snow on custom areas is by using a coverage mask:
A coverage mask is a special texture whose alpha component determines the opacity of the snow at a given location. The texture is overlaid over the world space at “World Center” with extents of “World Size” (so a size of 2000 means a coverage of -2000 to 2000).
You can provide your own texture mask or use the integrated SceneView editor. This mask editor is enabled using the provided section in the inspector:
The Mask Editor allows you to create a new mask texture from scratch. Select a proper resolution according to the detail level you need. For gross results, a texture of 1024×1024 may be enough. If you need finer coverage details use a bigger texture (ie. 2048, 4096 or even 8192 pixels).
The brush mode, width, fuzziness and opacity controls the behaviour of the paint tool. When the Mask Editor is enabled you can remove or add snow into the SceneView directly!
Click “Fill Mask” to reset the mask texture to fully snowed. “Clear Mask” will remove all snow from the covered area.
Please note that if you use Unity standard tree or grass you also need to edit the GlobalSnowForwardOptions.cginc or GlobalSnowDeferredOptions.cginc file (depending on the active camera rendering path) and enable the #define GLOBALSNOW_MASK line.
World Manager API integration
World Manager API is a component developed by Adam Goodrich that enables syncying some atmospheric parameters across different assets.
You can find more information on GitHub: https://github.com/adamgoodrich/WorldManager
To enable World Manager API integration, make sure the corresponding checkbox is checked at the bottom of Global Snow inspector:
(Of course WMAPI asset needs to be present in the project for the integration to work).
The current integration allows snow altitude to change depending on the minimum snow altitude and season parameters of WMAPI. Also the snow fall intensity is synced with WMAPI properties.
Complete Coverage
It’s possible to disable the zenithal coverage computation if your setup requires/allows that. Normally, objects in the scene will occlude snow beneath them (no snow below). This kind of occlusion is implemented by using a second zenithal camera that takes discrete depth shots from above. That information is used in the main snow shader to ensure no snow is rendered below any other object.
Currently you can have the “zenithal depth shots” to occur every frame, at discrete intervals or in manual mode. Discrete intervals means that a new zenithal depth capture will be taken every 50 meters as the player moves across the scene. Manual means that the shot is taken only with a call to UpdateSnowCoverage() method.
If you don’t need the zenithal depth pass, then you can set Coverage Update to Manual and edit GlobalSnowDeferredOptions.cginc or GlobalSnowForwardOptions.cginc file and comment out the line below:
// Comment out to disable zenithal depth
#define USE_ZENITHAL_DEPTH
VertExmotion integration
If you exclude some characters from snow coverage that use VertExmotion asset, you need to enable the integration to avoid artifacts.
-
In deferred rendering path locate and edit the file GlobalSnowDeferredOptions.cginc inside Resources/Workflow_Deferred folder.
-
In forward rendering path the file is named GlobalSnowForwardOptions.cginc inside Resources/Workflow_Forward folder.
Uncomment the following two lines and make sure the path in the include line is correct:
#define ENABLE_VERTEXMOTION_INTEGRATION
#include "Assets/VertExmotion/Shaders/VertExmotion.cginc"
Vehicle Physics Pro integration
Global Snow works out of the box with assets like Vehicle Physics Pro which implements wheel-based collision on the ground to leave snow tracks as covered in the “Moving Objects” section.
Step 1: Ensure your vehicle reports correct ground hits adding “Global Snow Collider Extra Info” script to the root of your vehicle prefab or gameobject. This script is necessary to detect wheel collisions and report them to Global Snow.
Step 2: Since the vehicle is a moving object, you will want to exclude it from Global Snow coverage (add it to a exclusion layer or add the Global Snow Ignore Coverage script to the root of the vehicle). Then, use the Global Snow/Moving Object Snow/Opaque shader to the materials of the vehicle in order to add static snow coverage on top of the vehicle parts.
Transition/Lerping between snow profiles
All global snow properties are animatable but also the asset includes a Global Snow Lerp script which allows you to quickly lerp between two sets of values.
Just create a gameobject and add the “Global Snow Lerp” script to it (you can also add this script to the camera):
The main settings are:
-
Target Global Snow: this will be automatically picked by the script upon start but lets you assign a different object (useful if you instantiate the player camera after scene is loaded).
-
Transition: value from 0 to 1. A value of 0 will use the settings of profile 1 while a value of 1 will use the settings of profile 2. Any value in between will mix the values from profiles 1 and 2 producing a smooth transition of the effect.
-
Left / Right Key: allows you to specify keys which will decrease/increase the transition value when pressing them in playmode.
-
Profile1 and Profile2: settings for global snow.