View Full Version : yet another Mental Ray question

05 May 2003, 02:24 AM

Can someone please explain a little about GI Accuracy as well as Photon Volume Accuracy. What exactly does it do? Obviously it has something to do with making the GI/Photons more accurate, but how much is to much..500??? 1000???

Also is the GI/Photon radius caculated from 0,0,0 on the grid?

Lastly the min and max values for FG. Again how much is too much, is there a general area that is safe. It's tough to figure it out manually because of the time it takes to render..

Can anyone help?:surprised

05 May 2003, 02:49 AM
maybe someone has the time to explain this for you in depth - meanwhile i can recommend reading the following chapters in the mental ray reference manual - the manual is very precise but can be hard to grasp at first Caustics Global Illumination (includes documentation of the final gathering settings)

and the mental ray tutorial videos from AW could help you too

05 May 2003, 06:40 AM
Yeah stunndman I think my question might have been a little too much. I guess im just frustrated at trying to find the "golden setting" for my scene.

The tutorials at AW say:
" first, you adjust GI radius size until it no longer affects the scene, then adjust GI accuracy until that no longer affects the scene, then finally adjust # photons until that no longer affects the scene. "

It's just that I've done that and the quality isnt what I know it can be. I'm assuming that what I was originaly asking about was the main area I should be focusing on. Maybe its not.

My image has a certain 'grainyness' to it.

05 May 2003, 07:16 AM
i see - i attach a file which i have compiled over the past few months from posts on the mental ray mailing list and other places - all related to gi and fg settings - maybe you can gather some useful information from it

and maybe you can post an image showing your problems


Not sure about the Photon Director, but mental ray has a radius setting
for photons and a min/max radius for final gather points. For photons,
the radius determines how far away from the illuminated point a photon
may be in order to be considered. Larger values make the illumination
smoother, but also less sharp.

For final gathering, the min radius (second number after the number of
rays, optional) is similar to the photon radius; mental ray will use all
the previous final gather points within this radius. The max radius (first
number after the number of rays) specifies that if there are no final
gather points closer than this distance, a new final gather point is taken,
which can be quite expensive. Normally it's sufficient to change the max
radius; smaller values increase precision but reduce performance because
more final gather points are forced.

If you switch to mental ray 3.x at some point in the future, you will have
to change the final gather radii because version 3.x is much better at
placing final gather points, and generally produces much cleaner results
with fewer final gather samples. Speedups of a factor of five have been
seen at sites that use final gathering heavily.


One of the tests, on ~6.7 million triangles from fore- to midground, took 4
hours on a dual 1ghz P3. Settings for FG were 200/1/0.1 (accuracy/max/min),
sampling was 0/2, threshold was (0.1/0.1/0.1), filter was Mitchell 4/4.
Obviously way too long, and the results were good but not perfect. No
tiling, but a bit of splotchiness. I need to increase accuracy, right? Can
I take some liberties with the radius settings if I have a higher accuracy?

My understanding of the settings (this is mostly drawn from experience) goes
like this:
-higher accuracy will kill grain/splotches
-lower min radius will increase the accuracy of the proximity/contact
-higher max radius will ensure no tiling


> -higher accuracy will kill grain/splotches

Higher accuracy means more rays, which can resolve contrasts and details
in the environment better. If you have much detail but low accuracy, you
will see splotches.

> -lower min radius will increase the accuracy of the proximity/contact
> shadows
> -higher max radius will ensure no tiling

Yes, in mental ray 2.1. The higher max radius averages more fg points to
even out boundary problems. The basic problem is that mental ray 2.1 can't
look into neighboring tiles, and it doesn't know yet that one pixel further
it will be forced to put another fg point. That other fg point, or the one
on the other side of the task boundary, might deviate considerably from
the current local average, which results in visible edges if the indirect
illumination changes rapidly.

