Home Technical Talk

Is it possible to bake Normal Map information into an Ambient Occlusion map?

polycounter lvl 10
Offline / Send Message
Chris Bruin polycounter lvl 10
Hey PolyCount, first post here :)

Is it possible to bake the information of a Normal Map, meaning it's shadows, into an Ambient Occlusion map? There is the option of baking the information of say a high poly object (A ship lets say, the slats on the side of the boat) onto a low poly model to give the little shadow details, but that involves the creation of a high poly model. Since a normal map would already have been made, it would seem like a time saver to just use the information from the maps to give auto-shadows. So yeah, is it possible? Thanks.

Replies

  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Crazybump and xnormal can both do that, but the result is different from a true AO, and is closer to an edge detection look. It is very useful, but not exactly what you seem to ask.
    I think I remember that quite some time ago someone mentioned a technique to gett a good AO result from the information provided by the low mesh + it's associated normal.

    So IIRC it is possible, but In my experience rendering a proper AO bake is not too long anyways.

    Hope this helps!
  • praxedes
    Interesting- can an AO map be created when there isn't an associated high poly model? I'm guessing that the OP has used nvidia filter or crazybump on either artwork or photo texturing to create his normal detail. I've had some success when adding detail to a normal map by creating additional detail in grayscale values, nvidia processing it to add to the normal map and using various levels and blur tools to get something that adds into the AO map, but this probably only works for small additional details such as rivet heads. If there's a way to get a more functional ao from painted extras, I'd be fascinated to know as well!
  • Ark
    Offline / Send Message
    Ark polycounter lvl 11
    Edit: Misread your post, don't know about a normal map storing shadows, maybe having a look at the blue channel of the normal map?

    You can do it the other way around if thats any help;

    You can store AO in a normal map, Crytek's Polybump application can do this, if im not mistaken.

    "Horizon data (5): If you calculated a horizon map, If you calculated a horizon map, you can now choose how to export in some form. If these checkboxes are greyed out, you haven't calculated the map and you need to go back to calculation settings to make one. If you check the accessibility option, polybump will create a _ACC.TIF file containing the black and white horizon map. You can use this map for further texture work, for example as an overlay over your diffuse texture to simulate dirt or ambient occlusion, or you can simply put it in the diffuse texture slot of your final asset to get the typical "skydome lighting" look.
    If you check the unoccluded area direction (_DDNDIFF) option, polybump will create a _DDNDIFF.TIF file containing the normal map with the horizon map baked in. This will have a similar effect as an ordinary normal map combined with an ACC map in the diffuse slot, however it encodes the opening angle of the unoccluded cone and that allows to express some sort of soft shadows of the high poly details. The ambient occlusion will react to light influence more properly and ambient occlusion will disappear where it is directly lit. Simply baking ambient occlusion into the diffuse texture can look like dirt as even lit directly the darkening remains. _DDNDIF requires quite a lot of additional texture memory (_DDN is still required) and it should be carefully considered if this feature is needed.
    If a _DDNDIFF texture is present in the directory of the material and the other textures, and you have specified an ordinary _DDN texture in your material's normal map slot, CryEngine2 will automatically choose the _DDNDIFF texture for the advanced rendering technique, provided the textures have the same prefix (as in: boots_DDN.tif and boots_DDNDIFF.tif)."

    http://wiki.crymod.com/index.php/AssetCreation_PolyBumpReference

    You can get it from the Crysis SDK.
  • Marine
    Offline / Send Message
    Marine polycounter lvl 19
    pior wrote: »
    I think I remember that quite some time ago someone mentioned a technique to gett a good AO result from the information provided by the low mesh + it's associated normal.

    should be possible, ao from xnormal by loading your low poly in to both high and low slots, then create ao overlay from the normal map and multiply it over the ao you generated
  • Whargoul
    Offline / Send Message
    Whargoul polycounter lvl 18
    With Maya and Mental Ray, it's pretty easy to bake an AO map from low-rez model with a normal map. It is sufficient in a pinch but won't hold up to a true bake from a high-rez geo.
  • Eric Chadwick
    Ambient Occlusion Map: EarthQuake's Baking Method details some good ways to create ao for the diffuse map,

    You can also take the AO and bake it back into the normalmap...
    http://wiki.polycount.net/Normal_Map#Renormalizing
    An ambient occlusion pass can be multiplied onto the blue channel of a tangent-space normal map, because it is shortening the normals in the crevices of the surface. However, the shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length.

    Actually that's not totally true, you'll want to not reduce your blue channel lower than 127 gray, otherwise it'll push the normals to point towards the back of the model, instead of just shortening them.
  • Eric Chadwick
    Added this into the wiki, while I'm on hold with the RMV :(

    http://wiki.polycount.net/Normal_Map#AmbientOcclusionIntoANormalMap

    Added some more info too
  • Whargoul
    Offline / Send Message
    Whargoul polycounter lvl 18
    That trick (packing AO into blue) doesn't work with a lot of the best normal map compression formats (DXn, 3Dc, etc_ - because they toss the blue, store R & G at higher precision and reconstruct.
  • Eric Chadwick
    Thanks man, wiki now has clarification on this.
Sign In or Register to comment.