Archive for the ‘final gather’ Category

Many folks have asked me to do an in-depth interior lighting tutorial.  The question you’re probably really asking is “how do you light an interior scene that renders quickly?”  To achieve this, it is more art than science.  To get quick render results you have to take shortcuts and cheat a little to get those fast results.  I’ll show you how I set up lighting for my interior scenes.  I’m assuming that the scene has already been textured.  Just a warning, my technique is not physically accurate by any means, but it renders quite fast and is a useful method for a fast production turnaround.  Disclaimer: This is not a tutorial for someone who is just learning Max (there are plenty of those out there), so I’m assuming that you know your way around the software.

Here is an outline of how I setup my lighting in my scenes, and I broke it up into 8 steps:

1. Create Daylight System (allow mr Photographic Exposure, and mr Physical Sky)
2. Set exposure Preset to Physically Based Lighting, Indoor Daylight
3. Turn OFF Final Gather (FG)
4. Turn ON Global Illumination (GI)
5. Tweak and save .pmap file, switch to Read Photons Only from Existing Map Files
6. Turn ON FG, create interior lights (photometric lights, mr Sky Portal)
7. Save .fgm, switch to Read FG Points Only from Existing Map Files
8. Turn off mr Sky Portal (optional), and render image

1. Create Daylight System

This one is fairly straight forward.  The settings that are most important for my sun are the ones that affect orientation.  Because every scene is different, orienting your sun to get the most light into your windows is key, and will help keep your render times down.  Even though simple, the North Direction / Time of the day and year are perhaps the most important factors in creating a well lit render.

2. Set exposure Preset to Physically Based Lighting, Indoor Daylight

Setting my exposure to the preset default of interior daylight gives me a good benchmark to know what to tweak my lighting against.  If you don’t have your exposure set up correctly, you could be cranking the lights up till the cows come home.  Having the proper exposure ensures that your light settings are within somewhat physically accurate ranges.

3.Turn OFF Final Gather

This is done due to the technique in using the combination of FG with GI.  GI is calculated first, then FG uses the light from GI to create a more efficient FG map.  Think of GI as the primer, and FG as the paint color that goes on-top of the primer.

4.Turn ON Global Illumination

This is really the first step in tweaking the lighting.  Once you turn on GI, this is what I get with the default settings:

The default setting is actually pretty good, and works for most scenarios.  However you will notice that you can see the photon disks on the geometry.  Typically you can leave it at the default setting because it usually gives the optimum lighting amount.  But I’ll explain how you can tweak GI to get rid of the disks if they really bother you.  But if you’re not interested in this portion, you can skip straight to step 6.  The disk visibility can be corrected by adjusting the Maximum Sampling Radius.  In mental ray if this setting is turned off, GI, by default, creates photon disks that are 1/100 of the scene size.  This is typically usable for most scenes, however sometimes the disks are too large or small for the rendering.

5.Tweak and save .pmap file

So the first thing I change for GI is the Maximum Sampling Radius.  I turn it on, and start with a small radius and work my way up.  As I increase the radius, I also increase the Average GI Photons per Light, just slightly.  The goal is to achieve a bright-even face on the geometry without getting changes in color on the same surface.  Any artifacts that are noticeable from GI will affect the way FG is calculated, so it’s important that the GI map is smooth.

Maximum Sampling Radius: 1’
Average GI Photons per Light: 20000

So out comes the photon disco ball you may have seen in other renderings.  What you are really seeing are 20000 photon disks at 1’ in radius.  There are really two approaches to getting a good GI solution from this point.  You can keep the radius at 1’, and increase the Average GI Photons per Light to crazy high numbers.  This could give you a smooth result with nice detailed soft shadows, but can take a very long time to calculate.  Rather, I prefer to increase the radius size until they overlap large enough to get a smooth result.  Then I turn up the Average GI Photons per Light, but not so high to make my GI calculation times go through the roof.  There is no one solution.  Play with the combination of settings of the radius size and photons per light count until you get something that looks reasonable.

Maximum Sampling Radius: 5’
Average GI Photons per Light: 20000

Maximum Sampling Radius: 10’
Average GI Photons per Light: 20000

Maximum Sampling Radius: 30’
Average GI Photons per Light: 20000

Maximum Sampling Radius: 30’
Average GI Photons per Light: 40000

Maximum Sampling Radius: 30’
Average GI Photons per Light: 60000

Maximum Sampling Radius: 30’
Average GI Photons per Light: 80000

Maximum Sampling Radius: 4’
Average GI Photons per Light: 2000000

