Today I was looking at a still frame of a game, and noticed that all of the shadows were dynamic (created per frame). As we know, shadows can be quite expensive. I was wondering why shadows could not be simply mapped at run time for non moving objects, and then only do dynamic shadows for players, vehicles, etc. What are the advantages/disadvantages of doing this?
\$\begingroup\$
\$\endgroup\$
12
-
\$\begingroup\$ Quake 2 does this; Carmack indicated that there are really no disadvantages - just really good looking shadows that are fast. \$\endgroup\$– Jonathan DickinsonCommented Dec 22, 2011 at 9:28
-
1\$\begingroup\$ You can't have dynamic light sources if you bake the shadows from terrain/scenery can you? \$\endgroup\$– ClassicThunderCommented Dec 22, 2011 at 9:42
-
1\$\begingroup\$ What if you have notmoving house and static light source. And you bake out house shadow to texture of the ground. What would happen if you move with your player to the shadow of house? Player won't be "shadowed" - am I right? \$\endgroup\$– zacharmarzCommented Dec 22, 2011 at 9:46
-
2\$\begingroup\$ Differences in quality and visual appearance between dynamic and static shadows is the main one I can think of; this kind of visual discontinuity can be quite jarring once you start noticing it. \$\endgroup\$– Maximus MinimusCommented Dec 22, 2011 at 10:48
-
1\$\begingroup\$ @zacharmarz that's what I meant by 'good enough'; not good enough for a AAA title; but maybe acceptable for an indie one. Either way you can trim down the number of dynamic lights with precalc (especially in angular/indoor/futuristic environments). \$\endgroup\$– Jonathan DickinsonCommented Dec 22, 2011 at 14:10
|
Show 7 more comments
1 Answer
\$\begingroup\$
\$\endgroup\$
Disadvantages:
- Lightmaps are very large textures. If you have enough processing to make all shadows dynamic you can probably use the memory for something else.
- Non unified lighting model. Some lighting models like deferred don't mix well with prebaked shadows.
- Light mappers are usually very slow. You need to wait few hours to preview lighting changes in the scene.
- You can't pre-bake lights in case that light sources are moving even if everything else the scene is static.
Advantages:
- You can have much higher quality shadows and lighting.
- Faster processing
- Virtually unlimited number of light sources can be used