Difference between revisions of "Ambient occlusion map"

From polycount
Jump to: navigation, search
m
(Summary improved, current PBR standards, new section on AO+Diffuse.)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<!-- ## page was renamed from Ambient Occlusion Map -->
 
= Ambient Occlusion Map =
 
 
An Ambient Occlusion (AO) map creates soft shadowing, as if the model was lit without a direct light source, like on a cloudy day. Similar map types: Cavity Map, Crevice Map, [[Curvature map]], Dirt Map.
 
An Ambient Occlusion (AO) map creates soft shadowing, as if the model was lit without a direct light source, like on a cloudy day. Similar map types: Cavity Map, Crevice Map, [[Curvature map]], Dirt Map.
  
Typically the AO map is blended into the diffuse map, instead of being stored as a unique bitmap, because this saves memory. However this generally creates incorrect lighting because an AO map should only mask ambient lighting, not diffuse lighting. If the AO is stored as a 2nd texture, it usually is baked with a 2nd set of UVs that do not overlap or mirror, as diffuse often does.
+
AO is usually [[Texture Baking|baked from geometry]] because it is created using a non-realtime ray-casting lighting solution. It can either be stored in a texture, or it can be [[Ambient occlusion vertex color|stored in the vertex colors]] of the model. [http://en.wikipedia.org/wiki/Screen_Space_Ambient_Occlusion Screen Space Ambient Occlusion] is a realtime AO method that does not require baking at all, but it requires a more recent graphics card and has some shading errors.
  
AO is usually pre-computed (baked) because it is created using a non-realtime ray-casting lighting solution. It can either be stored in a texture, or it can be [[Ambient occlusion vertex color|stored in the vertex colors]] of the model. [http://en.wikipedia.org/wiki/Screen_Space_Ambient_Occlusion Screen Space Ambient Occlusion] is a realtime AO method that does not require baking at all, but it requires a more recent graphics card and has some shading errors.
+
If the AO is stored as a 2nd texture, it can be baked with a 2nd set of UVs that do not overlap or mirror, sometimes called an Atlas layout. Alternatively, sometimes the UVs can be arranged in an atlas layout and the occlusion can use them as-is, while other tiled textures can use the same UVs but be scaled in the material so they repeat or tile; this avoids having to store two UV sets.
  
[http://www.polycount.com/forum/showthread.php?t=78649 Quick question about ambient occlusion maps] on the Polycount forum has discussion about when to include ambient occlusion in the [[Diffuse map]], and when not to.
+
__TOC__
  
 +
= Ambient Occlusion Baked into Diffuse =
  
 +
With [[PBR]] workflow it is best to keep the ambient occlusion as a separate texture from the diffuse or albedo. Since occlusion is grayscale it is often stored in one of the RGB channels of a packed texture.
  
<span id="3MBM"></span><span id="3MBMC"></span><span id="3dsMaxBakingMethodsCompared"></span>
+
The AO map can be blended into the [[PBR|diffuse map]], because this can save memory. However this generally creates incorrect lighting because an AO map should only mask ambient lighting, not direct nor specular lighting.
== 3ds Max Baking Methods ==
+
  
* [http://donott-lcad.blogspot.com/2009/09/mental-ray-ambient-occlusion.html Mental Ray - Ambient Occlusion walkthrough - 3dsMax 2011 and earlier] - by ''[http://www.donaldott.com/ Don 'Ott' Ott]''<<BR>>mental ray AO baking, step by step.
+
[http://polycount.com/discussion/78649 Quick question about ambient occlusion maps] on the Polycount forum has discussion about when to include ambient occlusion in the [[Diffuse map]], and when not to.
* [http://www.laurenscorijn.com/articles/ambient-occlusion-baking Ambient Occlusion Baking] - by ''[http://www.laurenscorijn.com Laurens 'Xoliul' Corijn]''<<BR>>Comparing the positives and negatives of five AO baking methods in 3ds Max.
+
* [http://udn.epicgames.com/Three/CreatingShadeMaps.html Techniques for Creating Shade Maps] - by ''[http://udn.epicgames.com Epic Games]''<<BR>>How Epic uses the mental ray Ambient Occlusion shader in 3ds Max to bake for Unreal Engine 3.
+
  
<span id="FMP"></span><<Anchor([[FloatingMeshProblem]])>>
+
<gallery>
=== Floating Mesh Problem ===
+
Image:ZapAndersson_AmbientDirectOcclusion.jpg | Ambient, Direct, Occlusion. <BR> by [https://mayazest.blogspot.com/2012/01/compositing-ambient-occlusion-ao-from.html Zap Andersson]
When creating the high-poly model for a [[Normal map]], mesh details can be "floated" above the rest of the mesh, instead of cutting them into the rest of the mesh.
+
</gallery>
  
However this can also cause errors in the ambient occlusion, which need to be painted out or removed. There are a couple different methods to solve this:
+
= 3ds Max Baking Methods =
  
# [[#OPM|Object Properties Method]]
+
* [http://donott-lcad.blogspot.com/2009/09/mental-ray-ambient-occlusion.html Mental Ray - Ambient Occlusion walkthrough - 3dsMax 2011 and earlier] - by ''[http://www.donaldott.com/ Don 'Ott' Ott]''- mental ray AO baking, step by step.
# [[#LBM|Light Tracer Method]]
+
* [http://www.laurenscorijn.com/articles/ambient-occlusion-baking Ambient Occlusion Baking] - by ''[http://www.laurenscorijn.com Laurens 'Xoliul' Corijn]'' - Comparing the positives and negatives of five AO baking methods in 3ds Max.
# [[#MRM|mental ray Method]]
+
* [http://udn.epicgames.com/Three/CreatingShadeMaps.html Techniques for Creating Shade Maps] - by ''[http://udn.epicgames.com Epic Games]'' - How Epic uses the mental ray Ambient Occlusion shader in 3ds Max to bake for Unreal Engine 3.
# [[#EQBM|EarthQuake's Baking Method]]  
+
  
<span id="OPM"></span>
+
 
==== Object Properties Method ====
+
== Floating Mesh Problem ==
 +
When creating the high-poly model for a [[Normal map]], mesh details can be "floated" above the rest of the mesh, instead of cutting them into the rest of the mesh.  However this can also cause errors in the ambient occlusion, which need to be painted out or removed. There are a couple different methods to solve this.
 +
 
 +
=== Object Properties Method ===
 
This is the simplest method, as long as your floaters are separate objects.
 
This is the simplest method, as long as your floaters are separate objects.
 
# Select the floater meshes.
 
# Select the floater meshes.
Line 37: Line 36:
 
# In the Adv. Lighting tab, disable Cast Shadows.
 
# In the Adv. Lighting tab, disable Cast Shadows.
  
{| border="1" cellpadding="2" cellspacing="0"
+
<gallery>
|-
+
image:ao_floater-shadows-off.jpg|Disabling "Cast Shadows" in Object Properties. <BR> by [http://www.polycount.com/forum/member.php?u=32411 Frell].
|}
+
</gallery>
 
+
 
[http://www.linkedin.com/in/earthquake Joe 'EarthQuake' Wilson] wrote: ''"In xnormal there is an option to disable backfaces when rendering ao, this fixes the "shadow around the floater" problem by about 95%, you'll still have to manually do a few tweaks, but in generally it saves a LOT of time. I think you can do similar things in max by disabling shadow casting and enabling backface culling on your floater object, by going to the object properties or something."''
 
[http://www.linkedin.com/in/earthquake Joe 'EarthQuake' Wilson] wrote: ''"In xnormal there is an option to disable backfaces when rendering ao, this fixes the "shadow around the floater" problem by about 95%, you'll still have to manually do a few tweaks, but in generally it saves a LOT of time. I think you can do similar things in max by disabling shadow casting and enabling backface culling on your floater object, by going to the object properties or something."''
  
<span id="LTM"></span>
+
=== Light Tracer Method ===
==== Light Tracer Method ====
+
<gallery>
{| border="1" cellpadding="2" cellspacing="0"
+
image:ao_lighttracer_oniram.jpg|Floaters can leave unwanted shadows; Light Tracer filters these out. <BR> by [http://www.digitalmarino.com/ Sean "Oniram" Marino].
|-
+
image:ao_lighttracer_oniram_wire.jpg|Wireframe for the floaters. <BR> by [http://www.digitalmarino.com/ Sean "Oniram" Marino].
|-
+
</gallery>
|-
+
|}
+
 
+
 
When baking AO in 3ds Max with Render To Texture, the Ambient Occlusion (MR) element can leave shadows underneath floaters as well, which is usually unwanted. To avoid this you can use the Scanline renderer along with a Skylight, Light Tracer, and the Complete Map element to filter out those shadows. Supersampling may also be required, if any floaters are creating sharp aliased edges.
 
When baking AO in 3ds Max with Render To Texture, the Ambient Occlusion (MR) element can leave shadows underneath floaters as well, which is usually unwanted. To avoid this you can use the Scanline renderer along with a Skylight, Light Tracer, and the Complete Map element to filter out those shadows. Supersampling may also be required, if any floaters are creating sharp aliased edges.
  
<span id="MRM"></span>
+
=== Mental Ray Method ===
==== mental ray Method ====
+
 
If you use the mental ray renderer to bake AO in 3ds Max / Maya / Softimage, you can manually define the Max_Distance. This is set to 0 by default which means occlusion rays will be cast an infinite distance. If you set it to a value lower than the distance between your floaters and the surface then the problem is fixed. This way you get to keep the Falloff and Spread settings giving you nice cavity shading that the Light Tracer can't do.
 
If you use the mental ray renderer to bake AO in 3ds Max / Maya / Softimage, you can manually define the Max_Distance. This is set to 0 by default which means occlusion rays will be cast an infinite distance. If you set it to a value lower than the distance between your floaters and the surface then the problem is fixed. This way you get to keep the Falloff and Spread settings giving you nice cavity shading that the Light Tracer can't do.
  
Line 61: Line 55:
 
Alternatively, you can disable rendering the back faces on the highpoly/floating objects to prevent them from contributing to occlusion.  
 
Alternatively, you can disable rendering the back faces on the highpoly/floating objects to prevent them from contributing to occlusion.  
  
{| border="1" cellpadding="2" cellspacing="0"
+
<gallery>
|-
+
file:ao-mr-fletcher_mat.png|The Ambient/Reflective Occlusion map in 3ds Max. <BR> by [http://polycount.com/profile/r_fletch_r Robert "r_fletch_r" Fletcher].
|-
+
file:ao-mr-fletcher_maps_thumb.png|The normal map (left) and the AO map. <BR> by [http://polycount.com/profile/r_fletch_r Robert "r_fletch_r" Fletcher].
|-
+
file:ao-mr-fletcher_mesh_thumb.png|The mesh, showing the floater at center. <BR> by [http://polycount.com/profile/r_fletch_r Robert "r_fletch_r" Fletcher].
|-
+
</gallery>
|-
+
|}
+
  
<span id="EQBM"></span><<Anchor([[EarthQuakesBakingMethod]])>>
+
=== EarthQuake's Baking Method ===
=== [[EarthQuake]]'s Baking Method ===
+
 
[http://www.linkedin.com/in/earthquake Joe "EarthQuake" Wilson] explains how he combines low-poly AO with high-poly AO to get better results.
 
[http://www.linkedin.com/in/earthquake Joe "EarthQuake" Wilson] explains how he combines low-poly AO with high-poly AO to get better results.
  
{| border="1" cellpadding="2" cellspacing="0"
+
<gallery>
| [[Image:AmbientOcclusionMap$JoeWilson_AObake_DiffuseAndAO_thumb.jpg]]
+
Image:JoeWilson_AObake_DiffuseAndAO_thumb.jpg | Finished asset with AO. <BR> by [http://www.linkedin.com/in/earthquake Joe "EarthQuake" Wilson]
|-
+
Image:JoeWilson_AObake_DiffuseAndAO.jpg | Without AO. <BR> by [http://www.linkedin.com/in/earthquake Joe "EarthQuake" Wilson]
| Finished asset with AO.[[attachment:JoeWilson_AObake_DiffuseAndAO.jpg|Actual size]]<<BR>><span style="font-size: smaller">image by[http://www.linkedin.com/in/earthquake Joe "EarthQuake" Wilson]</span>
+
</gallery>
|}
+
  
 
# UV your low-res mesh.
 
# UV your low-res mesh.
Line 94: Line 84:
  
 
Images of what goes into my lightmap for a texture:
 
Images of what goes into my lightmap for a texture:
 +
<gallery>
 +
Image:JoeWilson_AObake_1.jpg| 1. AO from exploded high-res mesh. <BR> by [http://www.linkedin.com/in/earthquake Joe "EarthQuake" Wilson]
 +
Image:JoeWilson_AObake_2.jpg| 2. AO from non-exploded low-res mesh. <BR> by [http://www.linkedin.com/in/earthquake Joe "EarthQuake" Wilson]
 +
Image:JoeWilson_AObake_3.jpg| 3. 1 and 2 combined. <BR> by [http://www.linkedin.com/in/earthquake Joe "EarthQuake" Wilson]
 +
Image:JoeWilson_AObake_4.jpg| 4. Gradient baked, detail map overlaid, etc. <BR> by [http://www.linkedin.com/in/earthquake Joe "EarthQuake" Wilson]
 +
Image:JoeWilson_AObake_5.jpg| 5. Final diffuse. <BR> by [http://www.linkedin.com/in/earthquake Joe "EarthQuake" Wilson]
 +
</gallery>
  
{| border="1" cellpadding="2" cellspacing="0"
+
= Blender Baking Methods =
|-
+
* [http://katsbits.com/htm/tutorials/blender_ao_baking_terrain.htm Baking AO maps for terrain using Blender 3D] - by ''[http://katsbits.com KatsBits]'' - Baking ambient occlusion in Blender.
|}
+
* [http://eat3d.com/free/floating_geo Floating Geometry Overview] - by ''[http://polycount.com/profile/metalliandy Andy 'metalliandy' Davies]'' - Video tutorial about creating floaters and baking in Blender.
 
+
{| border="1" cellpadding="2" cellspacing="0"
+
|-
+
|}
+
 
+
{| border="1" cellpadding="2" cellspacing="0"
+
|-
+
|}
+
 
+
{| border="1" cellpadding="2" cellspacing="0"
+
|-
+
|}
+
 
+
{| border="1" cellpadding="2" cellspacing="0"
+
|-
+
|}
+
 
+
<span id="BBM"></span><<Anchor([[BlenderBakingMethods]])>>
+
== Blender Baking Methods ==
+
[http://katsbits.com/htm/tutorials/blender_ao_baking_terrain.htm Baking AO maps for terrain using Blender 3D] - by ''[http://katsbits.com KatsBits]''<<BR>>Baking ambient occlusion in Blender.
+
 
+
[http://eat3d.com/free/floating_geo Floating Geometry Overview] - by ''[http://www.polycount.com/forum/member.php?u=18770 Andy 'metalliandy' Davies]''<<BR>>Video tutorial about creating floaters and baking in Blender.
+
 
+
<span id="MBM"></span>
+
== Maya Baking Methods ==
+
 
+
[http://www.polycount.com/forum/showthread.php?t=84505 Maya ao !! :@] from the Polycount forum.
+
  
[http://www.game-artist.net/forums/vbarticles.php?do=article&articleid=17 Ambient Occlusion in Maya 8] - by ''[http://www.benjaminclark.net Ben Clark]''<<BR>>Baking ambient occlusion in Maya.
+
= Maya Baking Methods =
 +
* [http://polycount.com/discussion/84505 Maya ao !! :@] from the Polycount forum.
 +
* [http://www.game-artist.net/forums/vbarticles.php?do=article&articleid=17 Ambient Occlusion in Maya 8] - by ''[http://www.benjaminclark.net Ben Clark]''- Baking ambient occlusion in Maya.
  
== Xnormal Baking Methods ==
+
= Xnormal Baking Methods =
[http://donaldphan.com/tutorials/xnormal/xnormal_occ.html Ambient Occlusion in XNormal] - by ''[http://donaldphan.com/ Donald Phan]''<<BR>>Baking ambient occlusion in Xnormal.
+
* [http://donaldphan.com/tutorials/xnormal/xnormal_occ.html Ambient Occlusion in XNormal] - by ''[http://donaldphan.com/ Donald Phan]'' - Baking ambient occlusion in Xnormal.
  
<span id="SBM"></span><<Anchor([[SoftimageBakingMethods]])>>
+
= Softimage / XSI Baking Methods =
== Softimage / XSI Baking Methods ==
+
* [http://cryrid.com/art/?p=12 XSI Ambient Occlusion Methods] - by ''[http://cryrid.com/art Michael Taylor]''- Baking ambient occlusion in Softimage.
[http://cryrid.com/art/?p=12 XSI Ambient Occlusion Methods] - by ''[http://cryrid.com/art Michael Taylor]''<<BR>>Baking ambient occlusion in Softimage.
+
  
<span id="VCAO"></span> <span id="VertexColorAO"></span>
+
= Vertex Color Baking Method =
== Vertex Color AO ==
+
* Baking AO to Vertex Color can be an inexpensive way to store typically expensive information. See [[AmbientOcclusionVertexColor]] for more information.
Baking AO to Vertex Color can be an inexpensive way to store typically expensive information. See [[AmbientOcclusionVertexColor]] for more infomration.
+
  
 
----
 
----
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Light map]]
+
[[Category:TextureTypes]] [[Category:Light map]]

Latest revision as of 17:27, 5 September 2023

An Ambient Occlusion (AO) map creates soft shadowing, as if the model was lit without a direct light source, like on a cloudy day. Similar map types: Cavity Map, Crevice Map, Curvature map, Dirt Map.

AO is usually baked from geometry because it is created using a non-realtime ray-casting lighting solution. It can either be stored in a texture, or it can be stored in the vertex colors of the model. Screen Space Ambient Occlusion is a realtime AO method that does not require baking at all, but it requires a more recent graphics card and has some shading errors.

If the AO is stored as a 2nd texture, it can be baked with a 2nd set of UVs that do not overlap or mirror, sometimes called an Atlas layout. Alternatively, sometimes the UVs can be arranged in an atlas layout and the occlusion can use them as-is, while other tiled textures can use the same UVs but be scaled in the material so they repeat or tile; this avoids having to store two UV sets.

Ambient Occlusion Baked into Diffuse

With PBR workflow it is best to keep the ambient occlusion as a separate texture from the diffuse or albedo. Since occlusion is grayscale it is often stored in one of the RGB channels of a packed texture.

The AO map can be blended into the diffuse map, because this can save memory. However this generally creates incorrect lighting because an AO map should only mask ambient lighting, not direct nor specular lighting.

Quick question about ambient occlusion maps on the Polycount forum has discussion about when to include ambient occlusion in the Diffuse map, and when not to.

3ds Max Baking Methods


Floating Mesh Problem

When creating the high-poly model for a Normal map, mesh details can be "floated" above the rest of the mesh, instead of cutting them into the rest of the mesh. However this can also cause errors in the ambient occlusion, which need to be painted out or removed. There are a couple different methods to solve this.

Object Properties Method

This is the simplest method, as long as your floaters are separate objects.

  1. Select the floater meshes.
  2. Right-click and choose Object Properties.
  3. In the General tab, disable Cast Shadows.
  4. In the Adv. Lighting tab, disable Cast Shadows.

Joe 'EarthQuake' Wilson wrote: "In xnormal there is an option to disable backfaces when rendering ao, this fixes the "shadow around the floater" problem by about 95%, you'll still have to manually do a few tweaks, but in generally it saves a LOT of time. I think you can do similar things in max by disabling shadow casting and enabling backface culling on your floater object, by going to the object properties or something."

Light Tracer Method

When baking AO in 3ds Max with Render To Texture, the Ambient Occlusion (MR) element can leave shadows underneath floaters as well, which is usually unwanted. To avoid this you can use the Scanline renderer along with a Skylight, Light Tracer, and the Complete Map element to filter out those shadows. Supersampling may also be required, if any floaters are creating sharp aliased edges.

Mental Ray Method

If you use the mental ray renderer to bake AO in 3ds Max / Maya / Softimage, you can manually define the Max_Distance. This is set to 0 by default which means occlusion rays will be cast an infinite distance. If you set it to a value lower than the distance between your floaters and the surface then the problem is fixed. This way you get to keep the Falloff and Spread settings giving you nice cavity shading that the Light Tracer can't do.

For every pixel rendered a cone of rays is shot from its world space position. These rays won't return hits for faces more than the Max Distance. So faces further than the Max Distance from the pixel will not cause occlusion shading. The end result is corners and contact areas will get shadowed but the floaters wont.

Alternatively, you can disable rendering the back faces on the highpoly/floating objects to prevent them from contributing to occlusion.

EarthQuake's Baking Method

Joe "EarthQuake" Wilson explains how he combines low-poly AO with high-poly AO to get better results.

  1. UV your low-res mesh.
  2. Make a copy of low-res mesh.
  3. Explode both the copied low-res and the high-res.
  4. Save out the original low-res mesh.
  5. Bake the ambient occlusion from the exploded high-res mesh to the exploded low-res mesh.
  6. Load up the original low-res mesh in xNormal's Simple AO Tool and bake at the same resolution as your other textures.
  7. Composite the low-res AO with the high-res AO, edit out the shadows on parts that need to move, etc.

This could also be done with 3ds Max or another program if you don't like the quality of the Simple AO Tool for low-res meshes. I usually blur the map a little and spend a few seconds painting out errors. Also be sure to make a layer mask for parts of your mesh that would need to move, so they don't get ambient occlusion on them.

Theres actually a few extra practical advantages to doing it this way as well:

  1. When using floating geometry, you'll often get AO artifacts that you need to paint out, if your mesh is exploded and you have separate layers for high and low frequency AO its easier and quicker to paint out these errors that it is when you have the small shadows along with the large shadows both in the same texture.
  2. Matching the exact silhouette of the low-poly is actually a more desirable result than that of the high-poly. Example: You have a 32 sided cylinder intersecting with some other shape, if you bake the AO directly from the high-res you'll get a perfectly round shape. If you bake it from the low-res you'll get a shape that actually fits your model instead of just hurting the mesh by point out how jagged your low-res really is (via the contrast from the 12 sided guy casting a perfectly round shadow, not matching up correctly etc.).

Images of what goes into my lightmap for a texture:

Blender Baking Methods

Maya Baking Methods

Xnormal Baking Methods

Softimage / XSI Baking Methods

Vertex Color Baking Method

  • Baking AO to Vertex Color can be an inexpensive way to store typically expensive information. See AmbientOcclusionVertexColor for more information.

Personal tools
Namespaces

Variants
Actions
Navigation
Tools