Advanced Lighting in Turtle

22
Advanced Lighting Advanced Lighting in Turtle In this tutorial we delve deep into the Global Illumination and Environment system featured in Turtle 5. It takes some time with any rendering software to get to the point where you're confident in setting up a beautiful render. This tutorial will attempt to provide you with lots of shortcuts that can help you get really nice renders in Turtle and lay out a good workflow for lighting many different types of scenes. You'll also find in-depth technical notes on a lot of the components and concepts included in Turtle’s Global Illumination and Environment system. You can work through the examples without reading the technical notes if you wish, but be sure to look at them for reference later if needed. The first example we'll look at is an indoor/studio setup of an espresso cup on a table. Open the demo scene espresso.mb. The model should look pretty rough, we're using Turtle's built in subdivision surface option for speed. Go ahead and render a frame and you should see a smoother cup, although there's no Global Illumination going on yet so it's pretty black. Direct Light only 9 sec

description

Advanced LightingAdvanced Lighting in TurtleIn this tutorial we delve deep into the Global Illumination and Environment system featured in Turtle 5.The model should look pretty rough, It takes some time with any rendering we're using Turtle's built in subdivision render a frame and you should see a surface option for speed. Go ahead and smoother cup, although there's no Global Illumination going on yet so it's pretty black.Direct Light onlysoftware to get to the point where you're confiden

Transcript of Advanced Lighting in Turtle

Page 1: Advanced Lighting in Turtle

Adva

nced

Lig

htin

g

Advanced Lightingin Turtle

In this tutorial we delve deep into the Global Illumination and Environment system featured in Turtle 5.

It takes some time with any rendering software to get to the point where you're confident in setting up a beautiful render. This tutorial will attempt to provide you with lots of shortcuts that can help you get really nice renders in Turtle and lay out a good workflow for lighting many different types of scenes. You'll also find in-depth technical notes on a lot of the components and concepts included in Turtle’s Global Illumination and Environment system. You can work through the examples without reading the technical notes if you wish, but be sure to look at them for reference later if needed.

The first example we'll look at is an indoor/studio setup of an espresso cup on a table. Open the demo scene espresso.mb.

The model should look pretty rough, we're using Turtle's built in subdivision surface option for speed. Go ahead and render a frame and you should see a smoother cup, although there's no Global Illumination going on yet so it's pretty black.

Direct Light only

9 sec

Page 2: Advanced Lighting in Turtle

The scene is lit with a single area light so that we can better check out the effects of the different GI possibilities. For a real studio lighting setup, you'd probably want to use a few additional fill lights to lighten the image. Open the Global Illumination tab in the Render Settings and check Enable Global Illumination. The Global Illumination is handled by a Primary and a Secondary light integrator which can be paired together in various combinations. Most often, you'll want a high-quality Primary GI like Final Gather, and a faster, low-quality Secondary GI like Photon Mapping or Path Tracing.

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.

Global Illumination

The Final Gather algorithm is very expensive as it tries to estimate the 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 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.

16 sec

Rays: 300Depth: 1Contrast Threshold: 0.1Interpolation Points: 15

Page 3: Advanced Lighting in Turtle

For this scene, increasing the Gathering Rays setting to 1000 and increasing Interpolation Points to 20 should remove all of the artifacts.

The current configuration only gives us one bounce of indirect light. For a correct multi-bounce Final Gather render, we can set the Final Gather Depth to 2 or higher. Try setting the Depth to 4 and render out a new frame. The render time has increased a bit, but if we compare the image to the previous render, we see slightly more indirect lighting in the shadows.

Final Gather can get quite expensive when using multiple bounces, which makes the render times long for production quality renders. Fortunately there are tricks we can use to get all that neat multi-bounce indirect light without using Final Gather. We can keep the Final Gather as Primary GI, which will shade final pixel values with a high quality Final

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 NICA L NOT E

Gather – a quick explanation

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.

Rays: 1000Depth: 1Contrast Threshold: 0.1Interpolation Points: 20

Rays: 1000Depth: 4Contrast Threshold: 0.1Interpolation Points: 20

21 sec

27 sec

Page 4: Advanced Lighting in Turtle

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”).

TE CH NICA 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.

Final Gather Path Tracer Photon Map Monte Carlo

Final Gather - - -

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.

Primary GI

Seco

ndar

y GI

Page 5: Advanced Lighting in Turtle

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.

49 sec

Final Gather + Path Tracer, 1024x768

Looking at the actual solution in this way can give valuable hints on how to proceed with tuning the scene. Blindly changing values is generally a bad idea, so learn to use the GI map visualization in your everyday work.

Page 6: Advanced Lighting in Turtle

Image Based Lighting

The next scene we'll look at is a glossy cartoon character. We'll try out some different ways to light the scene, and various ways to get nice reflections on the glossy shaders. Open up bunnyman.mb and render out a frame!

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 NICA L NOT E

Point Cloud visualization

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.

4 sec

Direct Light only

Page 7: Advanced Lighting in Turtle

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.

