Download

shadow maps (issues) and dynamic shadows / day-night-cycle

Hey there,

I was wondering about day-night-cycles and shadow maps and dynamic shadows.
Lighting needs to be rebuilt, creating shadow maps which are static, right? If I implement a day-night-cycle, shadows can’t be static, so I have to use dynamic shadows on everything. Does the lighting still needs to be rebuilt (which will create shadow maps again)?
Becaus doing so causes some weird visuals, just like spilling black paint all over the map. Before rebuilding the lighting, shadows are properly casted and I want to keep that.

Thanks in advance!

Just disable all static lighting if you are going to use dynamic time of day.

Set every single one of your lights to movable, then each individual light will using cascading shadow maps (or distance field soft shadowing, if you set up directional or point lights to use it) to provide dynamic lighting. Just note that dynamic lighting only provides direct illumination (shadows will be pitch black, where with baked lighting GI is thrown into the build so bounced light brightens shadows up a bit, though you can use a skylight to brighten up the shadows uniformly, or use Light Propagation Volumes or Distance Field Global Illumination to give your scene some GI and brighten shadows up a bit with regards to the scene, I’ll explain below), dynamic lighting is heavy in terms of performance (and multiple dynamic lights overlapping causes huge performance problems, so at the union of two point lights is where performance will really tank), and dynamic lighting is dependent on the distance from either the light for point or spotlights, or the shadow for directional lights.

Skylights, LPV and DFGI provide indirect illumination, basically they mimic the act of light bouncing off of surfaces in order to add some more depth to your lighting environment. Skylighting is the quickest of the three, but it only provides uniform indirect illumination. Rather than actually computing bounces of light, it just adds a uniform ambient light value to lighting calculations, meaning everywhere, even indoors, shadows are brighter irregardless of whether or not they should be brighter. You can set the skylight to movable, and the skylight will use Distance Field Ambient Occlusion to provide rough shadowing, which does help with the uniform lighting, but the problem is still prevalent. Light Propagation Volumes are a relatively cheap (in relation to every other dynamic method) global illumination / indirect illumination technique implemented by Lionhead Studios. LPV uses a low resolution grid of voxels / cubes to store the lighting information, and because of this the big downside is how badly light leaks between sides of thin geometry. If you have a wall that sits in the middle of a voxel, both sides of the wall are illuminated. You can combat this using the LPV settings under the post-process volume actor, specifically LPV bias, but I’ve found you really have to push the bias up a bit to stop light from leaking, but that causes issues as light cannot easily bounce, so the effect isn’t as pronounced, and leaking is still an issue, even at high bias values. LPV is a cheap solution and IMO the only real dynamic solution in currently, though it should only be used for outdoors scenes and you shouldn’t rely on it entirely for depth to lighting: light leaking, slow update times, single-bounce, only directional (and supposedly spot) lights, lackluster lighting from emissive materials, and more plague LPV. But for everything that makes LPV a poor quality and unpredictable technique, Distance Field GI seems to be promising. DFGI borrows from DFAO for a distance-field representation from the scene that can be ray-traced through (and hence currently requires a movable skylight to work), and is a little heavy on performance, and suffers from some artifacting, but it’s providing some pretty good quality GI without the cost of other similar caliber techniques like SVOGI or VXGI, without the problem that LPV has of light leaking.