PDA

View Full Version : mib_amb_occlusion issues with enclosed spaces


jtilden20
11-15-2005, 08:13 AM
So I've been having trouble getting this to work with a simple scene:

Cube: l = 10, w = 10, h = 7
Sphere: r = 1

The normals for the cube are set to point inward.

Classic scenario... everything comes out black, if i hide the walls, I get a map, etc. I've read other's issues and that seemed to be solved by simply adjusting the max distance value on the AO node. Unfortunately, this doesn't seem to be working for me. I've tried lots of incrementing numbers (from 0 up to 10,000,000), as well as lots of small numbers (0 to .0001). Unfortunately, I still get black.

Now, here are my settings:
Normal Direction - Surface Front
Shadows - off
Orthographic Reflections - off
Color Mode - Occlusion
Output Mode - 0
Spread - .5
Distance - (varies)

Any ideas? I'm fresh out (and super tired from crunch to boot...). Thanks and sorry for repeating a something thats been covered in other threads already.

-Jon

victor
11-15-2005, 05:23 PM
Yes, if it's an enclosed space the max distance has to be short enough that it doesn't hit all of the other surfaces.

But if you're getting black with numbers small enough, it's probably something else.

How are you using the AO shader? Where is it plugged into? For example, if you have it plugged into a material's color slot or something, and you don't have any light hitting those surfaces, you'll get black.

There are a few ways to use it, but most common, is to connect it to the ambient slot of a material. Try that.

jtilden20
11-15-2005, 07:10 PM
Yeah I've got it in the ambient slot for my material.
So, you say a lower number should work?
What exactly is the max distance supposedly calculating?
Perhaps its my misunderstanding of the variables that is preventing me from wrapping my head around it. Thanks!

victor
11-15-2005, 08:13 PM
OK.

For every sample (number set by you), a ray is sent into the scene in a random direction (where a spread of 1 allows up to 90 degrees deviation away from the normal). That ray travels as far as the max distance or until it hits another surface. If it does hit something, it returns the dark color (black by default). If it reaches the max distance without hitting anything, it returns the light color (white by default).

Those colors are then averaged to represent the amount of ambient light that would hit the surface (as an estimate of course).

The problem is that if you have a box that is 5 units across, and your max distance is 20 units, all of the rays will hit something and return black. If however, your max distance is 2, most of the rays will expire before hitting something, and only those coming from near the corners will hit the adjacent surfaces.


Of course, there are a few other options which are explained pretty well in the docs, and you should make sure you have ray tracing turned on if you are still having problems. Also, setting max distance to 0 turns on the auto max distance mode, where it guesses for you based on your scene size.

jtilden20
11-15-2005, 09:05 PM
Sweet, I got it... it renders fine. However, my real goal (and why it was never working in the first place) is I'm trying to bake this out to a map (for use in real-time). I can do a mental ray render, see my occlusion, everything is sweet. Then i do a batch bake on that object, and nothing but a black texture. If I remove the walls, everything works fine. Any ideas? Thanks again!

housewarmer
11-15-2005, 10:55 PM
You may need to reverse the normals of the enclosing geometry. I've never tried baking an AO pass, but with a normal pass MR only bakes the side of the surface with the normals facing up.

jtilden20
11-16-2005, 04:54 PM
I've got the normals facing inwards... i'll try facing them outwards (though I thought I tried that before... so many different combinations, its hard to remember everyhing i've done!). Thanks!

jtilden20
11-17-2005, 01:19 AM
Nope that didn't seem to work either. One would figure that if you could render you'd be able to bake it to a map :/

CGTalk Moderation
11-17-2005, 01:19 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.