Reposted from my blog at www.mindflock.com/

My game Damzel is a game set in a city. The city itself is alive with AI-based  people. But I wanted the city to have a nice aesthetic to it too.  Luckily, there’s a good example in Mirrors Edge. I knew it was built  with the Unreal engine, so I decided to see if there was any way to fly  around it and see how they build the levels in it.

And there is!

So I thought it might be useful to fly around  and describe some of the tricks they used in creating such a beautiful  vista, whilst keeping the game running smoothly.

Here we go!!



Interesting!  first, the lightmaps still look pretty nice at this level. Flying  around the level you notice that many of the buildings are actually  poking through the ground rather than set on it. It doesn’t matter to ME  because its set on the tops of the buildings, but it does look a tad  weird.



Next up are the ambient objects. In this case pedestrians and  cars. There is a central “highway” in this level, which has cars that  run occasionally down the road. Pedestrians also walk occasionally up  and down the paths. One thing to notice, is that pedestrians and cars  run along prescribed paths. They literally follow straight lines, which  while not realistic, makes moving them a lot easier. The pedestrians  themselves are very low poly, because they only contribute a few pixels  to the screen most of the time (viewed from the rooftops). An  interesting aside is the police car flashing light, which is just a  billboarded (facing flat to the camera) flashing sprite texture.

Fly out a bit further and we start to see things getting interesting  render-wise. Most noticable, is that geometry starts getting culled.  The back faces of buildings for instance start getting left out. As do  the paths and roads that arent in view. I’d hazard a guess here and say  it was done by hand, but it would be reasonably easy to do a PVS  (potentially visibile set) calculation and simply pre-process the level  to remove any non visible polygons (test each polygon for views of the  play area bounding box as a first pass I would say).

 

Above is a view of a building in the middle ground. Notice that  the building itself uses black and white textures? This is because the  distance fogging (see next shot) tends to push the colour of buildings  towards a pale blue as distance to them increases, so it has the effect  of looking like atmospheric scattering. I’m actually thinking of using a  rayleigh/mie scattering term, but maybe just pushing all colours  towards light blue based on distance from camera is enough.

Here’s a shot of the fog volume, its more noticable when you reach  the edge of the volume because you can see the contast between pixels in  the volume and those outside of it.



The interesting thing about  ME leveles is that they tend to have quite contrasting levels of detail  at different parts of the level. The inner “ring” meshes are all  reasonably high detail at the rooftop level near the play area. Then we  have medium detail meshes for the city blocks inside the inner area but  outside the play area. Then we have a sort of “no mans land” which  doesnt even draw the skybox (you can see that here, where it doesnt draw  the skybox/dome and you see overdraw of the inner mesh details). That  is then ringed by a lower poly outer mesh set, which entails a set of  randomly placed buildings and some low poly landscape heightfield  meshes.



Here’s a shot of the landscape and outer meshes, where you can still  see the inner mesh set. Notice the large gap between them? I think thats  likely there to give a sense of parallax with the outer blocks. Whats  interesting is that those outer buildings are literally just boxes with  simple textures on. Nothing particularly fancy about that, although  there is a single landmark building that has a low res environment map  on it (a sort of blue environment map).


And finally, on the outer edges, we have a set of billboard  “skyline” quads with an alpha edged texture of a bunch of buildings in  it. Those are laid out at the edges of the low res mesh area to make  sure you never see a flat edge from any viewpoint while youre running  around the rooftops. They are distant enough and fogged enough that you  hardly notice them, but they do break up the skyline quite nicely.



So it appears that the key to rendering a nice city scene from the  mirrors edge point of view, is the inner core meshes having reasonably  high poly buildings with nice global illumination based lightmaps, many  of them using a single environment map as reflection over a base texture  in the windows. Followed by a lower resolution set of outter buildings  for parallax. Ringed by an further set of flat quads to break up the  skyline, alongside a few heightfields to suggest mountains on one side  and reflected water near the other for added interest.

Damzel is going to use some of these ideas, mainly the LOD “rings”  and the global illumination lighting on the inner ring. I’m not sure the  billboards will be needed, but it will be tried anyway. The pedestrians  and ambient objects like cars will be far more important than ME, so  most of the polygon budget will go towards them rather than the  buildings. So in contrast to ME, most of the buildings will be quite  low-ish in polygons, but hopefully some useful texturing and environment  mapping will help there.

Hope this tour of Mirrors Edge environments has proved interesting,  it certainly was for me looking around the world. I highly recommend  buying the PC version and having a fly around it. Its a masterwork of  level design if nothing else.

.Z.