MAA 3312: Advanced Texturing and Lighting In
this course the students will learn to apply traditional paint concepts,
tools, and techniques for use in computer animation. They will develop
critical ideas for surface treatment, texture, and lighting and demonstrate
the layering of light in space to create mood, emotion and theme. |
||
|
JUMP TO A SPECIFIC WEEK: |
Week 9: Direct Illumination, Global Illumination, Final Gather, and Caustics

When lighting your scene, you should be thinking about ways to maximize contrasts to draw user interest. In the looping image above, you can see how adding contrast to value, saturation, and hue, will dramatically increase the quality of your illuminated enviornment. Use these choices to inform how you decide to light your scene.
Direct Illumination:
Types of Lights:
spot lights- A spot light has a cone of influence
in a specific direction. This is controlled by the Cone Angle attribute
which is measured in degrees from edge to edge. The Spot Light also has
Decay, Dropoff, and Penumbra. Great for lamps, grazing accent lights,
and dramatic effects, as well as for producing light fog.
directional lights-The Purpose of a directional
light is to simulate a distant light source, such as the sun, where light
rays are coherent and parallel. This type of light will produce a harsher,
more intense quality of light with harder edges and no subtle changes
in surface shading becasue of its parallel rays with no decay. Directional
Lights are not very expensive to render because the angle is consitent
for all rays and decay is not computed. It also cannot simulate light
fog.
point lights-The Point Light emits rays
from a single point outwards in all directions. It can accurately simulate
a lightbulb or candle as a result. Point lights DO have decay and will
typically produce more subtle, yet richer shading on surfaces. THIS
IS LIGHT EMITING FROM 1 DIMENSION IN 3D SPACE.
area lights-Unlike point, directional, and
spot lights, area lights are far more naturalistic in that all light sources
must exisit in multiple planes of 3d space. Thusly it is a less abstract
shading model, but also more expensive to render. An are light reflects
the size and orientation of the light. They are great for straight, long,
specular, highlights. For soft lighting across a scene. And for Realistic
shadows that vary from hard to soft. All area lights have built-in quadratic
decay (see below). THEY DO NOT WORK WELL WITH DMAP SHADOWS. THIS
IS LIGHT EMITING FROM 2 DIMENSIONS IN 3D SPACE.
volume lights-This is the most physically
accurate definition for a light, but it usually far to costly for us to
render with. The Volume light will illuminate objects within given volume. THIS
IS LIGHT EXSITING IN 3 DIMENSIONS OF 3D SPACE.
ambient lights-An ambient light is a non-directional
light that can be used in low intensities to simulate the diffused, scattered
or reflected light you see in real life. When doing more advanced rendering,
global illumination simulatios are used instead. The ambient light has
an ambient shade characteristic as well.
the default light-If
there is no light in a scen, maya will create a directional light when
the scene is rendered. This light is parented to the rendered camera and
illumates the scene regarless f where the camera is facing. After the
render is complete, Maya removes the default light from the scene
Light Properties:
Intensity-Intensitycan
be defined as the actual or compartive brightness of the light. It can
be modified with the slider, or texture mapped. We will look at texturing
intensity with ripple patterns to fake caustic lighting effects in underwater
simulations in the upcomng weeks.
Color ->View the Color Temperature chart
below, indicating relative color values for certain light sources:

The color the light can also be mapped.
Dropoff (spot
light specific)- is
similar to decay except for that its function is to cause the light to
diminish in intensity perpendicular to the light axis instead of along
the light axis.
Penumbra
(spot light specific)- The Penumbra is the
area at the edge of a spot light where the light diminishes in intensity.
The larger the radius of the penumbra, the softer the circle of light
projected by a spot light will be.
Ambient shade (ambient light specific)- This
attribute allows you to specify how much light comes frm the source. I
set to 0, it applies evenly across the whole scene, where as a value of
1 a the other extreme causes there to be direction associated with that
ambient light, based on it's position.
Decay rate (for point,spot and area)- Decay
refers to how light diminishes with distance. In maya, it is possible
to alter the rate of decay in four sepeate ways: No Decay, Linear, Quadratic,
and Cubic
No Decay |
Light will contine forever; will reach all objects in the scene. |
| Linear | Liht intensity decreases in direct proportion to distance. Longer to render, but diminishes less than in nature. |
| Quadratic | This is how light decays in real life. (I=1/d*d). Longer to render still. |
| Cubic | Light decays faster than real life. (I=1/d*d*d). Longest to render. |
Raytrace
Shadows are
the natural simulation of shadowing effects in 3d. Raytrace Shadows
are produced on a ground surface when light in the form of a ray, being
casted from a light source such as a point light or spot light or directional
light (etc...), is occluded out by an intercepting object. As the rays
are blocked, no light can reach the ground plane, and thusly a shadow
is produced. See Image 1:

