modern shadowing techniques

Discussion in 'Beginners Zone' started by DavidGraham, Nov 24, 2013.

  1. DavidGraham

    Veteran

    Joined:
    Dec 22, 2009
    Messages:
    3,286
    Likes Received:
    3,543
    So the days of Doom 3 are long gone, how do modern engines handle shadows now ? do they use stencil shadow volumes or just ray trace the hell out of them?
     
  2. sebbbi

    Veteran

    Joined:
    Nov 14, 2007
    Messages:
    2,924
    Likes Received:
    5,293
    Location:
    Helsinki, Finland
    Almost all games nowadays use shadow mapping. Stencil shadows scale badly when thr scene complexity grows. Ray tracing is still too slow for general case (in dynamic game scenarios), but is used for example to add self shadows to small bumps made by per pixel based displacement mapping techniques (height field ray tracing).

    Shadow mapping is an old idea, but it's nowhere near a solved technique. Research is still going on in the all major areas of shadow mapping: texel density / splitting (as close to 1:1 mapping to screen pixels is the goal), projection/warping/distribution, filtering/aliasing (pcf, variance based techniques), transparent/volumetric shadow casters, etc. Lots of new papers get released every year, and graphics engines try to incorporate (and adapt) this new research based on their needs.

    Shadow map is a good technique for modeling a small single point light source. It isn't a good representation for area light sources (it's a depth map from a single point of view after all). So far soft shadowing techniques using shadow mapping have been mostly hacks (goal hasn't even been to achieve physically plausible results). Real time area light shadowing, and global illumination (realistic light bouncing) are both under heavy research nowadays. Offline baking global illumination to light maps and light probes is still the most common way to implement global illumination. A huge server farm precalculates your lighting and you store it to the game disc. The biggest downside is that offline baking techniques produce mostly static lighting. Moving objects for example don't bounce light, and you cannot freely modify the level geometry at runtime. Large scale destruction is not possible, unless you bake several versions of the lighting. This way very limited predetermined destruction can be made possible (but it is often enough for games).
     
  3. DavidGraham

    Veteran

    Joined:
    Dec 22, 2009
    Messages:
    3,286
    Likes Received:
    3,543
    It is my understanding that many developers are uncomfortable with "universal" lighting solutions, they say it takes away flexibility and limits creativity, but it seems pre-baked solutions have limits that might overshadow their flexibility.

    What about the cost of shadow mapping nowadays ? many prime games limits the amount of dynamic shadows as much as possible .. for example the jump from Metro 2033 to Last Light saw shadows from muzzle flashes and explosions stripped away to boost fps .. by how much I wonder? Crysis 1 also had muzzle flashes shadows, but Warhead and Crysis 2 and 3 dropped them like the plague.
     
  4. homerdog

    homerdog donator of the year
    Legend Veteran Subscriber

    Joined:
    Jul 25, 2008
    Messages:
    6,282
    Likes Received:
    1,058
    Location:
    still camping with a mauler
    It does seem like the number of shadow casting lights in modern games is still really low. Are they that expensive on modern hardware?

    Are there any realtime GI solutions out there that don't rely on screen-space information? The only solutions I'm aware of (e.g. Crysis 3) are screen-space effects, which obviously can't be used to fully light the game world.
     
  5. DavidGraham

    Veteran

    Joined:
    Dec 22, 2009
    Messages:
    3,286
    Likes Received:
    3,543
    Metro 2033 is the only game with so many shadow casting lights, it has shadows for player flash light, NPC flash lights , player muzzle flash , NPC muzzle flashes , even explosions ! never seen anything like it.
     
    xz321zx likes this.
  6. homerdog

    homerdog donator of the year
    Legend Veteran Subscriber

    Joined:
    Jul 25, 2008
    Messages:
    6,282
    Likes Received:
    1,058
    Location:
    still camping with a mauler
    It performs well enough as well. Wonder why developers are so shy with shadows.
     
  7. sebbbi

    Veteran

    Joined:
    Nov 14, 2007
    Messages:
    2,924
    Likes Received:
    5,293
    Location:
    Helsinki, Finland
    Shadow mapping costs quite a bit because you need to render the scene geometry to each shadow map in addition to the visible render target. Even in the simplest case (dynamic sun light with shadow mapping and no local lights) shadow mapping doubles the draw call count (and doubles the scene triangle count). Each local light source adds to that cost. The shorter light radius, the smaller increase of draw calls. In our games we don't bake any lights (no light maps or probes), thus we have quite a few dynamic shadow mapped light sources. A rough ballpark figure would be that this kind of dynamic lighting pipeline (shadow map rendering) submits around 2x-3x extra draw calls on top of the visible geometry rendering to back buffer.

    Shadow mapping is definitely heavy for both CPU and GPU. In our last game, it took around 25% of our GPU time and almost half of our rendering engine CPU time (our rendering engine has two dedicated CPU cores on x360). Extra CPU cost comes from both increased draw call count, and by increased viewport culling cost (object lists need to be prepared for each shadow map viewport/cascade).

    In future engines (that do not need to support anything less than DX11 hardware) GPU based compute will make these problems much less painful. GPU will itself determine what objects to render to which shadow map frustum without any CPU intervention. This solves the draw call cost and the culling cost problems elegantly. Also GPU has more knowledge about the scene (as it has for example the scene depth buffer), so it can do tighter culling than CPU resulting in considerably smaller amount of triangles needed to render to shadow maps.

    I expect to see more dynamic shadow casting lights in the future games (as GPU compute gets more and more common since both next gen consoles support it).
     
    xz321zx likes this.
  8. sebbbi

    Veteran

    Joined:
    Nov 14, 2007
    Messages:
    2,924
    Likes Received:
    5,293
    Location:
    Helsinki, Finland
    Crytek has also their LPV (light propagation volumes): http://www.crytek.com/download/Light_Propagation_Volumes.pdf

    It's a completely real time technique, but has quite low resolution. The low resolution causes several problems (for example light bleeding though thin objects) that are hard to solve in a generic case. Also the resolution scaling requires both x^3 increase in memory consumption and processing cost. So it doesn't scale that well to higher quality rendering.

    Another real time technique is SVO (sparse voxel octree) cone tracing. There has been lots of research and papers in this area. Here is a link to Nvidia presentation: http://on-demand.gputechconf.com/gt...one-Tracing-Octree-Real-Time-Illumination.pdf

    This technique scales better, but it is still a little bit too heavy for current top performing GPUs (in real game environments). We still need to wait a few years to have this in high end PC games (and likely for the next console generation to see it in console games). EPIC had plans to use this technique in the next generation Unreal Engine, but they dropped it because it was too heavy (http://www.dsogaming.com/news/epic-games-tim-sweeney-explains-lack-of-svogi-in-unreal-engine-4/).
     
  9. KKRT

    Veteran

    Joined:
    Aug 10, 2009
    Messages:
    1,040
    Likes Received:
    0
    Metro:LL solves it by using only one shadow map per object from what i've seen.

    Dunno why C2 or C3 do not support muzzle flash shadows, because they are quite cheap in SDK, there are several mods for that. Its especially strange, considering that some scenes in C3 and even C2 have like 20 visible shadow casting light sources. Adding two, three more from muzzle flashes shouldnt be as performance intensive.
     
  10. DavidGraham

    Veteran

    Joined:
    Dec 22, 2009
    Messages:
    3,286
    Likes Received:
    3,543
    Phew, that is even greater than I expected ! thanks a lot for the great insight.
    Just wanted to correct myself, Metro LL does have flashlight (player/NPCs) and explosions shadows, even fire from incendiary grenades cast them too. just not muzzle flahes , in that respect MLL jointed the club of Crysis2,3 .. all of them got rid of muzzle flashes for good!

    wish I can get my hands on a mod that enables it back, at least for MLL.
     
  11. homerdog

    homerdog donator of the year
    Legend Veteran Subscriber

    Joined:
    Jul 25, 2008
    Messages:
    6,282
    Likes Received:
    1,058
    Location:
    still camping with a mauler
    Thanks as always for the insight sebbbi :)

    I guess we aren't quite there yet wrt a fully dynamic, realtime lighting system. Though it would be cool to see a tech demo of a complex scene that is 100% lit in realtime, even if it takes 200ms per frame.
     
  12. KKRT

    Veteran

    Joined:
    Aug 10, 2009
    Messages:
    1,040
    Likes Received:
    0
    Nvidia new tech demo looks very promising. GI from every light source.
    http://www.youtube.com/watch?v=n7iE2X6muC4

    Crytek in Ryse are using additional GI Probes, similar to probes cubemaps. Its not fully dynamic unfortunately, but allows them to support their LPV solution with high quality indirect lighting.
    They also showed a little their new global AO solution with cone tracing for sun light in their last presentation, which looks pretty nice.
    Page 35 - http://crytek.com/download/Playing with Real-Time Shadows.pdf
     
  13. homerdog

    homerdog donator of the year
    Legend Veteran Subscriber

    Joined:
    Jul 25, 2008
    Messages:
    6,282
    Likes Received:
    1,058
    Location:
    still camping with a mauler
    I wish we could download that demo and play around with it. Looks very interesting.
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...