TE CH NICA L NOT E

Image Based Lighting (IBL)

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.

• Directional light method - The first method is used by enabling the 'Emit Light' check box for the IBL. Directional lights are created with different colors and intensities to represent the light emitted from the dome. This method can get slow if the number of lights (as given by the setting 'Samples') used to represent the dome is set high, but it allows for a more dynamic lighting and more distinct shadows.

• GI environment method – This method is enabled by setting the GI Environment to 'Image Based Lighting', and use this with a Global Illumination method like Final Gather or Path Tracer. Then the IBL dome will be used to shade all GI rays that miss geometry in the scene (similar to sky light). If the image used for IBL varies a lot in intensity, there is a risk of splotchiness in e.g. Final Gather. To avoid this it is recommended to blur the IBL image using the IBL setting 'Blur for GI'. This method is generally faster than the first above.

Page 8: Advanced Lighting in Turtle

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!

Here, it’s only the light probe giving light, but it's not actually reflecting in 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 background. Render out a new image.1:53 min

Light Probe: UffiziIBL Light EmissionSamples: 100

Light Probe: UffiziIBL Light EmissionSamples: 100Environment: IBL

1:56 min

That's starting to look quite nice, although we got an added bonus of having the IBL in the background as well. For such a stylistic render, you might find a light blue color or a sky background looks better which is quite easy to set up too. In the Render -> Environment tab uncheck Visible in Background. Select the camera persp and open up its Environment tab. Here you can change the constant color of the background, but we'll create an Image Plane, so just click Create. You should get the Attribute Editor for

Page 9: Advanced Lighting in Turtle

the created Image Plane. Set Image Name to the texture bluesky01.png, found in the sourceImages folder of the example project. A slight Maya peculiarity that you might want to know about is that if you connect an Image Plane for the Camera, be sure to change the Display Mode in the Image Plane Attributes to RGB instead of RGBA; if the image has no alpha channel, it will still get modified by the luminance of the image, resulting in a darker image! To get the image to stretch to the resolution of the frame, select To Size for Fit in the Placement tab and click Fit to Resolution Gate. The current setup lets us try out some different light probes, but still use a provided backdrop, so go ahead and try out a few different light probes for the IBL lighting.

Uffizi

Galileo

1:35 min

1:49 min

Kitchen

1:21 min

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.

Page 10: Advanced Lighting in Turtle

0:31 min

Light Probe: UffiziFinal GatherGI Environment: IBL

In the Global Illumination tab, check Enable Global Illumination. Select Final 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.

Neat! Render times were cut down to less than 30% of the time compared to a full IBL render.

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.

0:17 min

Create a new Directional Light with Ray Trace Shadows enabled. Orient it so that it's shining down onto Bunnyman at an angle. Since we now have added a strong new light source to the scene we can decrease the contribution from the light probe, otherwise the image would be much brighter. So set Environment GI Environment → Intensity to 0.5, and render out a new frame.

Light Probe: UffiziFinal GatherGI Environment: IBLDirectional Light (sun)

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 NICA 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.

• Disable 'Preview Calculation Pass' for current GI technique.

Page 11: Advanced Lighting in Turtle

0:46 min

Light Probe: UffiziFinal GatherGI Environment: IBLDirectional Light (sun)1024x768

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.

Page 12: Advanced Lighting in Turtle

More Global Illumination

UffiziIBL Emit LightFinal Gather

UffiziIBL Emit Light(no GI)

UffiziIBL Emit LightFinal GatherPath TracingGI Environment is set

to None for all three renderings.

2:14 min

2:53 min

2:27 min

We'll take a look at one final scene, setting up photon mapping and caustics for an architectural scene. Open up archviz.mb and render out a frame.

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.

5 secDirect Light only

Page 13: Advanced Lighting in Turtle

TE CH NICA L NOT E

Final Gather, the not so gritty details

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.

• Contrast Threshold – This is the tolerance for contrast difference between sample points. Decreasing this will increases the point density in areas where contrast is high. This allows for higher detailed GI at the cost of longer render time.

• Interpolation Points – The number of points used in interpolations. Increasing this number yields smoother results at the cost of less detail and smeared indirect light.

• 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).

Final Gather Depth 1 Final Gather Depth 2

Page 14: Advanced Lighting in Turtle

We get quite a lot of splotches, so we'll have to tune the Final Gather settings. As can be seen in the Direct Light rendering above there are a lot of black areas and very few illuminated areas. To capture the small illuminated areas properly we need more FG Rays. So increase Rays to 1000. We can also increase the Interpolation Points from 15 to 25, which will smooth out the solution, removing any remaining splotches. Render out a frame!

10 sec

13 sec

Final GatherRays: 300Contrast Threshold: 0.1Interpolation Points: 15

Final GatherRays: 1000Contrast Threshold: 0.1Interpolation Points: 25

That's looking quite good already! If you take a look in Render Settings Options Framebuffer, you'll notice that Gamma Correction is enabled. Just to see the difference, uncheck Input Gamma Correction and set Output Correction to None. Render out a new frame.

