View Full Version : Final Gathering Follow-Up

April 2nd, 2005, 02:13
Thought I'd start up a topic following up on some of the issues left open from our meeting on Final Gathering.

Eventually, I hope to put the presentation up on the web, but I need to make some changes, add more pictures in the light paths section,....

I'll back up just a little so others listening in can catch on.

Finalgathering in 3.4 allows diffuse secondary FG rays.

The primary FG rays are the ones shot out in the hemisphere above the FG point. Wherever they hit, the material may spawn a secondary FG ray.

The finalgather trace depth option, specifies how many secondary rays of each type are shot. In 3.4, there are now four arguments:

finalgather trace depth reflect refract diffuse total

-finalgather_depth reflect refract diffuse total

finalgather trace depth 0 0 0 0

is the simplest form of finalgathering. No secondary rays are shot.
At the material where the primary FG ray hits, only direct diffuse and ambient, and whatever doesn't require a ray is collected.

If we add, the ability to do a single reflection wherever that primary FG ray hits a material, we specify:

finalgather trace depth 1 0 0 1

For a single refraction:

finalgather trace depth 0 1 0 1

Now a diffuse reflection counts in two categories, reflection and diffuse, as well as the total. So, for a single diffuse reflection

finalgather trace depth 1 0 1 1

April 2nd, 2005, 02:39
This secondary diffuse reflection is sent out of the indirect illumination part of a material shader such as dgs_material.

A non-diffuse reflection can be sent out in the specular or glossy reflection part of the shader.

April 2nd, 2005, 02:47
Finalgather points are mostly created during pre-processing.

However, some are calculated during the raytracing part of the render, often just called the rendering :D

Now, a question was asked (Jim) if the render-time FG points used pre-processed FG points when calculating the indirect illumination part of the material that the primary FG ray hits.

The answer is no.

Thankfully, because I wouldn't be able to get my head around the recursive possibilities if it were yes. :?

April 2nd, 2005, 05:47
Now there was another question about the FG flags.

These flags contain three selections: on/off cast receive

For an object:
finalgather on/off controls FG 'visibility'
finalgather mode encodes cast and receive enables

For an instance, inheritance is considered, and there's no visibiity control

Ignoring inheritance for the time being...

... if FG is turned off, an FG ray will treat the object as invisible, and go right through it without calling its material shader. (See Maya note.)

Now, assuming we turn FG on, we have an additional mode specification which controls FG casting and receiving. Now lets define our terminology, which depends on your perspective. If you are talking about the casting or receiving of FG rays themselves, it has the opposite meaning of whether the object casts or receives FG illumination. Consider the object-centered perspective similar to how you think about casting or receiving shadows. Its just that FG objects cast illumination rather than shade.

The object-centered perspective is what the mental ray on-line documenation and the Maya documentation use.

From the mental ray doc, a mode value of 1, enables FG casting for the instance or object. This is equivalent of saying that the object will receive an FG ray, meaning it will call the material shader as normal.

Now FG can be on with casting off, meaning it does not receive FG rays. This does not call the shader at the intersection point, and returns black, instead of passing through as it would with FG off.

A mode value of 2 enables FG receiving, which effectively enables the casting of FG rays. This happens in the indirect illumination calculation (the part of the shader that calls either mi_compute_irradiance or mi_compute_avg_radiance).

A mode value of 3 combines both casting and receiving.

A mode value of 1, FG casting only, will not propagate secondary FG rays.

A mode value of 2, FG receiving only, will only shoot primary FG rays. The object can have FG points on it, but otherwise will not participate in FG illumination.

[In Maya 6.5, it appears these flags are available only on the object/shape node, whereas the other similar flags (GI, caustics) go on the instance. So you see the inheritance complexity for GI and caustics, but not for FG. It also appears as if FG on/off is not available, so it must default to on.]

April 2nd, 2005, 05:54
I know, I know. I've got to make some diagrams.

April 3rd, 2005, 08:45
One more thing to add.

When you turn on GI while you have FG on, any secondary diffuse FG rays are not performed and instead the indirect illumination calculation uses the photon map lookup from GI.

This means that the setting of the third argument of FG trace depth becomes 0 whenever you turn on GI.

This is just GI photons, not caustic photons.

You can use seccondary diffuse FG rays with caustics.

This is recommended for scenes where you don't need more than a couple of diffuse bounces. After that, GI becomes more efficient. In other words, after the third argument to FG trace depth becomes greater than 2, try some GI to see if you get desired results faster.

May 13th, 2005, 18:48
And one last little related point.

Even if you have GI turned off for an object, by using the object specific flags, once GI is turned on globally, no secondary diffuse FG rays will be shot for the whole scene.