The goal of this tutorial is to set up a lantern object which casts soft dynamic shadows from the solid parts of the lantern.
The two normal ways of creating detailed shadows are to either bake them with static lights (which will not work for a moveable light source), or to use Raytraced Distance Field Soft Shadows, which don’t work very well if the light source is actually inside the model which is supposed to cast the shadow.
Instead of either of those, I will explain how to solve this problem by using a light function.
A light function is a material shader that can filter the intensity of light being output by a light source. It can be used to give the light different intensities at different angles, with the output of the light dependant on the colour of the material, from black (no illumination) to white (full illumination).
We will use this to effectively mask the parts of the light where we don’t want it to shine at full brightness.
Further, we will blend between two different masks depending on the distance, giving a more realistic effect where the shadows are fairly sharp close to the light source, but get softer as the distance increases.
Read the rest of this entry »