Demonstrating how new Shadowmask feature works in Unity
C# GLSL
Switch branches/tags
Nothing to show
Clone or download
Kemal Akay Kemal Akay
Kemal Akay and Kemal Akay Update image 01
Latest commit 36c44ef Mar 20, 2017
Permalink
Failed to load latest commit information.
ExampleProject
Images
LICENSE
README.md

README.md

Shadowmask Tutorial

Demonstrating how new Shadowmask feature works in Unity

Light Modes Tutorial: Shadowmask

This project includes the tutorial files for Shadowmask tutorial. In Unity 5.6, new light modes are introduced for blending baked and realtime shadows. This modes include Baked Indirect, Distance Shadowmask, Shadowmask and Subtractive. This tutorial goes through the details of authoring a scene for switching between Distance Shadowmask and Shadowmask modes.

In Unity 2017.1, Shadowmask option is moved to Quality Settings so users can change the mode at runtime. This tutorial explains how to change the mode through API as well as setting up light probes, reflection probes, lighting parameters, lighting settings and light types. These concepts can be applied to a realistic use case and this is essentially what the tutorial covers by using baked shadowmasks for in-door (while retaining shadowmaps of playable character) and shadowmaps for outdoor (including the static objects).

The project includes two scenes. The first one provides the basic version of the scene without any lighting setup. Scene (assets, props, particles, animated character) is prepared and the tutorial explains step by step how to author the lighting and post-processing. Second scene shows the completed version of the tutorial.

The tutorial only goes through Shadowmask mode. Baked Indirect and Subtractive modes are not covered in this tutorial.

Tutorial can be found here

What is Shadowmask?

In Shadowmask mode, static objects receive shadows from other static objects via the precomputed Shadowmask texture, regardless of the shadow distance. In Distance Shadowmask mode, both dynamic and static objects are using realtime shadows within the shadow distance. That is the reason why drawcall amount is higher in Distance Shadowmask. Beyond the shadow distance, static objects receive high quality shadows from other static objects via the precomputed Shadowmask.

Unlike subtractive mode, shadowmask feature allows users to blend between baked and realtime shadows with all mixed light types (directional, point and spotlight). In old versions of Unity, this was the main constraint. It was only possible to use one mixed directional light to avoid double shadowing and overbrightness.

Credits

  • Keijiro Takahashi for sIBL HDR cubemap, camera and movement scripts
  • ThreeDScans for 3D sculpture of Plato
  • R&D Content Team at Unity for Standard Assets and Labs Scene