For this scene I chose to set the Maximum Sampling Radius: 30’ & Average GI Photons per Light: 40000 was the best solution for what I was trying to achieve.  This number of photons was just enough to smooth out the disks, but setting it any higher would just darken the image more.  Interestingly enough, it seems to be very similar to the default GI settings.  I also rendered one with Maximum Sampling Radius: 4’ & Average GI Photons per Light: 2000000.  You’re probably wondering “if the settings are so high, why is it darker?”.  The lower setting images are brighter because they are taking a sample of a color and spreading it out 30’ in every direction.  So if a sample is taken just on the outside of the wall where the sun light is very bright, it will spread that color 30’ out and perhaps inside the building.  This is why the early results are in no way accurate, but give us the results we need.

Once you’re happy with your GI map set it to Read Photons Only from Existing Map Files, and click Generate Photon Map File Now, to save it to a file.
6.Turn ON FG, create interior lights

Now that you’ve saved your GI map, we’re ready to create the FG map.  But before calculating the FG map, I create all of the lights that will be present on the inside of the building.  So all the fixtures, wall sconces, can lights, etc….I create photometric lights for all of them.  I also create mr Sky Portals for significant windows.  In this scene I have 2; 1 on the left store-front, and 1 in the back.  These sky portals help focus the FG map where we want it to go. I try to keep most of my lights at their default values so they may render accurately.  For the photometric lights depending on the Shape/Area Shadow settings, you can have some really long render times.  Try to keep the Emit light from (Shape) to Point, and use the other shapes (Rectangle, Disc, etc) sparingly as they increase render times drastically.

As far as FG settings, I usually set the FG Precision Presets to Draft believe it or not.  I leave most everything else at their default value. Often I change the Noise Filtering from Standard to None.  This allows mental ray to use all of the FG bounces rather than dropping some of them to smooth it out.

7. Save .fgm, switch to Read FG Points Only from Existing Map Files

When you’re happy with your FG map, under the Reuse rollout, switch Final Gather Map to Read FG Points Only from Existing Map Files, then hit the Generate FG map button.  This will save it to a file, much like the GI map.  Another trick I do is to render the FG map at 50% of the actual render.  So if my render is going to be 1600 x 800 pixels, I generate a FG map at 800 x 400 px.

8. Turn off mr Sky Portal (optional), and render image

Now that you have your FG map saved to a file, we can create our render.  Another trick/time-saver: You can turn off the mr Sky Portals (yes another cheat).  So when the scene renders it is using a FG map with light information from the Sky Portals, but it’s not actually rendering those lights with their shadow samples. This is just to save rendering time.  If you can afford to leave them on, then do, but to get a fast rendering out this is a great shortcut.  At this point you can go back to your exposure settings and tweak them if the image is too bright or too dark.
This is my typical process for getting interior renders from a scene.  I usually go one step further and render an ambient occlusion pass, and add it to the rendering in Photoshop.  There I play with levels, color corrections, and other things to beautify the image.  There are so many other ways to do this with the same tools that you can tweak along the way to get your rendering right.  Rendering is a give and take process as well.  The more bells and whistles you add, the longer it will take to crank out, so it’s about finding that happy medium of time vs. quality. But in the end it’s all about an image that you’re happy with.

You have no idea how often I see this question in forums. The truth is there is no good general settings. But, I have listed here GI (global illumination) and FG (final gather) settings that I use often and work for almost any interior scene. I’m focusing on interior scenes because they are much more difficult to achieve than exterior. These settings give generally good results with fast render times, and I’m only mentioning the settings that I change from the default.

GI:
I set the Maximum Num. Photons per Sample to 100. This is so low because I also use a low number of photons per light. There is no need to shoot so many photons per sample when I am using such low photons per light. The important thing to consider when calculating GI is being able to light the scene evenly, and get a consistently lit space.

I also turn on Maximum Sampling Radius. I start with something small like 1’ and increase the amount by 5’ until I get a generally smooth result without seeing any discs in the rendering. Often I will go up to a value like 30’ before I get a smooth result. This is not a typical use for GI, and in a way it’s cheating your photons to get bright values with such low numbers so the render times are fast.

FG:
I slide the FG Precision Presets all the way to the left to Draft setting. I’ve found that I can get away with low FG settings if I add an occlusion pass later in post.

For Diffuse Bounces I set it to 4 typically, just to I can get enough bounce and increase my light values. Changing the bounce number significantly reduces rendering speed so be careful with this one.  However if you’re using GI, this value is ignored because it’s getting its bounces from GI.

