Skip to content. Skip to navigation

Illuminate Labs

Sections

Using Final Gather in Animations

In this tutorial we are going to demonstrate how to use Turtle's final gather in animations. We will demonstrate how to use final gather in a animations as well as with animated objects.

Project files: fg_anim.zip

Animation is a challenging task for algorithms based on Monte Carlo sampling. Since they rely on random numbers a small change in the scene can cause very noticeable noise and flicker. Turtle has some features that can alleviate this and also save a lot of render time.

All images are rendered with a resolution of 640*480 on a Dual 2GHz Macintosh G5 with 1.5 GB ram running MacOSX 10.3. The animations are are stored in avi-files encoded with xvid codec.

(Note: The video encoding is causing some artifacts, e.g. color gradients, so the animations look a bit more noisy than they really are. For best quality render an animation and view it uncompressed in Maya's fcheck.)

Animated camera

The scene fgAnimCamera.mb in this project contains a scene named fgAnimCamera.mb. The consists of a toy car and three spheres on a nurbs plane. There are no light sources in the scene. Instead we have enabled Final Gather with a white Sky Light. The Incandescence on the spheres have been set so they will emit red, green and blue light. Only the camera is animated.

Let's render the animation with default fg settings.

  • Gathering Rays: 1000
  • Accuracy: 1.0
  • Smooth: 1
  • Max Ray Length: 0
  • Time: 22m01s

Reuse samples

When only the camera is moving it's unnecessary to recalculate the final gather solution for every frame. Since the lighting will not change we can reuse the samples created in previous frames. There is a Render Stat flag called Static Final Gather that controls this. Select the node ns_plane and open the Attribute Editor. Enable Static Final Gather (Render Stats -> Turtle -> Static Final Gather). Do this for every piece of geometry in the scene. It's also possible to globally override this using the Static Final Gather Override in the Render Globals.


  • Gathering Rays: 1000
  • Accuracy: 1
  • Smooth: 1
  • Max Ray Length: 8
  • Time: 12m48sec

We now got a less flickering result as above in half the time.

Another way to reuse samples between frames is to save the samples to a file. The attribute Use FG Map File controls this. Set it to Reuse and append and type in a file name under File Name. Since the file doesn't exist yet a new file will be created. By using Append all samples created during rendering will be written to the file, so for each frame all samples created in this frame will be saved and then reused in the next frame. This gives the same quality/rendertime result as using Static Final Gather.

The mode Precalc. for animation can be used to create a final gather map for an animation sequence. Turtle will then perform the gathering prepass for every frame and save all samples to the file. By using a frame step greater than 1, you can save time by only calculating FG for every 10th frame. When you then render the animation (using Reuse file) very few FG samples needs to be created since most of them are read from the file. Another good thing is that the frames don't need to be rendered in one sequence anymore, since the fg samples for all frames are read from the file. Consequently you can use this file in distributed renderings where you don't have a "connection" between successive frames.

Precalculating a final gather map for every 10th frame took a total of 36 seconds. When rendering the animation using this file it took 16.2 seconds/frame, and the quality was the same as before.

Animated car

The scene fgAnimCar.mb in the project is the same as before but now the car is animated. Let's render with default fg settings.

  • Gathering Rays: 1000
  • Accuracy: 1
  • Smooth: 1
  • Max Ray Length: 0
  • Time: 19min45sec

As expected we get a lot of flickering around the car and under the spheres.

Reuse samples

Reusing samples between frames is a lot more complicated when we have moving objects in the scene. Samples created in one frame will become invalid in later frames since the shadows are moving. Turtle have a feature called Exploit Frame Coherence that takes care of this. Each FG sample is then assigned a number which states how many frames ahead it is valid. The number of frames depends on how far the sample is from animated objects. If it's far away, chances are the lighting will not change for a while and it can be reused a longer time.

The attribute Max Movement can be used to control the reuse/recalc rate. It can be seen as a value of how fast the objects move in the animation (the max distance moved from one frame to another). If you increase Max Movement samples will be reused a shorter time, and vice versa. The car moves about 40 units in 100 frames at constant speed, that's 0.4 units per frame. However setting Max Movement to 0.4 is too low. If a sample is recalculated at the time the car is passing over it, it's already to late. We need a zone around the car where no sample can enter without being recalculated. Increase Max Movement until the shadows move correctly. 2.5 is good for this scene. If Max Movement is not set correctly, Exploit Frame Coherence will actually introduce more artifacts than it removes.

Render again.

  • Gathering Rays: 1000
  • Accuracy: 1
  • Smooth: 1
  • Max Ray Length: 8
  • Exploit Frame Coherence: 2.5
  • Time: 16min 49sec

A further optimization we can do is to use Static Final Gather on all geometry where we know the lighting will not change. In this scene only the lighting near the car will change. If we split the nurbs plane so that we get a separate shape for the path the car is travelling we can set every geometry except the car and the path to use Static Final Gather.

Select the node ns_plain, right-click and select Isoparm. Select and drag the right side isoparm towards the car, then select Edit Nurbs -> Detach Surfaces. Do the same thing for the left side isoparm.


Now select all geometry except the car and the new plane below the car and enable Static Final Gather (see above). We still want to use Exploit Frame Coherence on the plane below the car so leave the other FG settings unchanged. Render again.


This reduced the render time to 16min04sec.

Return to Tutorial index


 

Last modified 2006-07-12