Editorial Policy
   Contact Information
   Advertising Info
   Publicist Info
   Privacy Statement
   Contact 3Dgate

TUTORIAL • September 25, 2000

Realistic Lighting: Global Illumination and Final Gathering (Continued)

A Softimage|XSI tutorial

by Anthony Rossano

Fine Tuning the Global Illumination Effect

Tuning the effect comprises three main parts: tuning how objects bounce photons, tuning how the light emits photons, and tuning how the rendering engine uses photons to render the image more smoothly.

Tuning the Transmitter and Receiver color: As I mentioned before, the value of the object changes the light energy of the photon. If you make the object dark in color, you'll get darker photon spots. Changing the color of the transmitter object will change the color of the photons that cascade off of it. The best color for the receiver is one with a very dark ambient value, and a 50 percent diffuse value so the photons show clearly with good contrast.

More photons spilling from the lights makes for smoother shading.

Next, fine tune the light properties for Photon Emission. In the Light Property Editor, you may adjust the number of photons and the energy of each photon. Leave the number low while tuning, then turn it up to 10,000 or more for the final render. Changing the energy is more complicated. If your changes drop the photon energy too low when they strike objects you won't see the effects and you won't know what happened. Use the following order of work:

First measure the distance in rough units that the light must travel overall during three or four bounces. Let's say your scene is 100 units across, you might assume that the most distance that the light will need to travel is 300 units.

Next, turn on Light Falloff under the Light Attenuation tab of the Light Property Editor, and set the mode to Linear, the end falloff to the longest distance the light will travel (300 units in our example), and the start falloff to perhaps one tenth of that distance, or 30 units.

Finally, adjust the light intensity up quite high, as high as 30 to 50, while adjusting the light Exponent (in the General tab of the Property Editor) starting at 1 and going gradually as high as 2. Stop when you are either worn out or happy with the effects.

You can also make changes to the Global Illumination parameters in the Render Region Property Editor. Increasing the radius has the effect of blurring and enlarging the effect of each single photon. Increasing the accuracy takes more photons into account at each point on the surface being rendered.

Now everything in the room transmits and collects photons.

Set the Accuracy to 50, and the Radius to .25, then slowly increase the radius (by .1 to .5 at a time) until the surface becomes more smoothly shaded. When you reach the point where increasing the radius no longer smoothes the lighting out, stop changing the radius and gradually increase the Accuracy, from 50 up in increments of 25 or so, until the image looks good. If you reach a point where increasing the accuracy no longer makes a difference, increase the number of photons cast by the light to get higher quality. With a scene 15 units across, good results can come with 10,000 photons, accuracy set to 1000, and a radius of 2.5 units. This means that each sample considers an area 2.5 units in diameter, and searches for 1000 photons to consider when figuring the light energy.

Final Gathering

Fundamentally, Global Illumination still uses bounced light to calculate the light energy on an object. Final Gathering takes this one better, and uses the area surrounding each object to calculate the light energy. This approach is conceptually not dissimilar to the image-based rendering developed by Paul Debevec at USC. When a ray extends from the virtual camera and strikes the object, a large number of other rays are shot at random into the area surrounding the object to calculate the light energy, instead of shooting a ray directly to the lights in the scene to detect the light energy. Then each of those rays calculates the light energy on the secondary surfaces surrounding the object. In this way the light on the first object is calculated from the illumination of the other stuff in the scene, not from the actual lights. Basically, every single surface in the scene can become a subtle, variable, complex light source. The results are remarkable, as light bounces back and forth between the objects in your scene, creating all kinds of subtle lighting interactions. Final gathering can also be used in conjunction with Global Illumination for even more amazing results.

Let's look at a simple case for Final Gathering, an outdoor illumination of a character. In a regular rendering of the character with a single light, the effect is harsh and monochromatic. But in real life the character would be lit by the direct light, and also by bounced reflected light from the environment of the sky and the ground. We can create this effect easily with Final Gathering.

Here's Lorphea with no Final Gathering, just raytracing. She's wearing a stunning outfit of pure diffuse white from Lambert.

Final Gathering requires only two steps to make it work: You build your scene, you turn it on in Render>Region>Options (or Render>Options for the final render). A simple scene first.