By
Default, Raytrace Shadows produce very hard edges. This is unnatural to
what we see in real life (View the floor in Gothic Cathedral Image above).
Since physically, Light
can exhibit both Photonic (particle) and Wave like properties, we
have to take this into consideration when simulating raytrace effects.
By their very nature, anything exhibitng the properties of a wave, (and
all quanta materials will), can have those waves reflected, refracted,
and interferred with. These principles are exactly behind the theories
of Global Illumination, Radiosity, and Refractivity in Media Denser than
air, which we will look at throughout the course.

However, we need to concern ourselves with the ability of a wave to propogate past an interferring object. See Image 2 below. Just as a wave in the ocean will spread and disperse (see blue lines) instead of heading in a single direction (see red lines), raytrace shadows should exhibit blurring proportional to their distance after the light ray intercepts an object. This effect is known as Shadow Attenuation. and must be simluated in our raytrace settings to produce accurate shadows. (see image 3, and note the blurring of the shadow on the far left, furthest from the light, as the rays have more time to enter the shadow area). We can adjust the blurring of the shadow by changing the amount of rays that are cast from the point of interception, and by altering the angle at which they bend (see image 4).
Image
2: ...................................................................Image
3:


Image 4:



Indirect Illumination:
![]() |
Global Illumination-The underlying principles of Global Illumination is that light, in the real world, can exhbit the ability to reflect off any surface. The more luminous the surface (the whiter the surface), the more light will be reflected. Since light is reflected off of all materials (refer to properties of Dif.-Gloss-Spec.-Refl. already talked about in this course), we should assume that when multiple objects of a luminence greater than pure black (ie, everything except for black holes) are present in our scene, that light will reflect back into the shadow areas on nearby objects from that surface. This principle is used in Hollywood, in photographer's studios and on television sets by having stagehands hold up brightly colored reflectors or use bright backdrops when filming with directional light to lessen the shadows on actors or items (see images below).
![]()
It can also be observed in everyday situations such as when light enters through a window, hits a wall, and reflects off to the ceiling. This is called a diffuse reflection since the walls have no reflectivity/specularity to them and it is merely their Albedo (or overall tonal value) that controls how much light bounces. A white wall will of course bounce more light than darkly painted wall. You can see in the photo below that the color of the light (in this case orange from the morning sun) will also be transferred.
As we set up global illumination, we need to observe the how the light bounce will effect the shadow areas. In the demo below, The light rays emitted from our source (spot light) will bounce off of the ground plane and onto the shadow side of ball, thus lightening the shadow as we see in the photo examples above.
TO RENDER GLOBAL ILLUMINATION WITH MENTAL RAY:



Render Time: 0m 05s

Render Time: 0m 07s
Render Time: 0m 06s, Only a photon intensity of 1,000 in this image.
Original Image for Comparison Purposes. Photon
Emmission :
Watch the video below. Photons are just like these bouncing balls. They carry color and light as tiny packets riding on a wave of energy. Everywhere they hit, they "bleed off" some of their color onto where they hit, and then "pick up" some of the color from that surface, bouncing and richocheting until they come to a stop. At every hit, the photon is either absorded based on the diffuseness
of the surfaced, reflecfected based on the reflectance of the surface
(the two combine to describe Albedo), or transmitted as through a
transparent object. The bouncing process stops when the number of
bounces equals the max photon depth as set in the Render Settings
window
or based on the Exponent setting in the light. This is akin the the end of the video above where the balls gather
in at the bottom of the hill. HOWEVER, every place a photon hits is
illuminated, brightening the scene.
The Three values shown below, in addtion to the Max Photon Depth give you all the varriables you need to start controlling the splotchiness.
Photon Intensity- This value is effectively the "elasticity" of the rubber balls (photons) in the video. A higher number makes for super-bouncy balls which have a lot of energy, thus will hit a lot of places, and make the scene brighter. A low number will yield bowling balls, photons which die very quickly and leave the scene very dark.
Exponent-This is esssentially a decay-rate value. Leave at 2.000 to simulate the natural effects of how light decays in an a Nitrogen-Oxygen based atmosphere such as our own.
GI Photons- This is the number of "balls" (photons) being dumped into the scene. The more you have, obviously, the brighter a scene is going to get. I do not suggest changing this value until you are done with the process of tweaking the scene and wish to make it brighter.