I didn’t change this setting, but I’ll mention it. I sometimes change the Noise Filtering from Standard to None, if I can get away with it. When set to None, the render is much brighter because you are taking into consideration all of the FG points, but at times will have noise. When you set it to Standard the scene is much darker, but smoother generally. So if you can set it to None and still get smooth results, then you just got more light into your scene for free.

That’s it. Those are my “standard” settings. Of course I will use the Read/Write options for both GI and FG, and typically calculate them at half the resolution of my final render. These settings don’t work for every scene, but they were used for this rendering:


The lights I had for this scene were a sun/system, and 33 photometric lights at the default settings. The only thing for the photometric lights that I adjusted was the intensity. I change it by checking the % and increasing it, that way I can always go back to the standard 1500 cd. All of these lights were on when calculating GI and FG. Once my lighting is calculated, and I’m reasonably happy with it, then I get to my exposure settings.

It seems like alot of folks on the forums are asking this question. Often when using low GI and Final Gather settings, an animation will flicker because the solution is not refined enough. To have a smooth animation you have to crank up your settings high enough to have similar results for each frame. Problem is you will have extremely long render times. This is my attempt at explaining how to create smooth animations with low indirect illumination settings in Max 2008.

common problem with low GI and Final Gather settings

Here’s a quick step-by-step, but if you read further I have exhausted each of these steps in detail.

•Turn on Photon Map, use Read/Write File, then render
•Turn on Final Gather, use Read/Write File
•Lower samples to 1/64 – 1/64
•Render active time segment at every 10 frames
•Turn on final gather Read Only (FG Freeze)
•Increase samples to 1 – 16
•Turn on Save File for Render Output
•Render active time segment at every 1 frame

First we calculate the photon map (PM). When calculating the PM it’s a good practice to have final gather (FG) off to see the pure PM results. To save your PM click on the […] button, and if you are rendering on a renderfarm, be sure to save your PM in a location that the farm has access to (your network). Also be sure “Read/Write File” is checked.

Now go ahead and render a single frame. Mental ray will calculate the PM first, save it to the location you specified, then renders your scene. Very important to note: now the second time you render, mental ray will not re-calculate the PM, but rather read the already calculated PM from the file location you specified because you have “Read/Write File” checked. The PM is scene based rather than view/camera based. This means that when the PM is calculated it is calculating the entire scene (much like radiosity). The great thing about the PM, is that once it is calculated, a rendering can be done from any view using that same PM…wonderful for animations!

Now that we have our PM calculated, we’re now going to move onto FG. Unlike the PM, FG is view/camera based. This means that when a FG map is calculated the information in the map is only of that viewing angle. So if you wanted to see both sides of an object, you would need at least 2 FG maps. This is very bad news for animations. Because every frame in an animation is different, you would need a new FG map for that frame. But we have a work around for this that I will get to.

For now:
•under FG check “Enable Final Gather”
•for the Preset choose Draft
•under Final Gather Map click on the […] button, and choose a location to save the FG map.

Be sure “Read/Write File” is checked and “Read Only” is not checked.

Now to get back to our problem of needing different FG maps for every frame. Instead of creating a FG map for every frame, I create a FG map for a range of frames. For example, if my animation is 100 frames long, I will render every 10 frames creating a FG map for only those 10 frames. Then with that combined FG map, will go back and render every frame. Here’s how to do this:

Make sure FG Map is checked on. Then in the Renderer tab, lower your samples to 1/64 – 1/64. We are doing this, because we are not concerned with the actual rendering, but just the calculation of the FG map. In the Common tab, change your Time Output to Active Time Segment, and under Every Nth Frame change it to 10.

Now click Render. You will get a warning that pops up telling you that you are rendering a sequence without saving the images to a location. That’s ok, because we are just interested in FG at this point. So click Yes. Now the animation will render every 10th frame. Because we have “Read/Write File” checked and do not have “Read Only” checked, every time FG for a frame is calculated it is added to the previous FG map. After all 10 frames render, you now have a single FG map for your animation sequence.

Now go back to Indirect Illumination tab, and under Final Gather Map check “Read Only”. Now when you render, it will not add to your already created FG map, but just read the one that it’s locating to. Also increase your samples back up to something reasonable (1-16), and change your “Every Nth Frame” back to 1. Also be sure to set your Render Output to save to a file location.

That’s it. Click render and enjoy!

Animation using PM and FG from file

Now it will start the rendering right away without calculating any indirect illumination. Even though the solution for PM and FG are low, it’s not that noticeable. The noise will be even less noticeable when texture are added. Note: this technique doesn’t work well for secondary animation (animation with moving objects or characters).


Kategoriler