Using Ambient Occluion to light a scene is not a problem in Blender. This will create uniform light with good contrast between lit and shadowed areas. But it is treated as global lightning solution. Also to use it as a shader might be hard in some cases. So using ambient occlusion as a material feature might be a solution. One of uses of AO is “dirt shader”. Althought possible with masking and material nodes, this doesnt work in all cases (e.g. masking and object behind transparent object) and the composite node setup might become very confusing for more materials with this. With render baking in Blender it is possible to bake the AO pass to texture and then use this as a stencil for the dirt map. but with animated meshes this would require baking new texture for each frame. But the main disadvantage of AO is that we cannot determine, which object occluded the given material.
So I propose 3 layer Ambient Occlusion that is property of material (just like SSS is). AO as a material feature might help cut down render times, as not all faces will be avaluated by the AO algoritm.
Self: would compute AO only with mesh that has assignes this material and is in the same object. Instanced meshes might be a problem.
Other Material: only object with other specified material would be evaluated. Only material matter, so linked meshes are treated equally.
World: almost as it is now, every object in scene will be taken into account, except self and objects with other material specified above.
Separate Passes. It should be possible to render AO pass as one, with the options described above. For texturing or single object shading it might be possible to render any of these passes separately for texturing.
Separate intensity values for Add and Sub. Those will work only for World, for the other two it is sufficent only dist param, not to clutter the interface. As it is now, it is possible to get negative rgb values in render. Including AO in material nodes, adding new channel to “Map To” tab that will act as a stencil texture to enable easily combine dirt textures. Replace the falloff parameter with a curve.
Baking: this three differnt AO maps combined together will be the same as it is now. As the are three AO maps, that might be baked into rgb values and these further used to mask the actual dirt textures (if rendered in separate AO passes).
Problems: Rendering time might increase upto 3x in case of rendering the all three AO passes separately. Determining an object in instanced group close to the same group (this is the case of “self pass”).
I will post UI mockup later and explain my thoughts, if you like this idea.
If you want AO computed for animated objects, you have to compute the AO for the object and anything they interact with or get near to, for each frame, essentially turning it on for everything in the scene, which is back to http://wiki.blender.org/index.php/Manual/Ambient_Occlusion
Are you looking for some way to mix AO on a selective object basis? If so, index the object and enable AO pass and use the object mask to get the AO for that Object for that Frame.
Papa: I now how AO works and how to enable it, I’m talking about some enhacements how to choose objects to be included for the computation. The algorithm itself is good, but alwazs uses all meshes.
The masking isn’t working, if an object is behind a transparent one. I’ve tried it and it didn’t work.
No it’s not, that’s just what AO is and how it works. It uses distances between geometry (hence the ‘Occlusion’), it doesn’t take the materials into account at all.
@broken (trying to expand my little smurf brain here): AO, in real life, if I put a cube of glass on my desk, the glass does not occlude any ambient light, because light passes through it, so my desk AO mask does not change (assuming perfect glass here). correct? So, i do kinda think that AO needs to take into account how much light the geometry in fact occludes, and transparent materials allow more rays to trans through them, and thus don’t occlude them. come back? I think I know how it works in the code now, and it’s broken (no pun intended), so I think we’re talking about what is broken about it and how to make it better/faster/more accurate at lower resolutions/more controllable etc.
There is no such thing as AO in real life, AO is a specific not-physically-accurate (but generally nice looking) rendering trick. It basically samples a hemisphere around each point on the face, sees what proportion of that hemisphere is occluded by other geometry, and shades the pixel accordingly. It’s got nothing to do with light at all, it’s purely a rendering trick that tends to look nice because generally in real life surfaces that are close together (like small cracks) will be darker than surfaces that don’t have anything in front of them, because of shadows, dirt, etc. The AO process though is approximating this result, it’s not simulating light bouncing around or going through things. That’s why AO still works when you don’t have any lights in the scene, and it’s why just switching on AO alone is a very bad way of ‘lighting’ a scene.
The way it works in the code right now isn’t broken, it’s working entirely as its intended to. What you are looking for is some kind of global illumination, which is a whole new kettle of fish, and something that’s not really in Blender’s renderer at all (yeah, yeah, radiosity, whatever…)
sorry for the double post, but i need to point out that the darkness you see in your home walls near the corners is because the paint is cut in with a brush and lays flatter than the rest of the wall which was rollered or sprayed, and the joint is smooth plaster not wallboard paper. And actually, where the corner turns toward you you see a bright stripe because the wall at that point is facing you, which is almost never modeled, which directly conflicts with this AO thing.
So yea I see where AO is a cheap trick that is cute but not accurate. bad AO, bad AO.
Just wanted to say thanks to broken for the excellent description of AO. Any chance to add that to the wiki? There are technical details, yes, but none of them helped me as much as his explanation to really get the concept behing that technique.