Lets up my Photon Intensity from 8,000 to 40,000,
Lets up my Max Phton Depth from 5 to 10 and render again:
This will make the scene even brigher since we are allowing each photon double the amount of bounces
Render Time: 0m 07s
Notice that the scene is now much brighter. If my scene was too bright here, I would turn my Photon Intensity values back down. Notice as well that my render time is still 7 seconds. ALSO NOTICE HOW THE SCENE LOOKS LIKE IT IS MISSING CONTACT SHADOWS (LIKE UNDERNEATH THE CHAIR AND ALONG THE WALL.... this will be fixed with final gather).
Well, now that the scene is brighter, its looks even more like crap because of the intensity of these photons doing some serious "disco effects" on the walls. The first way to fight this is to take an inventory of the scene size.
Determining
Accurate Global Illumination Scale:

While
GI can often be determined using a "guess and check" method, better
understanding, the Accuracy and Radius values will allow us to accurately
determine the amount of sampling needed to correctly light a scene indirectly.
The Accuracy Value sets the maximum number of photon hits allowed in any
scene, and while higher values will significantly increase render time,
they will create much more accurate renders.
The Radius Value is VERY important. This controls the max distanced from
a photon hit that the energy will be calculated. Leaving this at 0 will
allow maya to calculate the best size, but will take longer to compute.
To determine an accurate number for this radius, I suggest employing the
Distance tool under Create-Measure Tools-Distance Tool:

The Scene size here in my simple scene is 6.77 units. IN MY DEMO SCENE, (IF YOU REMEMBER FROM EARLIER), MY SCENE SIZE IS ROUGHLY 24 UNITS.
STARTING WITH MAYA 2009, THE WAY THE RADIUS IS HANDLED HAS CHANGED. NOW, WE SIMPLY TAKE THE MEASUREMENT OF THE SCENE, AND SET IT AS THE RADIUS!!!!
The Merge Distance is essentially a bubble, any photon inside that bubble gets blended with other photons in that bubble, creating a smoother result. For best results, set this at 01% of the scene size (aka, your radius value).
So, for my scene, my Radius is 24, my Merge Distance is 0.24. And here's what I get:
Render Time 0m 13s
Render Time has gone up here (almost double), but the results are much cleaner. However, we still aren't even close yet. GI has done about all we can ask of it. Lets see what adding Final Gather to the mix will do.

Final
Gather-
Final gather is method of simulating global illumination. When used in combination
with global illumination, Final Gather lets you
create the most realistic, physically accurate
lighting conditions for a scene (using
Global Illumination alone can sometimes give splotchy
results as we have seen).
When Final Gather is enabled, every object effectively
becomes a source of ray-emitting light, mimicking
the natural world in which objects influence the
color of their surroundings. When one light ray
strikes an object, a series of secondary rays
are diverted at random angles around it to calculate
the light energy contribution from the surrounding
objects. The light energy is then evaluated during
the ray tracing process to add the effect of the
bounced light.
Unlike Global Illumination, Final gather does
not use photon maps to calculation of light at
a given point in scene. Instead, mental ray for
Maya samples the surrounding area above every
point in the scene. The illumination at those
points is then computed as direct illumination.
(If Global illumination is also being used at
the same time, Final Gather calculates the total
incoming illumination in the scene [called irradiance].)
Final Gather rays are emitted in many directions
from a sample point and stop according to the
settings in the Final Gather section of the Render
Globals Setting window. Because Final Gather rays
do not bounce, secondary surfaces are not taken
into consideration. (However, when rays hit geometry,
material shaders may cast secondary reflection,
refraction, or transparency rays, as long as those
secondary rays are specular or glossy, not diffuse.)
Final gathering eliminates the low-frequency variation
in the global illumination that often results
if too few photons are used. (Performance is optimized
because mental ray for Maya reuses and interpolates
nearby final gathers.)
Final Gather and Global Illumination-
You can combine Final Gather and Global Illumination
techniques to:
-achieve realistic lighting and shadows more cost
effectively
-reduce flicker in animations
-effectively illuminate interiors (global Illumination
on its own can sometimes render splotchy results AS WE KNOW)
-You can reduce the number of Global Illum Photons,
the Global Illum Energy levels, and the number
of Final Gather Rays resulting in less rendering
time, but more realistic lighting.
Hemispherical
Sampling : Final
Gather works by collecting the photons emitted into a scene and samples
them back together with the goal of smoothing the look of many "rubber
balls" to extend the metaphor, into a more cohesive, smoothly
lit, scene. Final Gather samples Hemispherical areas, which can be
thought of as baskets for these photons to reside in at the end of
their emission. Final Gather works best in diffusely lit scenes to
collect brightness in dark corners, and while similar to GI (and often
used in conjunction with it), FG uses it's hemispherical sampling
form of raytracing to collect and smooth the bounces which are already
calculated by the GI.
Final Gather Settings:
Final
Gather settings should be tweaked in the order shown below. These are listed in order of importance.

