Swift Shadow System

Miscellaneous Forums/Content Creation Tools/Swift Shadow System

Hi there,
I'm glad folks like my shadow system.

I've been following this thread and I just wanted to comment on what Tom and Rsbrowndog said.

For each static shadow, one entity/surface is created.

Because of this, lightmaps can be faster than static shadows. But it depends on a number of factors.

One is whether or not your lightmaps are applied using a second texture unit, or whether they are on a second surface. If they are applied using a second texture unit, they will be faster than static shadows.

If they are applied using a second surface, whether they are faster or not depends on a variety of things. But either method will be slower than the single surface multiple textures method, because they both involve overdraw.

Now, if you have a second surface for lightmaps, and you cover the entire terrain with the lightmap, then static shadows may be faster if you have trees sparsely populating the map. However, when in those areas where the trees are thick and their shadows overlap you will see a lot of overdraw which will impact the framerate.

Static shadows work best when used for things like sparsely populated trees, and buildings, where the shadows are unlikely to overlap much.

Another way you could do lightmaps though would be to have asecond surface, but only have polygons where shadows actually fall. I don't know if there will be overdraw in those areas that are effectively transparent, but the polygons there may still slow stuff down, even if there is no additional cost incurred from the overdraw. Removing those polygons could well give you better performance than using static shadows on scenes with clumps of dense foliage.

There is a benefit to using static shadows though that you don't get with lightmaps. And that is shadow resolution. You can have fairly detailed shadows with static shadows, whereas you would be limited to blurry shadows if you just streetched one lightmap over the terrain. Of course specialized lightmap solutions can overcome this.

Another thing to take into account is that one could combine their tree clumps into a single mesh, and then create a static shadow for each of those, instead of for the individual trees. This would make the shadows not appear to overlap, and only use one surface per clump. It would still not be as fast as using a second lightmap texture, but it would effectively be as fast as any other method of lightmapping, and possibly faster if the shadows are disabled when distant. Plus again you have the advantage of higher res shadows.