Our Properties: Gamasutra GameCareerGuide IndieGames Indie Royale GDC IGF Game Developer Magazine GAO
My Message close
Latest News
spacer View All spacer
 
February 10, 2012
 
Road to the IGF: Lucky Frame's Pugs Luv Beats
 
Analyst questions validity of unusual January NPD results [12]
 
Blizzard opposes Valve Dota name registration [2]
spacer
Latest Features
spacer View All spacer
 
February 10, 2012
 
arrow Virtual Goods - An Excerpt from Social Game Design: Monetization Methods and Mechanics
 
arrow Principles of an Indie Game Bottom Feeder [21]
 
arrow Postmortem: CyberConnect 2's Solatorobo: Red the Hunter [1]
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
February 10, 2012
 
CCP - North America
Animation Director
 
Toys for Bob / Activision
Senior Programmer
 
Toys for Bob / Activision
Lead Programmer
 
Vicarious Visions / Activision
FX Artist-Vicarious Visions
 
Vicarious Visions / Activision
Tools Engineer-Vicarious Visions
 
Treyarch / Activision
Lighting Artist, Cinematic
spacer
Blogs

  Two-Part Shadow Maps
by David Rosen on 03/17/10 05:56:00 pm   Expert Blogs
2 comments Share on Twitter Share on Facebook RSS
 
 
  Posted 03/17/10 05:56:00 pm
 

The shadow maps we use in Overgrowth are unusual in that they contain two parts: direct shadows and ambient occlusion. These correspond to the two light sources in outdoor scenes, the sun and the sky. To explain how this works, let's consider this scene with a house in the desert: 

The first part of the shadow map consists of direct shadows. We calculate them by dividing the scene into a grid and accumulating high-precision depth map shadows. This is done on the graphics card in order to achieve a much higher calculation speed. Here are the direct shadows for this scene: 


There are some texture alignment artifacts here, but they're subtle when lit, so I'm saving them for later

The second part of the shadow map is ambient occlusion -- how much total light is received from the sky. This is calculated by accumulating the direct shadows from 64 points on the sky hemisphere. Here is the ambient occlusion for this scene: 


See this post for more complex examples of ambient occlusion.

We could store both of these shadow maps separately, but for efficiency we can combine them into one shadow map. The graphics card stores images with three color channels (red, green and blue), so we can store the direct shadows in the red channel and the ambient occlusion in the green channel. Below you can see the direct shadows, the ambient occlusion, and the combined two-part shadow map.

To apply shadowed lighting, we just modulate the direct lighting by the direct shadows, and the ambient lighting by the ambient occlusion. We then add the modulated direct and ambient lighting to get the total lighting for each pixel. Below you can see the modulated direct lighting, modulated ambient lighting, and combined total lighting. 

Now all we need to do is combine the lighting with the color map, and we have our finished image! Here is the total lighting, the color map, and the final image.

We recently discussed why ambient occlusion is important for characters (in this post), and it's important for environments for the same reasons -- it helps define the space and adds depth to shadowed areas. Below we have a comparison shot without ambient occlusion on the left and with ambient occlusion on the right. Look under the awning and the wooden walkway to see how it helps define enclosed spaces. 

Many games approximate direct and indirect lighting using cascading shadow maps, screen-space depth comparisons, and deferred light accumulation. These techniques are powerful and fun to use, but their rendering artifacts and hardware requirements make them inappopriate for Overgrowth. For us, the efficiency and accuracy of baked shadow maps make them a better choice.

 

Follow us on the Wolfire Blog!


Facebook iconModDB iconSteam iconTwitter iconYouTube icon

 
 
Comments

Caulder Bradford
profile image
Very cool David. Question about the direct shadow pass. Is it entirely post-process using the depth-buffer or is there still some projective texturing going on with the game objects during rendering?

Chris Howe
profile image
"We calculate them by dividing the scene into a grid and accumulating high-precision depth map shadows. This is done on the graphics card in order to achieve a much higher calculation speed."

It sounds like they are using baked shadow-maps, but using the GPU to calculation them, rather than raycasting on the CPU.


none
 
Comment:
 




 
UBM Techweb
Game Network
Game Developers Conference | GDC Europe | GDC Online | GDC China | Gamasutra | Game Developer Magazine | Game Advertising Online
Game Career Guide | Independent Games Festival | Indie Royale | IndieGames

Other UBM TechWeb Networks
Business Technology | Business Technology Events | Telecommunications & Communications Providers

Privacy Policy | Terms of Service | Contact Us | Copyright © UBM TechWeb, All Rights Reserved.