final gather vs global illumination


#1

I’m using Maya 7 and rendering with Mental Ray. I have a scene with 2 animated characters and a set. I am lighting with an hdri map and a few spotlights to light the set and the characters. I have rendered several tests using FG, GI and both at the same time. The renders all look about the same, although the GI takes 3 times as long to render as FG. Yes, I have photons emiting from my lights.

My biggest questions are:

  1. What is the difference between Final Gather and Global Illumination?
  2. Are there certain settings that are more important than others?
  3. Does the scale of my characters and set effect FG and GI?

thanks for your help


#2

The “final gather” mode in mental ray is essentially irradiance caching. I wrote a rather long post about it here.


#3

For that task, if FG is working fast enough and looks the way you want, by all means use FG by itself.

FG used by itself is more limited that full photon-based GI in that it provides only a single bounce, one step of indirect light. That might be all you need in your case, although for more natural results in architectural lighting, you want light to be able to inter-reflect between surfaces with several bounce steps, as full GI allows.

If you do use photon mapped GI, then turning on FG in combination with it will help smooth out blotchiness by sampling rays through nearby photons.

WIth FG by itself, the most important single setting is the scale (brightness) in render settings, and then the number of rays.

With GI, the most important controls are on the lights, it’s the intensity (brightness) and number of photons (controlling speed, quality) you worry about most, you can leave the radius at 0 for auto sizing.

Scene size affects the intensity you’ll need on photons emitted from point or spot lights. You sometimes need very high intensity settings, many thousands, to compensate for the energy lost over distance (the default exponent of 2 is like quadratic decay for your photons - it’s good to leave that at 2 but you need high intensity because of it.)

-jeremy


#4

Thanks for the clarification. A big help. Another question though.

How do photon maps work? When you say you need a photon map with enough photons in it are you talking about the first stage of the render when the photons are calculated? Or referring to an actual file that contains your photon info that is then referenced during rendering?

I know in Render Settings if you uncheck Rebuild Photon Map and type a name in the Photon Map File a file is created. I have seen some tutorials that say you should use this setting and some say to stay away from it. Which is it?


#5

When jeremybirn said you need a photon map with enough photons, he is talking about the actual calculation of the photons. Of course the more photons the light casts in a scene, the more intense the calculations required.

About saving the photon map, that is used if you want to reuse the same map for your entire animation instead of recalculating a new one for each frame. Mind that you can use this in an animation only if nothing but your camera is moving in the scene (usually used for architectural camera flybys or still frames). If your objects move or your lights change, you need to calculate a photon map for every frame.
And that is where FG comes in. What it does is basically take the photon information and “smooth out” the final look by calculating the scene’s irradiance.

In most of the cases, unless you need a real-world accurate lighting simulation, FG alone should do the trick. Just keep in mind that every Hollywood VFX you see is rendered with a combination of baked FG and Ambiance Occlusion. Almost never actual GI.

Cheers.


#6

Thanks ExP. That makes sense.

How do you bake FG?


#7

There are two ways you can use:

One is by saving a FG map, exactly like you would a Photon Map.

The other is by baking the calculated FG solution into your textures. Just search the manual of your specific app for Texture Baking.

Now, when you do this you need to be a little careful. That means, if you bake everything then you run into the problem of not being able to move your objects or lights. And here is where Ambient Occlusion comes in.
The process goes like this: You bake your FG solution for the objects you know are not going to move (usually your background objects), and then you use Occlusion Shaders for your main objects, like for example your characters.
All this can get tedious and is considered a more advanced workflow.

If you are at the beginning, I would suggest not to bother with baking yet… Just recalculate your FG for every frame.

Cheers.


#8

For what I’m doing I don’t think I need to worry about baking FG. Thanks for the explanation though. It may come in handy in the future.

I’m a little fuzzy on the relationship between FG and occlusion. So far I have been rendering everything on one layer. No render passes. Is ambient occlusion part of the render when render passes are NOT used? Does FG take care of that? Or is the only way to get occlusion by doing a seperate render pass?


#9

francescaluce’s ctrlbuffers shader will let you output multiple passes from a single render.

In theory you can generate ambient occlusion information at the same time as calculating final gathering, but I don’t think mental ray lets you do this.

Ambient occlusion is like final gathering, but without the colour bleeding. Final gathering shoots out a cone of rays and essentially averages the colour of the surfaces it hits at the end of each ray. Ambient occlusion simply assigns each ray a black or white value depending on whether it hit anything or not, then averages those black and white colours.


#10

From my experience FG is very good and faster than GI so you don’t need to use GI.

NOTE FG when used with GI :

The light bounces are LIMITED to just ONE bounce (as the irridiance info is used from the stored GI map)
in order to avoid extra incorrect illumination in the scene.

BUT there are some scenes like when you have a labirynth and juct one light source at the end of it where you would obvioucly need MANY FG bounces to get the light to reach the end of the labyrinth so a combination of gi+FG is better in this case.


#11

In theory you can generate ambient occlusion information at the same time as calculating final gathering, but I don’t think mental ray lets you do this.

Yes you can. There are even different ways you can do this. One is to just use a dummy light like an omni and set it to ambient only. Then simply assign to its light shader input a MR Occlusion Shader. It will overlay its occlusion calculations over your render.

Also you can assign the Occlusion Shader to the “environment” parameter on the material of your object. Or even to your global environment color. You can use the shader pretty much everywhere actually… The only downside over rendering a separate pass is that you have limited control later in compositing.

Ambient occlusion simply assigns each ray a black or white value depending on whether it hit anything or not, then averages those black and white colours.

That is not entirely correct. You can assign any color to your Hit and Miss variables. This way, if you use an Occlusion Map on a per object basis (meaning every object has its own shader occluding the environment parameter), you can assign different colors to simulate the bleeding effect.

NOTE FG when used with GI :

The light bounces are LIMITED to just ONE bounce (as the irridiance info is used from the stored GI map)
in order to avoid extra incorrect illumination in the scene.

Mer, that is a bit confusing… Both FG and Photon Mapping (not to use the confusing term GI, as FG is also a type of GI), can simulate different light bounces. The only difference is real-life accuracy. In fact, Photon Mapping takes into account the physical “luminosity” of each surface it bounces off creating a more realistic effect. FG doesn’t (or at least just “guesses” it).

Cheers.


#12

What I meant was you automatically get occlusion information for free when you do hemispherical irradiance sampling like FG. I don’t think mental ray exposes this.

Well yes, but I was trying to explain the concept of ambient occlusion rather than a particular extension or implementation

What do you mean by the physical luminosity?


#13

Sure it does. It’s called an alpha channel. Any trace call, including the finalgather calls, returns rgb + alpha where alpha IS your occlusion. Kind of the benefit of using a renderer that always takes into account alpha.

For an implementation, see mrClasses, shader gg_ambientocclusion.cpp. Another similar implementation in maya7+ is mental images’ mi_fg_amboccl shader.

In the case of mental ray since maya7, finalgather can also be multi-bounce, so you can also get semi-transparent ambient occlusion, unlike most finalgather implementations.


#14

I think he means the luminosity of the surface. If that is indeed what he means, he’s incorrect. You don’t need photon mapping to take luminosity into account.


#15

I am afraid that you didnt understand…So I ll say it again…In mental ray :

GI/Photon Mapping WHEN USED TOGETHER WITH FinalGathering,

AUTOMATICALY LIMITS the FG bounces to ZERO.

This means you can NOT have MULTIBOUNCED FG and GI/Photon mapping at THE SAME TIME.

You CAN have multibounced Final Gathering when using FG ONLY to render a scene…
… BUT you CANNOT use multibounced FG - AND- GI/Photon mapping at the same time.

Hope this is clear now…

This is done automatically in mental ray to avoid excess extra illumination and ensure physical correctness in a scene , as when using FG AND GI/Photonmapping the irradiance for the FG is used from the GI/Photonmap.
If you used multibounce FG AND GI you would get extra illumination.


#16

DYou could use a thousand FG bounces, and it would still be physically accurate. As long as the FG rays only gather photon map info (and doesn’t shoot off extra rays at regular lights, for example), it’d be accurate. You might have to take a little care with stuff like self-illuminating geometry, I guess, but it is definitely possible to have a physically accurate lighting solution even with multiple final gathering bounces.


#17

“DYou could use a thousand FG bounces, and it would still be physically accurate. As long as the FG rays only gather photon map info (and doesn’t shoot off extra rays at regular lights, for example), it’d be accurate.”

I am not sure I really understood your post.How could one do this in mental ray?You mean to actually use photon maps and Multibounced FG at the same time?From what I know this is not possible.What exactly do you mean by :

…“and doesn’t shoot off extra rays at regular lights, for example”

“You might have to take a little care with stuff like self-illuminating geometry, I guess, but it is definitely possible to have a physically accurate lighting solution even with multiple final gathering bounces.”

You mean with just Multibounced FG no GI/Photonmaps right?


#18

I’m not following. You are talking about Maya, right?


#19

Well, no, you can’t do it in mental ray. But you posted this:

If you used multibounce FG AND GI you would get extra illumination.

And I’m fairly sure that’s incorrect.


#20

Well , no , what I say is 100% correct.

THIS IS actually the very reason why the user is not allowed to use multibounced Final Gathering AND GI/Photonmapping at the same time in the first place!!! … so that you dont get extra excess light in your scene!

So Mental ray automatically limits the FG bounces to ZERO when GI is ‘on’ for very this reason, to maintain physical accuracy and correct luminance in a scene!

If you used Multibounced FG and GI/Photonmaps in mental ray you would get extra incorrect illumination as the second+ bounce of FinalGathering would start to bounce light already correctly(intensity wise) calculated in the GI/Photonmap and ‘multiply’ it after each consequent FG bounce :wink:

Hope this helps