I've been hearing a lot about ambient occlusion lately and I kinda understand what it is and how to make an AO map, but I don't know how to use it.
I understand the idea of adding the AO map to the diffuse map in order to make the diffuse map look prettier, but I've also seen meshes having a separate AO map and that's the part I don't get.
How do game engines use these AO maps? Can you use them for animated models and dynamic props or only for static objects? What engines support AO maps?
Any help is appreciated
Replies
Generally I just use AO maps as multiply layers over the diffuse and specular maps, but they can also be good when used as masks for other layers (to make dirt appear in cracks etc).
There's also a shader by Ben Cloward that makes use of AO maps: http://www.bencloward.com/shaders_globalIllum.shtml
I'm wondering if there are any game engines that use AO maps and how they do it.
check out this crysis video: http://www.gametrailers.com/gamepage.php?fs=1&id=2509
and also the features of the C4 engine: http://www.terathon.com/c4engine/features.php
does anybody know how that stuff works?
// I just noticed that the crysis video doesn't open. Just look for the "GDC 2006 Trailer" at Gametrailers.com
I recall hearing a while back (although this may not be how they're doing it), that their ambient occluded lighting for environments is all precalculated (basically just lightmaps) and several frames of shadow information is saved in lightmap form if the indoor lights need to move. So I'd imagine they won't be using it much, since it sounds like a fairly expensive solution.
However, I might be wrong about that (I googled for more info on it, but couldn't find out any more ), if someone else has a better idea or a solid link to an article explaining the process, that'd be cool.
As for the Mapcore link you posted, I'm not sure why that guy had a separate AO map - he says he had to individually unwrap the whole mesh for a unique texture, so in that case, why didn't he just use the AO map as a layer multiplied over his diffuse/specular maps, it would have the same effect. Unless there is some kind of calculation used at render time which changes how the AO map is used (ie. it fades out when lit directly or something).
Sorry to just add more questions to this thread, but I'm interested too, and would like to read any articles on how or why AO maps are being implemented in realtime.
There's also an executable somewhere on the nvidia site (cant find it right now) that shows off realtime VERTEX AO.
The paper talks about the use of them in shadowmap form as being for lighting modulation.
The paper is talking about GPU generated maps of course, and they would need to be If you wanted them to be dynamic. Which negates any need to user generate them. Therefore I can only assume that what you were driving at is correct Paul: There is little use for user created AO maps other than to bake into your colour maps.
*edit* the pdf format is the devil itself. They always seem to completely lock up my machine.
As I said earlier too, even if you're baking many frames of lightmaps to get a fake "moving radiosity/AO" solution, that still doesn't really answer any questions about how AO maps are used in games.
I think Daz is onto it though, GPU-generated AO maps sounds like what we should be discussing, since that doesn't involve manually baking a lightmap from your 3d modelling app or level editor. Thanks for the link Daz.
I just baked an AO map for the first time and noticed that every polygon that is facing away from the "sun" is darkened. Does that mean, that AO maps (added to the diffuse map) are useless for dynamic objects like physics props?
Another issue I got is that the AO map I baked had an awful lot of missing rays (red spots) while the normal map that I rendered in the same process had none. How is that possible?
I'm gonna use this thread for another AO question:
I just baked an AO map for the first time and noticed that every polygon that is facing away from the "sun" is darkened. Does that mean, that AO maps (added to the diffuse map) are useless for dynamic objects like physics props?
Another issue I got is that the AO map I baked had an awful lot of missing rays (red spots) while the normal map that I rendered in the same process had none. How is that possible?
[/ QUOTE ]
Having some ambient shadows is never a bad thing, if you're talking about actual directional lighting then yeah, you dont really want any of that in your ambocc map. But ambient shadows help to add a lot of depth to your normals mapped objects.
Also dont be afraid to tweak the ambient maps in photoshop either, adding some color can sometimes help a lot, especially on characters. Just like you wouldnt shade some materials to black with old school texturing you shouldnt multiply a grey ambient map on top of them.
[ QUOTE ]
I'm gonna use this thread for another AO question:
I just baked an AO map for the first time and noticed that every polygon that is facing away from the "sun" is darkened. Does that mean, that AO maps (added to the diffuse map) are useless for dynamic objects like physics props?
Another issue I got is that the AO map I baked had an awful lot of missing rays (red spots) while the normal map that I rendered in the same process had none. How is that possible?
[/ QUOTE ]
Having some ambient shadows is never a bad thing, if you're talking about actual directional lighting then yeah, you dont really want any of that in your ambocc map. But ambient shadows help to add a lot of depth to your normals mapped objects.
Also dont be afraid to tweak the ambient maps in photoshop either, adding some color can sometimes help a lot, especially on characters. Just like you wouldnt shade some materials to black with old school texturing you shouldnt multiply a grey ambient map on top of them.
[/ QUOTE ]
The problem is that these polygons facing away from the sun get really dark and it would rather look awkward ingame if the objects gets turned upside down due physical interaction.
Is there any way to render AO maps with light coming from all sides, even from below?
Also some screenshots would probablly be useful.
By the way I've just seen that baking a normalmap in mentalray gives me the same odd missed rays (red spots). Does it have something to do with this: http://boards.polycount.net/showflat.php?Cat=0&Number=117131&an=0&page=0#Post117131 ?
/edit: I just tried the skylight+raytracer approach and it worked very well. is there any disadvantage of this method over the mentalray AO?
the technique where multiple lightmaps are generated and then packed to a new representation (such has spherical harmonics or spherical radial basis vectors), is called relighting. That new representation costs much less memory but can still regenerate lighting conditions for all possible light directions (spherical), though at cost of precision of course. Those "lightmaps" which are packed, are user generated. You must generate lots of lightmaps to represent different incoming light directions, lots of raw rendering power needed.
Real-Time, basically similar as above but simplified. Some precomputation finds out how the object interacts with itself. Lighting of multiple lights (or sky) is turned into a series of vectors/matrices which are evaluated on vertex/pixel level combined with the precomputed values. To generate good vectors you would do some lighting on CPU on special points around the object. There you can also take shadows into account. Or render a lowres cubemap from the object's place to get incident light of enviro.
Another factor is neighbor interaction, so that other objects influence the light of shadow receivers.
I a just scrimmed over some tech docs myself, so I probably overlooked some issue for the latter It is very costly effect, hence I am not sure if it makes much use yet. I am more of a fan of oldschool precomputation and fast run-time evaluation, like the first two offer.
edit:
removed the image, as it was misleading
Jayrabbit: No downsides that I know of to using the skylight + advanced lighting. It's how I bake all my AO maps.
P.S - hey mop , for some reason my AO now decided to come only one color, i set everything as i did before it gets fooked up , but now only renders one colour ( grey )
mixin the AO map isnt very expensive, the only costs come from a texel lookup, some lerping and one more texture in memory. which of course might be an issue with so many textures already in use...
IMO The best use of ambient maps is to actually add subtle occluded shadows that you would even see when lit to your texture, of course tweaking the colors so they are more natural. What you're doing there looks more like you're using the ambient occlusion map to give you ambient lighting, which seems sort of backwards to me.
Really the best use i see of ambient maps as a seperate texture is for tiling enviro stuff that you cant bake into the diffuse, and i know for things like that you definately do what to have that little bit of ambient shadow when its lit or else it will just look really flat and fake.
In that sample I purely use the AO, which is wrong as all color and texture is lost in ambient, which wouldnt be the "right" thing, as you mentioned. Purely using the diffuse alone, however didnt look that good either, I guess one could mix the AO in more cleverly for the ambient side combined with original diffuse. I didnt invest a lot of time into it, as we dont have normalmapping and alike for our stuff. But I do think that having a separate AO gives you more tweakables to play around with, which might result into giving stuff more shape.
Making use of it in "large-scale" as for every model and so on, is probably not feasable.
Per's colormap already made use of the AO, as you suggested. It probably would be sufficient to simply desaturate the ambient side, to achieve a similar look (with more color left and texture).
edit:
just experimented with simply desaturating the ambient side a bit, and it basically is better than the simple model before. I removed the image, as it was misleading about the actual useage of AO.
Really the best use i see of ambient maps as a seperate texture is for tiling enviro stuff that you cant bake into the diffuse, and i know for things like that you definately do what to have that little bit of ambient shadow when its lit or else it will just look really flat and fake.
[/ QUOTE ]
I find that for environment stuff, you don't even need an AO map, you can just make really small gradient textures (radial and linear) and use them as decals in places where it will be most noticeable. Looks very effective, and means you don't have to bake tons of textures on different UV channels to make everything unique.
Also do you have any examples of this that you can show?
In the tests I've been doing, I've been using it similarly. We are using SH to represent our ambient lights, and I scale that against AO. I then bias the AO towards white (to lessen it's affect greatly) and scale the rest of the real lights (points, spots, directionals) against that (both the diffuse and specular contribution).
[ QUOTE ]
Is there any way to render AO maps with light coming from all sides, even from below?
[/ QUOTE ]
Well, technically a default AO map should 'light from all sides'. Which reminds me, this might seem obvious to most, but for baking AO maps for character work, I usually put in a ground plane in the scene, thus making the lighting somewhat more directional from above, which is probably more like what you'd want for most situations:
Ambient occlusion is just a measure, from zero to one, of how much the near-by area lets light in to a point (where zero is no light and one is full light). It's a poor representation of higher frequency direct lighting, and should only be used to impact the ambient light typically, and for dramatic effect, impact the diffuse (and possibly specular) channels slightly (40-60% works well).
If your ground plane is actually a 'light source', i.e. bounce, then putting an occluding ground plane in doesn't make sense. Once your model gets lit, you'll see the top being brighter than the bottom anyway.
I find people use ambient occlusion too much to replace good direct lighting, everything starts to look dingy. Ground bounce is really well represented by imaged based (or harmonic) lighitng.
Good to see people talking about it.
Throwing a ground plane in makes sense if the ground is part of the 'occluding' geometry.
Ambient occlusion is just a measure, from zero to one, of how much the near-by area lets light in to a point (where zero is no light and one is full light). It's a poor representation of higher frequency direct lighting, and should only be used to impact the ambient light typically, and for dramatic effect, impact the diffuse (and possibly specular) channels slightly (40-60% works well).
If your ground plane is actually a 'light source', i.e. bounce, then putting an occluding ground plane in doesn't make sense. Once your model gets lit, you'll see the top being brighter than the bottom anyway.
I find people use ambient occlusion too much to replace good direct lighting, everything starts to look dingy. Ground bounce is really well represented by imaged based (or harmonic) lighitng.
Good to see people talking about it.
[/ QUOTE ]
I rarely get too bogged down with the math behind stuff. I just go with my gut about the best look for what I want to achieve. If we are talking about a baked AO map for a characters face, generally I throw in a ground plane to block any rays from below. Which creates a more impactful and less blown out to white AO map generated from rays coming from every which way.