Step 1: Set up the lights. For Final Gathering we'll use one or more lights that have their color turned entirely to black. This way we can use them for the Final Gathering effect without changing the direct illumination in the scene, and we'll know that whatever we are seeing is coming from the Final Gathering effect. This black light will fire energy into the scene we build—mainly on a sphere to act as the dome of the sky. You don't actually have to set the light as a Photon emitter, since we don't need to cast photons from the light that initiates Final Gathering.

We can add a Global Illumination light to fire photons later, and we can add regular shadow-casting lights later to add direct illumination. Lastly, unhide the ambient light with the Shift-H key command, and delete it so it won't dumb down our effect.

Step 2: Set up the materials. On the character model add a simple Lambert material, with the Ambience set to black and the diffuse color set fairly neutral as well, perhaps (HSV = 0, 0, 0.8). This simple default material is intended to allow us to see the Final Gathering effect most clearly, with a minimum of interference.

The dome of the sky will be the main source of bounced light. Create a sphere or use a curve to revolve the dome. Add a simple constant material to the sphere, and set the color to a nice blue, (HSV = 0.6, 0.25, 0.5). The value of the sphere will directly control how much light is reflected onto the character—not the intensity of the light that we used to turn on the Final Gathering effect. In fact, we'll never need to mess with that light again—it has little to do (directly) with the effect.

The dome must be inverted, since our camera is inside it, and it would be nice (eventually) to have a sky map projected on it to make the effect even more cool. Since we don't want to see the sky, only the illumination from it, turn off the primary rays in the Visibility Property Editor for the dome. (This will not change the effect.) Add a ground plane, at the base of the dome and again give it a simple, gray Lambert material.

Kiss the sky

Now Lorphea is overlit by all the light cascading from the sky. Making the sky darker or more transparent will tone down the effect.

A more balanced use of direct lighting and final gathering gives Lorphea supple shading.

Now just turn on the Final Gathering effect in the Render Region Options box, and create a render region. Check out the incredible shading on the model! Although there is only one light in the scene (and it's black) the model is softly illuminated from all sides. There is a soft shadow on the ground plane from the arms of the character. The shading is darker in the nooks and crannies opposite the sky (known colloquially as the places where the sun doesn't shine.) Now let's fine-tune the effect.

The difficulty in getting Final Gathering to give you what you want is in modifying the amount of light energy coming off the major transmitting object, in this case the sphere of the sky. Select the sky dome and pull up its Property Editor. Modify the value of the color to observe the results. As you increase the value, more light energy is transmitted from the sky dome to the rest of the scene. Each object in your scene will act the same way, adding energy to the scene through the value of the material color. For instance, if you make the value of the ground plane lower, Lorphea will receive less bounced light underneath, and will get darker shadows.

You can adjust the accuracy of the effect in the Render Region Options, under the Photon tab in the Final Gathering area. The Accuracy value tells XSI how many samples must be made at each pixel on the object. The default value of 30 is rather low. Increase this in increments of 100 to see the changes. Stop and back up a bit when increasing the Accuracy no longer yields improvements. Since this determines the number of lookups at each pixel, it can have a dramatic impact on render times. Don't go over 1000 unless you have unlimited patience.

Skip the minimum radius, it will automatically be set to 10 percent of the maximum radius. The maximum radius is what controls the blockiness and chunkiness of the Final Gathering effect. The maximum radius specifies how distant objects are considered in the Final Gathering effect. Specifying a higher number results in worse image quality, but shorter render times as a result of clever software optimization in the render engine. Reducing the max radius increases render time and improves the smoothness of the shading gradation, as more rays are taken of the closer, more important objects contributing the bounced light effect. It seems to be a good idea to leave both min and max radius at zero, which allows the rendering engine to pick the number it thinks is best based on how large your scene extent is.


Using Final Gathering and Global Illumination together

Final Gathering is used here to add lighting to the edges and backfaces of the glyph.

Final Gathering and Global Illumination are complementary techniques. Final Gathering improves Global Illuminations effects dramatically, and will give you better results with fewer rays. You can also add in direct, shadow casting lights to further increase the beauty of your scenes.

Anthony Rossano is a Certified Softimage Instructor, the author of Inside Softimage 3D (New Riders Publishing, 1998), the co-author of XSI Illuminated: Foundation (Mesmer, 2000) and the founder of Mesmer Animation Labs where animation classes are also offered. Anthony has been teaching and working with XSI for a while now, and he really likes it.