Professional Documents
Culture Documents
Advanced Lighting
in Turtle
Turtle defaults to only Final Gather when you enable Global Illumination which is
exactly what we want. The default settings should be OK for a preview render, so
render out a frame.
Rays: 300
The Final Gather algorithm is very
Depth: 1
Contrast Threshold: 0.1
expensive as it tries to estimate the
Interpolation Points: 15 lighting for any pixel by lots and lots
of rays in every direction. Luckily
indirect illumination changes pretty
slowly, so we don't have to calculate
a full Final Gather solution for every
pixel. As you saw in the render, we
do get some splotches with the
preview settings, which basically tells
us that we cheated a bit too much
16 sec with the Final Gather settings.
A quick way to move between a splotchy preview render and a high-quality render is
by simply tweaking the Gathering Rays parameter. 100-300 is often a good starting
point for preview renders. For final renders you should usually boost it to 1000 or
higher. You might need to tweak Contrast Threshold and Interpolation Points as well.
Contrast Threshold affects how many points are generated, depending on the
difference in illumination. A lower threshold will generate more points and capture
more details. Interpolation Points controls the number of points used for each
interpolation in the final render pass. A higher number will blur the solution and help
smooth out artifacts and splotches.
For this scene, increasing the Rays: 1000
Depth: 1
Gathering Rays setting to 1000 and
Contrast Threshold: 0.1
increasing Interpolation Points to 20 Interpolation Points: 20
should remove all of the artifacts.
Gather, but set Secondary GI to something else and handle indirect light bounces with
a lower quality, faster GI algorithm. Both Photon Mapping and Path Tracing are a good
choice for Secondary GI. They also work as Primary GI, but generally produce results
below the quality of Final Gather. Photon Mapping is Light Source centric and requires
that you explicitly set Light Sources to emit photons into the scene. It may take some
work to get the amount of Photon Energy right, and if you have many Light Sources,
tweaking them all might be a pain. Path Tracing on the other hand, is Camera centric,
TE CH NI C A L NOT E
When Turtle makes a 'gather', it samples the environment for data by shooting
rays in many directions from a given point. The data sought for can be e.g.
occlusion or indirect illumination.
TE CH NI C A L NOT E
Primary GI vs Secondary GI
In Turtle, the indirect light is split into two categories, Primary GI and Secondary
GI. Secondary GI is sampled only by Primary GI. This gives us the possibility to
use a high quality technique (e.g. Final Gather) as the main GI method, and a
faster method (e.g. Path Tracer) for deeper levels of indirect light.
The following table shows which techniques can be combined as Primary and
Secondary GI.
Primary GI
Final Gather - - -
Secondary GI
Path Tracer - -
Photon Map - -
Monte Carlo - - -
Note that you can set the primary GI to 'None'. This option should be used for
certain baking outputs, such as PTM or non-adaptive RNM. Since these outputs
performs their own gather, and gather rays always samples the secondary GI, you
can set the primary GI to 'None' to avoid unnecessary pre-passes.
Not mentioned here is the primary GI option 'Dynamic Photon Map'. This is
meant to be used for baking purposes only, and is covered by our point cloud
baking tutorial.
and basically sends out a large amount of rays that bounce around the scene and
estimate the illumination. The advantage here is that there's noting to tweak besides
the global Path Tracer settings. Final Gather, Photon Mapping and Path Tracing all
have their peculiarities as to how they sample the scene, so you should expect slightly
different results from these three. Try them out and use the one you like!
We have one limitation when lighting this scene that is not immediately obvious. If
you inspect the Area Light, you’ll notice that we have texture mapped the Color
attribute. Photons do not respect textured Light Sources for performance, so we'll
check out the Path Tracer instead for this example. Select Path Tracer as Secondary GI.
The Path Tracer calculations are saved in a cache, where the resolution of the cache is
given by the parameter Cache Point Spacing. The automatic value of the Cache Point
Spacing will generate around 2500 points, which will give us a GI that is a little too
blurred. Manually setting the value to 0.2 will get us around 14,000 cache points,
which is better. Letting Turtle render one frame with automatic Cache Point Spacing
will get you a good starting point for tuning, as the calculated value will be written out
in the Output Window (as ”[INFO] PathTracer Cache Point Spacing : 0.677616”).
Final Gather + Path Tracer, 1024x768
49 sec
We get rather comparable results when compared to the four-bounce Final Gather,
but in a shorter render time (21 seconds). Let's use this settings and render out a
higher resolution image (1024x768).
The neat thing about the Path Tracer is that it is completely unbiased, meaning that
you should get quite close to a physically correct Global Illumination solution if
enough rays are used. It will also adaptively sample the scene, halting at a suitable
depth where the benefit of further sampling is negligible.
Note that you can save Final Gather, Photon Mapping and Path Tracer calculations to a
file. So a nice trick with the Path Tracer is to trace a very large amount of rays once,
save this to a file, and then just reuse that solution afterwards. Saving GI solutions to
file is both a time saver and a great help when tuning your renders. Try setting Use FG
Map File to Overwrite and type in a file name. Enable Visualize in Model View, and hit
render.
All GI effects which generate some form of cache with points can be set to save
its data to a point cloud file. If used together with the setting 'Visualize in Model
View' (available for all GI effects for which it applies), a point cloud shape will be
created for the GI data, showing you the distribution of points in the scene
directly in the Maya viewport. This can be a powerful tool when fine tuning some
of the GI techniques, so remember to try it out.
We get a very boring render, but that's because there's an important point to be
made. If you check the Outliner, there aren't any Light Sources in the scene, so what
we're seeing is the Default Light of Maya. In a perfect world, you wouldn't have to
worry about this, because as soon as you start to add your own lights, the Default
Light will not be contributing. But when using a renderer like Turtle there are situations
where we do not explicitly create light sources, like when we are using an Environment
for lighting or performing Advanced Baking. In some of these situations, you will get a
contribution from the Default Light in Maya and might not be aware of this fact, so you
should get accustomed to switching off the Default Light as early as possible in a
project. Open up Render Settings Common Render Options and switch off the
Default Light.
There are two main options for lighting a scene with an environment. We can set up
a Final Gather rendering and have those rays that miss the scene shaded by the
Environment, getting a sort of indirect contribution. We can also use another method in
Turtle, where we explicitly emit light into the scene from a selected image without
using Global Illumination. This can be somewhat confusing, but just keep in mind that
Image Based Lighting is a pretty loose term, and in Turtle there are two different
approaches to Image Based Lighting. See the technical note below for more
information.
TE CH NI C A L NOT E
IBL can be used in two ways to add light to a scene; by generating a set of directional
lights that approximate the light from the IBL dome, and by using it as GI
environment.
For starters, head over to debevec.org (makes a great bookmark) and grab some
light probes that you like. We'll be using the Uffizi probe in this tutorial. A basic rule of
thumb in sampling theory is that any resolution larger than what you are rendering to
is a waste of time for both textures and environment image maps (it can actually be up
to 2x larger, but anything beyond will get lost in the sampling). So a very much
overlooked method of optimization is to resize your light probes to something that will
match the rendered details in the image with the image map itself roughly pixel-by-
pixel. So remember that using a 500MB HDR light probe will only slow down the
render, not increase image quality!
If you take a look at the Anti-Aliasing settings in the Render Settings Sampling tab,
you'll notice that we're using Adaptive Sampling, with 1 to 16 samples per pixel. There
are some important points to be made about the sampling system in Turtle. First, it
works by looking at neighboring samples, and based on the difference, they will be
further sampled if the difference is too large. When you are using HDR light probes,
you might introduce extremely large variations in intensity in the image, which will
most definitely force Turtle to sample harder. In many cases, you are rendering out
your images to 8-bit format. This is the case for jpeg, targa, tiff and the Maya
renderview.
In this case final pixel values will be clamped and quantized to integer intensity values
between 0-255. Any super-sampling of values above pure white will in this case be a
waste of render time and final quality, as the resulting pixel will be clamped down
anyway. There's actually a performance option in Turtle called Clamp Values which
clamps extreme values already at the sampling level, which can alleviate a lot of this
unnecessary sampling. Always try to use Clamp Values when you are previewing work
in the Maya renderview or rendering to 8-bit file formats!
We'll start out by using the light emitting IBL system in Turtle, which will analyze the
light probe and light the scene with virtual light sources approximating the light probe.
The advantage is that we will get very detailed shadows, as the scene is lit by 'real'
light, but we pay the price in render time. This system is a per-pixel effect, so if we
specify that we want 100 Samples, we will actually shade every pixel sample with the
equivalent of using around 100 ordinary Light Sources. 100 Samples is a reasonable
setting for the IBL, but for final renders you can go as high as 1000.
Go ahead and open Render Settings Environment Image Based Lighting, and
set Image File to one of your downloaded light probes. Open the Light Emission tab
found slightly below and enable Emit Light. Render out a frame!
Light Probe: Uffizi Here, it’s only the light probe giving
IBL Light Emission light, but it's not actually reflecting in
Samples: 100
the Bunnyman shaders. If you check at
the top of the Environment tab,
Environment and GI Environment are
both set to Camera Background. Since
we are not using Global Illumination, all
you need to do is change Environment
from Camera Background to Image
Based Lighting, and Turtle should use
the light probe for reflections and in the
1:53 min
background. Render out a new image.
As you can see, the IBL system is quite expensive in render time, but you will notice
more detailed shadows for more mechanical or architectural scenes, so it can be a
valuable trick to know for high-quality renders. An important part of getting the right
workflow with Turtle is to experiment, so don't settle for what you get out of the IBL
system if it's not to your liking, try using it as a base for further lighting, mixing it in
different ways with Global Illumination and seeing what you can come up with. There
are really no rules for what you can and can't use at any time with Turtle, so you might
just stumble on a great style of lighting by accident.
A very powerful way to get fast renders with Image Based Lighting is to use it
together with Global Illumination instead. Final Gather for instance can handle this
beautifully. Uncheck the Emit Light option in the Light Emission tab of the IBL system to
remove the virtual light sources we used to light the scene with earlier. In the upper
part of the Environment tab, change the GI Environment from Camera Background to
Image Based Lighting. This makes the light probe environment visible for all GI
algorithms, including Final Gather, which means that any rays exiting the scene will
pick up light from the light probe.
In the Global Illumination tab, check
Light Probe: Uffizi
Final Gather Enable Global Illumination. Select Final
GI Environment: IBL Gather as the Primary GI and None as
Secondary GI. Single depth Final Gather
will work just fine for many outdoor
scenes. Everything should now be set,
so render out a frame.
Since the light probe is sampled indirectly now by the Final Gather, the illumination
from the light probe can get smoother and slightly less detailed. Because we're not
importance sampling the image for intense areas, it can also be sensitive for light
probes with small bright areas. So if you get artifacts in the Final Gather solution, you
can alleviate them by pre-blurring the light probe. There is a Blur for GI option in the
IBL tab, but this can increase the render times for very large light probes. So always try
to pre-blur in an external program like HDR Shop if you can.
Both Final Gather and the IBL Emit Light method create quite smooth shading. An
improvement for most renders is adding some sharp shadows. In an outdoor scene like
this, a Directional Light with sharp shadows makes huge improvements to the final
image by adding the impression of a single point of origin of strong sunlight.
Notice how this also cut the render time almost in half! This is because a lower light
probe intensity is much cheaper for the Final Gather to sample. It's using adaptive
sampling and when the contrast difference is decreased, fewer rays needs to be traced
and fewer Final Gather points needs to be created.
TE CH NI C A L NOT E
Performance
If you feel the GI render is slow, there are a couple of things you can try apart from
fine tuning the settings for the used GI technique:
• Enable 'Clamp Values' for anti-aliasing. Clamping values will reduce the
difference between bright pixels, causing anti-aliasing to take less samples.
We are now quite happy with out settings, so let's render out a higher resolution
image (1024x768).
You might have thought about the idea of using both the IBL Emit Light and
Final Gather, and this is certainly possible. In some rendering you might need the
high quality IBL from the IBL Emit Light method, but you also need multiple indirect
light bounces. In that case both methods needs to be used. However, if care is not
taken, you can easily set the World Record in longest render times ever! If we are
using 100 Final Gather rays for every pixel sample, and are using 100 IBL light
sources, we will actually do 1002 light source calculations for every pixel sample.
And this is a pretty mild example!
One trick to get render times down is to use the Path Tracer as Secondary GI, with
the option Cache Direct Light enabled (found in Path Tracer Advanced Settings).
This will force the IBL Emit Light to be evaluated only for Path Tracer rays and the
result is saved in the Path Tracer cache. Final Gather rays will then read from this
cache instead of doing new IBL Emit Light calculations, which is much cheaper.
Remember that if you enable both the IBL Emit Light, and have the IBL as GI
Environment, you will get a double contribution from the light probe. Either set the
intensities of the emitted light and the GI Environment to 0.5 each, or select None
as GI Environment to avoid doubling the illumination. The pictures below show the
results for this scene using the Path Tracer trick.
Uffizi
IBL Emit Light
Uffizi
(no GI)
IBL Emit Light
Final Gather
2:14 min
Uffizi
2:53 min
IBL Emit Light
Final Gather
GI Environment is set Path Tracing
to None for all three
renderings.
2:27 min
We've got a small room with some furniture, lit by a single Directional Light
acting as a sun. We've got some glass, some chrome and some colored materials so
we can really see the Global Illumination effects. Let's go ahead and enable Global
Illumination, so open up Render Settings Render Global Illumination and check
Enable Global Illumination. Make sure you've got Final Gather as Primary GI and
None as Secondary GI. Go ahead and render a frame.
TE CH NI C A L NOT E
Final gather is the technique you should use as the Primary GI for most scenes.
This gathers indirect light at sparsely placed points in the scene. During render
time, these points will be interpolated to add indirect light contribution to the
point being shaded. Here's a description of the settings you most often need to
tune.
• Rays - The number of rays sent to gather the indirect light for each
sample point. Increasing this value improves quality up to a certain point.
If you want to improve quality further, try lowering Contrast Threshold or
increase Interpolation Points.
• Final Gather Depth - This sets the number of recursive gathers that
should be made. A higher number means deeper levels of indirect light,
but also longer render times (since we might need a new gather at every
point where a previous gathering ray hit a surface).
Your monitor has a nonlinear intensity output, so any color you select on your
monitor will be distorted from the true linear color representation. Internally, Turtle
assumes all the textures and colors are in linear color space, because shading
performed in linear color space will be very close to physically correct. The Gamma
Correction system in Turtle lets you specify how both the textures you input and
colors you select will be interpreted and converted. By default, no Gamma
Correction is performed, because this is the default of the Maya Software renderer.
In a real production situation, it is much better though to use Gamma Correction,
because we will select colors on a nonlinear display device, and we will most often
be viewing it in the Maya renderview, that is, displayed on a nonlinear display
device.
Many Turtle settings have both a color attribute and a separate Intensity parameter.
This is intentional, because colors are gamma corrected, scalar values such as
Intensity are not. Usually, you know that you maybe want to boost the Intensity by a
factor of 10. You might set the Color itself to such a brightness, but gamma
correcting a value outside of the intensity 0.0 – 1.0 will generally be a bad idea,
because gamma correction is strictly an operation meaningful on values in that
domain. By keeping your color channels within the 0.0 – 1.0 range, and placing the
boost factor in Intensity, the color is correctly gamma corrected, and the Intensity
value is passed into Turtle untouched, so you get the 10x boost you wanted.
The only special precaution you need to be aware of is if you are to process the
images further, if you or someone else will be compositing the renders or
manipulating them in Photoshop. In this case it can be very advantageous to keep
the compositing in linear color space as well, and gamma correct the final
composited material instead. You should, in this case, light the scene using full
Gamma Correction, Before you render out passes for compositing, however, you
should change Output Gamma Correction to 1.0. This will gamma correct input
colors, but give you a linear output. HDR image file formats are for exactly this
reason treated as linear file formats for both input and output. You can happily
render with full Gamma Correction inside Maya, any HDR or EXR file written will still
be in linear color!
Enable Gamma Correction again. The image is still a bit dark, so a quick fix is to
tweak the Intensity and Saturation values of the Primary GI. In Render Settings
Render Global Illumination → Color Balance, set Primary Intensity 4.0, and render
a frame.
Primary Intensity: 1.0 13 sec Primary Intensity: 4.0 22 sec
Primary Saturation: 1.0 Primary Saturation: 1.0
TE CH NI C A L NOT E
Most Secondary GI methods in Turtle can be setup to cache direct light as well as
indirect light. This increases performance since fewer direct light calculations are
needed. It's worth to keep in mind though that this gives an approximate result,
and hence can affect the quality of the lighting. For instance indirect light
bounces from specular highlights might be lost.
This is available for Photon Mapping, Path Tracing and multi-bounce Final
Gather. It's controlled by a check box in the Advanced Settings of each method.
For Photon Mapping and Path Tracing this is enabled by default.
If you want indirect bounces from highlights and other shader specific effects,
your should disable this feature.
Photon Energy: 500 Photon Energy: 500
Cache Direct Light: On Cache Direct Light: Off
12 sec 15 sec
We can actually raise the number of photons emitted quite a lot without paying
in render time, because emitting photons is very fast. Increase Global Photons to
100,000 and render out a frame. We get some more color bleeding, and the render
time difference is negligible. If you compare the render with the 5 bounce Final
Gather we did earlier, you should notice that we have very comparable image
quality, but shorter render time. the full Final Gather rendering. Try rendering the
scene with 1,000,000 photons, and you'll only see a few seconds increase in render
time.
We get quite a large increase in render time, but the Standard Photon Mapping is
optimized for quality. We can achieve a lot faster times by using something called
Precalculate Irradiance, which essentially pre-calculates some things before the
Photon Map is used, while sacrificing some accuracy. Go ahead and check Precalc.
Irradiance and render out a new frame.
That did quite a bit for the render times, and we still have a nice render. It's a quite
difficult question as to whether you should use Grid Based Photon Mapping or
Standard Photon Mapping. You'll have to compare images of the two and see which
one you prefer as they result in subtle differences in shading. The default choice of
Grid Based Photon Mapping is a good choice for most scenes.
TE CH NI C A L NOT E
When using Photon Mapping or Path Tracing to produce indirect light, you
may experience light leaking through e.g. walls. This is due to the filters
these techniques use, which cannot exclude all sample points within their
radius that would be considered invalid.
If you use Photon Map or Path Tracer as Secondary GI and Final Gather as
Primary GI, the leakage may still pose a problem since the Primary GI will
gather the leaked light. To reduce this problem, you can enable the Light
Leakage Reduction setting in Final Gather. This technique works by using
Final Gather as a Secondary GI fallback when sampling close to walls and
corners, which effectively reduces the visible effect of the leakage.
For the Path Tracer there is also an alternative to this, easier to use. In Path
Tracer Advanced Settings you can enable Check Sample Visibility. This will
make sure that path tracer cache points located on different sides of a wall
will not be used together.
We'll look quickly at another very powerful tool for GI renders. In Turtle, you can
actually tune the look of the Global Illumination solution by adding Indirect Light
Sources. The Indirect Light Sources will shade the GI solution as a post process,
allowing you to boost, tint, or darken areas any way you want. This can save you a
lot of time tweaking the scene, since you can cache the GI calculations, and make
final shade adjustments completely with Indirect Light Sources. You can even light
link the Indirect Light Sources to specific objects.
Go ahead and create a Spot Light, and place it so that it lights up the area
around the arm chair. The key to making this an Indirect Light is to add Turtle
specific Intensity attributes. As before click Turtle in the Attribute Editor top menu,
and now select Add Intensity Attributes. In the Turtle tab that appears, enable Use
Indirect Light. If you render out a frame, you will notice that the render will be
almost completely black. As we have only a single Indirect Spot Light, anything
outside of the Spot Light cone will have no indirect illumination at all. Notice that
the direct illumination coming from the directional light is untouched. You can
easily mix in the main GI solution by adding an Indirect Ambient Light in the same
way. Just make sure to set the Ambient Shade attribute to 0.0, otherwise it will act
more like a point light.
See the neat specular caustics on the wall from the glass table? Notice also the
subtle blue light coming in from the outside This is where we stop in this example,
but you can go ahead and tweak it a bit more. Try to add Depth of Field for
instance! Or why not render it out in passes and compose it in a compositing
package. This is where the fun starts!
Final Words
Hopefully we've at least scratched the surface of what's possible with Turtle and
whetted your appetite a bit. Your best bet is to keep experimenting with all the
different components found in Turtle. We've not even showed you any of the Turtle
specific nodes, but hopefully this will have you up and running with setting up your
own scenes with Turtle. Remember the technical notes for later, they might come in
handy!
We'd love to hear any feedback or comments on this tutorial, so please write us!
• Final Gather
• Photon Mapping
• Caustics