PDA

View Full Version : How to use Ambient Occlusion?


lazzhar
09-19-2003, 10:31 AM
Hi, I used this title eve though it's used in the Maya|Rendering forum, because it's what i want exaclty to ask for.
To learn using the DirtMap Shader for MR4M, I've tryed rendering this scene with just a simple spot lights and point lights:

http://lazzhar.jeeran.com/cuisinediffuse.jpg
Then I replaced all the shaders in my scene by a simple Lambert where i connected DirtMap to its color attribute. Here is the result:

http://lazzhar.jeeran.com/cuisinedirstmap1.jpg
Then in photoshop, brought the 2 passes, and put the last on the first using Multiply :

lazzhar
09-19-2003, 10:40 AM
http://lazzhar.jeeran.com/cuisinemultiply1.jpg

Is this what you do in your work? It seems the result is not so impressive. Any help/suggession?
Then I tryed changing the lighting in the Ambient pass:
http://lazzhar.jeeran.com/cuisinedirstmap2.jpg

bigger version here:
http://lazzhar.jeeran.com/cuisine01dm.jpg

BTW, It take only 15 Min to render on P3 866 mhz

Composite:

lazzhar
09-19-2003, 10:41 AM
http://lazzhar.jeeran.com/cuisinemultiply2.jpg

stew
09-19-2003, 10:59 AM
When rendering in separate passes, don't have any light sources in the ambient pass.

However, I usually render in one pass, using a shader setup like this:

stew
09-19-2003, 11:07 AM
And here's a tutorial on multipass AO:
http://www.shademaster.nl/peter/ao-tutorial.htm

lazzhar
09-19-2003, 11:35 AM
Very nice tutorial :)
This is about Cinema4D, I'd like to hear some feedbacks from Maya/XSI users with DirtMap Please.
Thanks.
-lazhar

klingspor
09-19-2003, 11:59 AM
You're basically doing it right, you just need to tweak the AO shader settings so the result gets more contrast and lighter overall.
Then, in Photoshop, play a little with the blend-settings so the effect becomes more subtle. What I like to do is duplicate the AO-layer, blur it slightly and set the blend mode to "screen" or "lighten" with low opacity, 10% at max... maybe try that to lighten up the image.

Also remember that not every scene lends itself well to an Ambient Occlusion pass...

Ian Jones
09-19-2003, 12:38 PM
I'm only just reading about AO, so bear with me if this question is very basic: Is AO good for realtime-rendering because it calculates ambient lighting from no single light source?

You use a skydome type setup right? This would represent a kind of generic light, especially suitable for integration into a gaming environment where models move around different lighting situations?

klingspor
09-19-2003, 12:45 PM
Originally posted by Ian Jones
I'm only just reading about AO, so bear with me if this question is very basic: Is AO good for realtime-rendering because it calculates ambient lighting from no single light source?

You use a skydome type setup right? This would represent a kind of generic light, especially suitable for integration into a gaming environment where models move around different lighting situations?

I don't believe there's a machine known to man capable of rendering a reasonably complex scene with Ambient Occlusion in real-time. I may be mistaken, but I just don't think we're there yet.

What you can do though is render the AO pass once and then bake it... I hear that's what the large studios do. It works great for static backgrounds and also animated objects that don't interact with others.
I'd assume that if you baked the AO to textures you could use it in a gaming environment, but you'd have to pre-process your original textures with the AO pass. It should work fairly well in most lighting conditions.

lazzhar
09-19-2003, 12:51 PM
I dont think it would be suitable to use this technique in realtime rendering because it's time consuming. Yes it's faster than Global Illumination or Final Gathering, but it take a long time to render. As you could see above, I need more than 15 minutes to render a pass without textures even though i'm not using a fast computer.

stew
09-19-2003, 12:54 PM
If you ask google, there are a couple of pages on real-time rendering using ambient occlusion baked to maps.

klingspor
09-19-2003, 01:09 PM
Originally posted by stew
If you ask google, there are a couple of pages on real-time rendering using ambient occlusion baked to maps.

Note the word "baked"... the real-time rendering does not compute the AO pass for every frame, it's been precomputed for one single frame and then baked to textures. And as such, it's hardly noteworthy because this pre-lighting has been done for quite some time now.

If someone would come up with actual real-time Ambient Occlusion though... but I'd give it a few years ;)

morix777
09-20-2003, 02:00 AM
I've seen a post here about some problem with the Batch-Bake in Mental Ray. For FG-Bake, you must render a few Shots to collect enough Infomation, otherwise the Bake-Texture could be saved incorrect, because the Render generate FG-Info only for the viewpoint every time.

I think the AO-Algorithm ist not very diffrent from FG. I don't know if it also be a Problem with AO-Bake... How did you guys to bake AO? Some Tips?

Ian Jones
09-20-2003, 02:40 AM
arg... sorry. I didnt mean realtime calculation. I was referring to baked solutions and how you setup your render to represent a generic lighting situation, which would be suitable for the changing light condiditions in a game environment. What I want to know is does AO get calculated from a single point light and its bounces? or from a skydome type of setup? (which would make a more generic light source)

Or, does it calculate the lighting based on how much a single point on the surface of a object can 'see', like GI I guess? for example a surface point inside a cavity or crack would have a very small 'field of vision' to the outside world and thus would not recieve as much ambient lighting. This kind of technique would assume a standard level of light and how much of it a surface point could 'see' / receive. Or am I dreaming up an entirely different kind of technique?

:surprised

jeremybirn
09-20-2003, 03:34 AM
Originally posted by Ian Jones
What I want to know is does AO get calculated from a single point light and its bounces? or from a skydome type of setup?

There's different ways. The "Sky Dome" type approach is popular in Mental Ray, where you can just use Final Gathering from an Incandescent sphere around the scene. The other big approach is the "dirt mapping" approach, which basically responds to corners and enclosed spaces by running a bunch of cubes through the scene and seeing where the largest cubes can exist that don't intersect your geometry.

Cheating in a little angle-dependance isn't necessarily a bad thing for baked pre-lighting, though, if it's a generalized assumption such as more lighting coming from above than below.

-jeremy

Ian Jones
09-20-2003, 04:02 AM
ahh I c. Interesting... the dirt mapping approach is similar to what I was suggesting. Maybe not as accurate though. I'm guessing they use a box because it is faster to calculate than a sphere? (more accurate)

As you said a generalized lighting is not neccesarily a bad thing... considering more light from above is the most common.

Sorry to hijack the thread... :)

stew
09-20-2003, 04:12 AM
Originally posted by jeremybirn
The other big approach is the "dirt mapping" approach, which basically responds to corners and enclosed spaces by running a bunch of cubes through the scene and seeing where the largest cubes can exist that don't intersect your geometry.
Are there implementations using such a cube-based algorithm or are you simply using it to illustrate what the algorithm does? I have seen implementations with ray tracing or shadow maps, this is the first time I hear about cubes and it sounds inefficient to me. If I understand that correctly, the cube thing would be running a prepass with an adaptive marching cube? Or should I stop posting at 4:15 am?

wurp
09-20-2003, 11:11 PM
you can not call the pass itself an ambient occlusion pass, before you comped it, its simply called an occlusion pass. Ambient occlusion is when you use the occlusion pass to weight the diffuse and ambient pass together.

CGTalk Moderation
01-16-2006, 05:09 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.