Gamma Correction: On(Input Gamma: 2.2Output Gamma: 2.2)

Gamma Correction: Off(Input Gamma: 1.0Output Gamma: 1.0)

Page 15: Advanced Lighting in Turtle

It's looking quite a bit darker, and worse than the previous image with Gamma Correction enabled. The thing to remember though is that if we'd done the reverse, started out with Gamma Correction disabled, we'd have lit the scene so that it looked good in that case, then it would have looked bad when we enabled Gamma Correction. It is vital that you light your scene with the correct Gamma Correction for your pipeline from the start, because changing Gamma Correction late in the tuning of the scene will alter the whole intensity level and shading of the scene.

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.

Page 16: Advanced Lighting in Turtle

Primary Intensity: 1.0Primary Saturation: 1.0

Primary Intensity: 4.0Primary Saturation: 1.0

Primary Intensity: 4.0Primary Saturation: 2.0

Tweaking the Intensity and Saturation of the Primary and Secondary GI is a pretty fast way of changing the appearance of the GI solution. In this case we're merely boosting a one bounce GI solution, we can get a much lighter render by increasing the number of light bounces in the GI solution as well, and get more interesting lighting in the process. Change Intensity and Saturation values back to 1.0.

The quickest way to setup a multi-bounce GI solution is simply to use Final Gather also for the additional bounces. In the Final Gather settings, increase the Final Gather Depth. Set Depth to 5 and render out a frame. The image looks much brighter, since we now have 5 bounces of light.

13 sec 22 sec

22 sec

Final GatherRays: 1000Contrast Threshold: 0.1Interpolation Points: 25Depth: 5

18 sec

Page 17: Advanced Lighting in Turtle

Next we’ll be using Final Gather together with Photon Mapping, a setup which is very powerful for many scenes. Photon Mapping is very fast at calculating a large number of indirect bounces. However often it cannot be used as Primary GI for quality reasons. So we can combine it with Final Gathering, using Final Gather as Primary GI and Photon Mapping as Secondary GI. In the Render Settings Global Illumination, select Photon Map as Secondary GI. Also don't forget to reset Final Gather Depth back to 1, since we only want the first bounce of Final Gather now.

When using Photon Mapping, we must specify that light sources should emit photons. Select the Directional Light and open it's Attribute Editor. First we need to add Turtle specific GI Attributes to it. In the Attribute Editor's top menu, click Turtle and select Add Light GI Attributes. Now a new Turtle tab should appear at the bottom of the Attribute Editor (Turtle Global Illumination). Open this tab and enable Emit Photons. Then we must set the energy of the photons. This Photon Energy value is the one thing that will cause you the most headaches, since you have to tune this yourself. Leave it at 8000 and go ahead render out a frame.

The image is far too bright. By tuning it we find that using an energy of 500 will match our previous results pretty good. So set Photon Energy to 500 and render again.

By default the Photon Map is set to Cache Direct Light, see Technical Note below. To get more detailed and dynamic lighting we can disable this feature. FG rays will than always calculate high quality direct lighting.

TE CH NICA L NOT E

Cache Direct Light

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.

32 secPhoton Energy: 8000

Photon Energy: 500 12 sec

Page 18: Advanced Lighting in Turtle

Photon Energy: 500Cache Direct Light: On

Photon Energy: 500Cache 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.

Global Photons: 10,000 Global Photons: 100,00015 sec 15 sec

17 secGlobal Photons: 1,000,000

Page 19: Advanced Lighting in Turtle

There are actually two different Photon Mapping algorithms hidden away in Turtle. The default algorithm is called Grid Based Photon Mapping, which makes a slight tradeoff in quality for much faster render times. The second algorithm is called Standard Photon Mapping and is slightly more accurate. In the Render Settings Global Illumination Global Photon Map Advanced Settings, go ahead and change the Algorithm to Standard Photon Mapping. Go ahead and render out a frame.

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.

15 sec 36 sec

0:16 min

Global Photons: 100,000Grid Based Photon Mapping

Global Photons: 100,000Standard Photon Mapping

Global Photons: 100,000Standard Photon MappingPrecalculate Irradiance

Page 20: Advanced Lighting in Turtle

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.

TE CH NICA L NOT E

Light Leakage Reduction

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.

Indirect Spot Light Indirect Spot LightIndirect Ambient Light

15 sec12 sec

Page 21: Advanced Lighting in Turtle

As final icing on the cake, we'll add some caustics. Start by removing the two Indirect Light Sources. The Directional Light is already set to emit Caustic Photons by default, so all we have to do is open Render Settings Global Illumination and check Enable Caustics. Let's add some illumination from the sky as well for this final render, go ahead and open the Environment tab, and select Sky Light as GI Environment. Render out a final frame.

16 secFinal GatherPhoton MappingCausticsSky Light GI Environment

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!

Page 22: Advanced Lighting in Turtle

Get your eval license of Turtle now!www.illuminatelabs.com

• Final Gather

• Photon Mapping

• Caustics

• Sky Light Environment