I am afraid a solution to this problem is available only with mental ray
3.x, which incidentally is also several times faster when computing final
gathering. The solution is rather involved and dependent on mental ray 3's
new architecture, and couldn't be back-ported to mental ray 2.1. (We often
back-port improvements if possible.)

> Lastly, is switching to a grid approximation with a higher relative grid
> size better for speed? Or should I tweak my bsp settings?

The BSP algorithm typically beats the grid algorithm in terms of speed and
performance. Also, the grid can't handle motion blur. It's mostly useful
to CAD people with nicely bounded machine parts and the like.

When tuning BSP parameters, it helps turning on verbosity (-vernose on, I
am not sure about the GUI), and watching the BSP statistics. If the leaf
size average is very large, or the tree depth average is very large, that
means that mental ray "bottoms out" too often, and the respective numbers
should be increased. It's difficult to generalize though; if triangles are
large, which is especially the case with fast motion blur, low tree depths
often significantly improve performance and memory use. If we knew a robust
heuristic for this we would put it into the code as defaults, but often
only experimenting (increase/decrease tree depth in steps of 6, or doubling
the leaf size) helps. Sometimes you can get things an order of magnitude


> 1. How are the samples really calculated?

Final gathering points are computed on the illuminated surface, not at
lights. FG rays aren't expected to hit the light sources (they could,
for visible lights, but not for infinitely small point lights), which
is why you can't do caustics with them. Basically the renderer looks in
all directions from the illuminated point and collects incoming light.

Since that's very expensive it's done rarely, if there is no nearby FG
point sampled earlier. The total number of rays is defined by how many
FG points you have multiplied by the number of rays per FG point. Both
these factors are defined by the FG accuracy: the radii control how far
another point may be away to be used instead of computing another FG
point. A larger radius means fewer FG points.

Photon accuracy radius settings work the same way: everything within the
radius gets used. However, if there is nothing within the given radius,
no new photons can be created in the same way as new FG points can be
created. (That's a basic property of photon mapping - you can't control
where the photons will end up when you shoot one.) So, if a FG radius is
too small, you have too many rays and you lose performance; if a photon
radius is too small your samples might fall into the gaps between photons
and you get splotches.


> 'INFO : "RCFG 0.1 warn 542002: angle between normal and geometry normal
> more than 90 degrees"

Normally you can ignore that. It means that your geometry is incorrect.
Vertex normals can deviate from the surface normal to smooth out
shading across a faceted plane. But if vertex normals are bent so much
that they are bent backwards, pointing to the wrong side of the surface,
you get this warning because mental ray keeps track of which side of
a surface receives illumination.

Softimage does occasionally produce such degenerate geometry. Another
example is the "cone problem", where the normal at the tip of the cone
points along the cone axis, which is why you get these odd highlights
near the tip.


Quick tips:

If the image looks like a starfield, increase the radii'
If the image looks soft, your radii are too large.
If the image looks grainy, increase photon count.
If the image looks jagged, increase accuracy.
If the image looks good but takes forever to render, decrease photon count and/or accuracy until image no longer acceptable.

05 May 2003, 07:28 AM
oh, and about "how much is much"

5000 or 10000 is basically nothing - don't be afraid of high numbers (millions in certain cases) - that all depends on scene complexity of course and i don't know any general rule

if you use gi and fg in combination things change a little and you can reduce the number of photons and accuracy

don't care about the FG min radius at first - in my experience it has no big influence on the quality

another thing i have learned recently is quite a time saver for tweaking

as long as you only tweak the GI accuracy and radius settings you don't need to rebuild your photon map - just set up your scene - set a name for the photon map - render your scene (to build up the photon map) - turn off photon map rebuild - and then tweak

i'm not sure right now if this applies as well to FG - it's worth a try

05 May 2003, 06:49 PM
WOW Great Information stunndman!

Your post is an incredible source of information for understanding functions. I feel like I have much better direction. I too gathered info from various forums but what you've posted sounds the most informative and technical.


CGTalk Moderation
01 January 2006, 02:00 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.