• Register

Lvx is a an upcoming PC FPS game featuring action, horror and mystery elements. It uses custom engine and targets all major PC platforms: Windows, Linux and Mac OSX. More informations will be available soon.

Post news Report RSS Lighting part 1: Ambient occlusion

With this post I would like to start a mini-series about lighting in Lvx (and about lighting in games in general). Each post will cover a specific topic. The first is about ambient occlusion effects.

Posted by on

With this post I would like to start a mini-series about lighting in Lvx (and about lighting in games in general). Each post will cover a specific topic. The first is about ambient occlusion effects. Before we start, I want to notice that those screenshots do not represent actual Lvx game -- they are test levels, using some external assets (like Portal textures) and their purpose is just to present some technology (and they are actually programmer's art).

Creating realistic 3D graphics is hard, because lighting is a very complex process. On the one hand we have light sources (like Sun, lamp or flashlight) and on the other there are objects we wish to illuminate. Objects receive light and create shadows. But in reality it's not that simple. For example, when you wake up in the morning and you have your blinds half open there is only a small gap that sun can enlighten your room through. But it's not like the room is covered in total darkness like mines of Moria. Quite the opposite -- blinds cast subtle shadow and the whole room is evenly illuminated.

In terms of 3D graphics, light that comes from some source and is stopped by solid objects is called direct lighting. If we had 2 solid boxes, red and white and illuminated it with direct sunlight it could look like this:


As you see, areas where light is blocked by a box are totally black. But the light doesn't work like this. Instead, photons (light particles) bounce off every surface they hit, creating indirect lighting (which is also called global illumination). It could look like this:


However, modern computers are not able to handle such light interactions yet. Or I'd rather say: they can't handle exact calculations needed for this. There are numerous approximations -- and I'll tell about them in some future.

But thanks to GPU computing power we actually can compute ambient occlusion. Ambient occlusion isn't in fact about the light. Quite the opposite -- it tells you how much some surface is blocked. For example flat wall would be not occluded, when flood under your bed would be almost completely occluded (that makes place under bed a perfect ecosystem for monsters). AO term looks like this:


As you can see, it's not perfect. We've lost color bleeding (space between two boxes is no longer reddish) but shadows are quite similar to GI version. And those shadows are very important, because they provide you spatial clues about geometry.

And ambient occlusion can be successfully implemented in game. The first game to use AO was Crysis with its SSAO technique. However, the original implementation had various problems with quality. Then, in 2008 there was invented another effect called HBAO. It's been used recently in Battlefield Bad Company 2. HBAO offers superior quality to any previous AO technique. This blog post is already quite long, so I'll just post images with this effect on and off.

HBAO off:

HBAO on:

HBAO term only:

And finally high-res screenshot with HBAO and a lot of boxes:


HBAO applied to level with no lighting

More technology-related posts coming soon!

If you're interested in our game and technology, don't forget to subscribe to our news feeds:

RSS Indiedb.com YouTube Indiedb.com Facebook
Post comment Comments
theironpaw
theironpaw - - 30 comments

good work this should help new peep's to understanding an AO pass

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: