Flicker-free Final Gather in dynamic animations


Hello everyone, this is my first thread. I created a blog post about a method I came up with after some experimentation for achieving a flicker-free Final Gather result for dynamic animations, that is, in animations in which there are characters and other moving objects.

              It doesn't require any scripting, external tools, or anything advanced. It utilizes the mip_render_subset shader, so you'll need newer versions of Maya (I think 2008 and newer) to give this method a try.
              Feel free to discuss the post here on CGTalk, as it is seen by the whole community easier in this central location, rather than on the blog. Test it, critique it, etc.
              Here's the link to the post:[http://asephei.blogspot.com/2011/03/maya-flicker-free-final-gather-in.html](http://asephei.blogspot.com/2011/03/maya-flicker-free-final-gather-in.html)
           The blog post is somewhat lengthy, but in this thread's first reply by RagingBull, you'll see a quick step-by-step outline of how this method is done! For more details, check out the blog post.

Once the mip_fgshooter is implemented into Maya with an intuitive interface, the particular workflow presented in this post won’t be necessary anymore, for most situations.

        [b]THREAD NOTES:[/b] On page 2 of this thread, "Bitter" (David) posted a python script written by Brenton Rayner that uses mip_fgshooter, which provides a much more efficient and significantly easier way to achieve flicker-free FG in Maya. Check it out here: [fgshooter UI for Maya](http://elementalray.wordpress.com/2012/01/04/fgshooter-ui-for-maya/)


Hey Gary, well done for posting it, I know it’s something that everyone probably does in slightly different ways but I thought it was well worth posting here as I think it’s a good compromise (not even a compromise really).

Just to give some seasoned people a quick run down:

I’ve edited it down to these quick reference steps:

1: Hide moving objects, compute a Final Gather Map for objects that don’t move.

2: Freeze the FG map, then unhide all moving objects, batch render the scene normally.
(now you have a beauty render with frozen FG on all static objects)

3: On a new render layer or saved scene, set FG as a layer override to Rebuild ‘ON’, with a new FG map override. This new map will be for moving objects, set it to high quality, and it’ll be rebuilt each frame (never frozen).

4: Attach the mip_render_subset node as a lens shader (to speed up rendering of second pass).

If you already have a lens shader applied (such as mia_exposure_photographic), then simply choose the Create button under the Lens Shaders section of the camera shape node attributes.
Note that only the first mip_render_subset node will render, as these are unstackable.

It is designed to ONLY render the defined objects AND/OR objects with the chosen material (you can also just define a material and no objects).
This node wants you to define at least one object, by typing in the name of a shape node of a geometry object OR a material’s shading group node. Note this is NOT the material but the shading group.

5: Output the “indirect_result” of the mia_material_x to a surface shader, associate with mip_render_subset, essentially creating a fast indirect pass for moving objects.

The shaders being used in this second pass, in order to isolate and only render the indirect element (instead of everything else too), you’ll need to connect the indirect_result attribute of the mia_material_x (or _passses, whichever you’re using) to a new Surface Shader’s outColor attribute.

Now assign the Surface Shader to the geometry, the one incoming mia_material was assigned to.

6: Batch render the scene and you’ll see the FG is computed for the entire scene but once it finishes, only the objects/materials listed in the mip_render_subset render, AND only their indirect illumination renders, meaning a really fast render compared to computing texture filtering, blurry reflections, and such.
This is faster and more efficient than re-rendering the object with all of it’s shading qualities, those of which were already computed in the first pass.

7: Use your compositing application to composite (add/plus) the results onto the original first pass.

I’ve started testing with this workflow already, and it does bring some slight differences compared to a straight rendered FG pass but the massive advantage is that for animation there isn’t any flicker.
And I think just utilising some basic passes we can get some control in post, tweak as required.



Thank you very much!
Very useful!


Has anyone else given this a go yet ?
I’ve done very basic testing, similar to what Gary had set up. Obviously it works well, although I only use the render layers for additional animated objects that use the mip_render_subset node. I save a separate file for background and moving objects, I seem to mess things up otherwise :blush:
So I’m going to try out some other things that use hair, opacity maps, refractions etc etc
In fact, if anyone knows of a useful test scene, or perhaps some things which I could try, to basically pin point a weakness. Purely so we know where the limitations are.


Cool information. Thanks guys. I’m gonna look into this later tonight! =)


Hi guys! This looks like it can solve the flickering issue once and for all! But I have a problem…I’m just a student with Maya experience of around 1 year plus now. Never actually went in depth into the rendering process of an animation!

I was able to follow along quite well in creating the fg_map and freezing it etc. But when it comes to the mip_render_subset part, I’m completely lost! Can anyone give me a detailed step by step explanation on this? Maybe with some screenshots if you guys are okay with it? It will really really help me a lot! Please anyone?


Here’s a basic demo (without audio) of mip_render_subset I quickly put together: http://youtu.be/ef-kWaQj9Zg

For a tutorial of mip_render_subset, check out Ash Aiad’s video here:

Also, on page 28-29 of the mental images production (mip) shader library manual:

Hopefully these links will help you. If you have any other questions feel free to ask!


This workflow is just calling to have a script made to simplify the setup. If I did not have my hands full already, I would tackle it.


Here’s a basic demo (without audio) of mip_render_subset I quickly put together: http://youtu.be/ef-kWaQj9Zg

For a tutorial of mip_render_subset, check out Ash Aiad’s video here:

Also, on page 28-29 of the mental images production (mip) shader library manual:

Hopefully these links will help you. If you have any other questions feel free to ask!

Thank you for putting together those materials for me! It really helped me in better understanding the mip_render_subset on how to use it and its usage. I’ve seen through the videos and I’ve got a couple of questions:

First: The mip_subset_render was used to isolate the moving object from the static background so that it is not affected by the fg_map. And then rendering it normally with ‘rebuild:on’. Does that mean that for a moving object, rendering normally does not cause flicker and it only happens when the camera moves around a static scene?

Second: Based on my above theory, if its correct. If I create two render layers, one for the static background that has no animation using an fg_map, and the other just for the animtated model with ‘rebuild:on’ with its fg values set to fairly high (eg: acc: 500, pt density: 1, pt interpolation: 80) should produce a flicker-free render. Then bringing those two renders into a compositing software (eg: after effects) to combine them together will actually produce the whole scene being flicker-free. Am I right?

If I’m wrong please do let me know. I’m just trying to piece everything up together so that I can understand better and hopefully get the right concept. I apologise if my questions are silly and stupid =(

This workflow is just calling to have a script made to simplify the setup. If I did not have my hands full already, I would tackle it.

You really should! It will safe us a lot of time on research and understanding how some crazy stuffs in maya works! (eg: production lib shaders) :faints:


Thanks a lot for putting together those materials for me! I’ve definitely learnt how to use and the usage of the mip_render_subset from your videos! :bows: But I’ve still got a couple of questions…

First: Since the mip_render_subset was used to isolate the moving object from the static background so that it was not affected by the fg_map and for it to be rendered with ‘rebuild: on’. Will it be possible to render the static background, with the fg_map applied to, out first and then on another render layer, render out the animated model with ‘rebuild: on’. Then bringing both renders into a composition software to put them together?

Second: If my above theory is right, does that mean an fg_map is only works for a scene where nothing moves except for the camera and if something moves, a normal render with ‘rebuild: on’ with a fairly high fg values (eg: acc: 500, pt density: 1, pt interpolation: 80) should produce a flicker-free render?

Sorry if my questions sound silly but I’m just trying to piece everything together so that hopefully I’ll get the right concept. Maya is still so new and scary to me! :shivers:

P.S. I’ve posted this reply a couple of days back but I wonder why it can’t be seen. So I’m posting this again.


mip_fgshooter. . . .



mip_fgshooter isn’t implemented into Maya in an intuitive way (as of version 2012), so this particular workflow utilizes mip_render_subset, in order to cheat since the scene must be rendered twice. On this thead, a script was put together for using mip_fgshooter, and I’d guess there are other people out there who’ve done similar if not better scripts for mip_fgshooter.

           [b]To your first question:[/b] Yes, you can easily use render layers to render the background/static scene, and then the moving/animated/dynamic objects on a separate render layer, using render layer overrides for the necessary settings. Not a problem, it can all be kept in the same scene. The main idea behind all this is that on the layer with all the static objects, you'll want to render with a frozen FG map, but your moving objects will have FG disabled for them.
         Basically you're doing a full render but making sure that anything that would normally flicker from FG simply has its FG turned off (on that first layer). Remember that objects that move slightly (such as a plant leaf moving in a breeze) will usually be fine and won't flicker so long as your FG settings are very much "smoothed" out (using that interpolation setting). On static scenes, you can get away with really low FG settings so flickering on objects that barely move will not occur.
         Now for the second layer, and what makes this method interesting, is that you're only rendering the moving objects but only their indirect lighting (FG in this case), which is where the mip_render_subset and the surface shader comes in. In general, the only increases in render time are for the initial translation before rendering and the additional FG that must be calculated for each entire frame (with the "Full Screen Fg" setting turned on in the mip_render_subset, which is the default).
         Essentially, despite the fact that you're rendering the scene twice, you might only be increasing the render time by something around 50 percent, but it really all depends on the complexity of your scene and how high the FG settings are for that second layer, and yes the FG map must be rebuilt for every frame for moving objects, and also the point density must be high enough to cover the details in the scene, and can be helped out by a bit of interpolation. You can bring your render time down on the second render layer by disabling the FG (on the shape node) Receive and Cast on objects (using layer overrides) you know wouldn't affect the indirect light on your moving objects much.
         Finally, both renders can simply be added on top of each other in the composite, but keep in mind that in order for this to be accurate (as in, 1+1=2), you'll need to render out the final images in a linear color mapping. I won't explain here what "linear workflow" is but if you want to know more about it, search on the internet: linear workflow maya. There's a good series of videos by Zeth Willie on [linear workflow for maya and mental ray](http://vimeo.com/8119194), and [Master Zap](http://mentalraytips.blogspot.com/) has the definitive lecture on the topic in class 1 of his fxphd series, "[Production Rendering Techniques with Mental Ray](http://www.fxphd.com/courses#MRY201)".
         As a beginner you don't have to do linear workflow but you really should since it is essential in modern 3D computer graphics to apply gamma compensation and color management in the rendering process especially for realistic renders. If you do not use linear workflow for your file textures and final renders, simply adding the two images together in the composite will not be technically correct, it will appear somewhat washed out and too bright.
           [b]To your second question:[/b] Yes, a FG map is used for storing the FG samples/points so they don't have to be computed again, and it's perfect for a static scene or with a static scene with slightly moving objects (such as leaves on a tree). There are no settings I can give to you for a truly flicker-free FG setup with moving objects, since each scene is different.
         What I will say is that if your scene is well-lit and doesn't have an extreme contrast range, then FG will have a much easier time and with relatively good settings, flickering will not occur. Technically, when using rebuild mode, flickering will always occur, but the goal is to reduce it down where you can't notice it from frame to frame; it's possible once you know what the main FG settings do and in general, how FG works. Eventually, with practice, it shouldn't be too difficult to get a, relatively speaking, flicker-free result.


Very interesting thread. I am be interested in learning more about the mip_fgshooter workflow. I read the thread with the script, but from what I understood, it’s only for moving camera, not animated objects, right? Also does it bake it into a file?


We’re going to try and help simplify this workflow a bit in the near future.

But since it’s the holidays it might be a little bit.

In reality there is not a perfect solution to this since determinism changes on different frames it will calculate differently.

What the fgshooter does is provide the fg phase with more data to acquire points for sampling. The actual process won’t be very different than how you render currently.


Aside for brute force at the sub-pixel level (which is included in Maya 2011, using the “No FG Caching” option for FG, but it’s very expensive computationally to reduce much of the sub-pixel noise, as expected), there is no perfect solution to the flickering problem. Since you can’t use two rebuild modes for FG in the same rendering session for specific objects, the scene must be rendered twice, and this method lets you cheat as much as I possibly know how to in cutting the time it takes for the second render.

Whenever you have the time for it, that would be excellent!


Wow! That was heavy! Took sometime for me to digest it (5times of reading over and over again)! :smiley: Thanks Asephei! I believe I’m starting to understand how Final Gather works now. Can’t tell you how much you’ve helped me! Many thanks! :beer:



This should help. The first post explains usage and the mechanism.

A future post will explain more about how to use it as an artist.

The script is “as-is” and can be modified as you like. But we will provide some support for broken things. Added features would be on your own for now. :slight_smile: We’re in the midst of Super Bowl Commercial time. . . .


Cheers for the updated info Gary & David, much appreciated :thumbsup:


I’ve added a link to your script in the post about flicker-free FG on my blog. Edited the thread opener here as well to include it. Thanks for your efforts!


That’s great, thanks! Let us know how using the shader goes. It’s something we’d like to see included in the core for mental ray.

Also, nice blog! Great explanations and details. I’ll add it to our blogroll today.

(Sidenote: I’m David. Brenton is a developer working with me on the blog. He’s the coding brains of the outfit. :wink: )