1. Final Gather Accuracy. This value sets
the number of rays fired from each primary ray. The default value
is 100. 200 usually works for test renders. Go up to 1,000 at most
for final renders.
2.Primary and Seconday Diffuse Scale. Can be used to multiply all computed FG values,
and can be tinted any color.

3. Max Radius. This value controls the size of the
hemispherical sampling area. This number should be no larger than
1000% of the size (width) of the scene. This can be determined in the
same way that was discussed a few paragraphs above.
4. Min Radius. This value controls the minimum size
of the hemispherical sampling area. Usually 100% of the Max radius
value is best. If both Max and Min are left at 0, which can be done
by leaving off the "Use Radius Quality Control" checkbox,
maya will try to determine the best values for the scene. This may
take longer to render.
With settings 1-4 in place, here's how my render now looks. Pretty good right? Splotchiness is gone. Great color bounce off that orange thinggy. Nice soft shadows where objects contact one-another. But, maybe still a little too dull for me. Notice as well, our render time has now had a whole minute tacked on to it!!! YIKES:
Render Time 1m 11s
![]()
5. Direct Illumination Shadow Effects. Does not change speed of render, should always be set to on. If off, will not be able to compute colored or semi-transparent shadows well.

6. Filter. Softens the render and reduces artifacts.
Set to 0 by default. Values between 1 and 4 will soften the render.
7. Falloff Start. Similar to the Min Radius above. Here values of around 10% of the scene work to show where you start ignoring elements around the current texel being illuminated, and start sampling the enviornment color. LOWER values often make for a brighter scene since your enviornemnt (outside) is normally brighter than inside.
8. Falloff Stop. Similar to the Max Radius above. Here values of around 100% of the scene work to show where you ignoring ALL elements around the current texel being illuminated, and just sample the enviornment color. LOWER values often make for a brighter scene since your enviornemnt (outside) is normally brighter than inside. IF YOUR FALLOFF STOP IS A SMALLER NUMBER THAN YOUR SCENE SIZE, YOU START LETTING OUTSIDE LIGHT POUR IN.
Here I have set my Falloff Start and Stop to Values that are too low:
Render Time 1m 11s
And here I have turned them back down to the settings shown above (the proper settings):
Render Time 1m 11s
For all intents and purposes, we can now call this scene done. BUT, lets look at some ways to push it even further.
"A classic problem in computer graphics is lighting a scene solely through indirect light, like from a sky, or other "environment" light from an acquired HDRI or similar. This is accomplished in mental ray using Final Gathering (henceforth abbreviated as FG), and is done by tracing a large number of "FG rays" to see which hit the environment (or other lit surfaces). Since this is a large number of rays, the results are cached (for performance) at FG points and the result is interpolated, "smoothing" the result. To solve all these issues the concept of a portal light is introduced. The portal light is a (rectangular) area light which is placed in the window, which obtains it's proper intensity and color from the sky outside the window (i.e. an environment shader, like mia_physicalsky or similar) and how much of that sky that is "seen".
Practically, this makes the portal light behave as a "FG concentrator" so instead of having to send thousands of FG rays around the scene to "find" the window, the portal light actually blocks FG rays, and instead converts light from beyond the window to direct light, with high-quality area shadows with no interpolation related issues possible.
FG will now see a well lit room rather than a black room, and can be performed at much lower FG ray counts. Furthermore, since the light from the window is now direct, we gain one extra light bounce "for free"."
"The mia_portal_light shader should be applied both as light- and photon emitter shader on a rectangular area light. The mental ray light instance must be set to be visible (this is a technical requirement for the portal light to be able to "block" final gather rays. If the light actually is visible or not in the rendering is instead handled by the shader).
Furthermore, the mental ray light instance must be set up such that the rectangular area light is extended in the X/Y plane of the lights own coordinate space, and any transformation of the light must be handled with the light instance's transform" -From the Maya Help Documentation

You can even use the light portal to make the scene a bit brigher with the Intensity Multiplier.
You can deepen the shadows by turing on both Shadows and Emit Direct Photons:











