Mafia II: Lighting analysis
I’m having a playthrough of Mafia II at the moment – went into it with a bit of hesitation because of the mixed reviews, but turns out it’s pretty okay. It focuses heavily on the story-based content, so just don’t go in expecting a free-roaming adventure, because besides buying clothes and weapons, there isn’t much to do in the city. Which is just fine, because the story is interesting enough, very cinematic.
2K Czeh built their own tech for this, the so-called Illusion Engine. As always, it’s very hard to find more information about the exact technology and algorithms used. The closest I could find after a lot of googling was a quote from a CGTalk article: “We use pre-calculated occlusion maps but apart from that all the lights and shadows are calculated in real-time which enables us to quickly experiment and change the lighting throughout the game.”
Apart from the pre-baked maps everything seems to be in real-time allright, with the amount of lights casting a dynamic object shadow capped to 3 or 4, it’s hard to tell. I suspect the game uses Deferred Rendering (confirmed by WP) to get away with a lot of the other light casting elements in the scene, like in the shot below. The regular techniques to mask the lack of hardware anti-aliasing are used: lots of Depth Of Field-filtering and edge blurring using a Sobel filter, similar to the one I describe in my thesis. The game is running in DirectX 9 mode, which explains the lack of hardware AA. Even without all the fancy normal bump mapping on characters, it just goes to show what a good texture artist can do to make a character look very lifelike – although the detail gets lost when it comes to the suit in the picture on the right.
Here’s a call out to all developers out there: I’m well aware that keeping the exact specs and techniques used in your engine is needed – it’s a commercial asset after all. Nevertheless, it would be nice to have some more general information about how different lighting conditions are handled. All we get now is buzzwords like dynamic and lifelike.