Archive for the ‘rendering’ 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.

This is a feature that was newly introduced with Max 2009 and is worth mentioning. Along with the render region, crop, and blowup options is a render selected button. Unlike the other options, this option is only located in the render frame buffer window:

-The Rendered Frame window in the top left corner (as long as you don’t have it collapsed with the Toggle UI button).

This option is a quick easy way to create a rendering of just certain objects while still being able to receive reflections lights and shadows from the scene. It’s useful for rendering dynamic animations of people moving, or that rug with tons of displacement.  Unlike, Selected, with the box on, mental ray only renders what is selected.

Before you render, be sure to hit the Clear frame buffer button (the X icon on the top left), so you don’t have anything else in your frame.

Then select the objects in your scene that you want to be rendered, switch the Area to Render mode to Selected, and hit render.

This is a great way to create masks or passes and blend them in your favorite compositing program. A couple of things to note: If you want the light information to be seamless with your beauty pass, be sure to save your FG and GI maps first.

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.

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.

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.
Ok. This one was a long time coming. There are posts everywhere on how to do an “animation” of a camera going through a static scene. I’ve got one on this website. The truth is, this is just static animation. The big question is: how do you achieve this with moving objects in the scene? This technique can be done in V-ray using the VRaySphereFade, but mental-ray has a different way to do this trick. I’m going to go through the magic steps to create a dynamic animation without flicker, without super high FG and GI settings, and without the outrageous render times.

This animation (200 frames @640×480)took 27 min to render with the following technique, even with my poor animation skills

It’s not uncommon to think that because you have objects moving in your scene, you have to calculate FG/GI for every frame. This is true and untrue. With this technique here, we will only have to calculate FG/GI for every frame only for those objects that are moving. This is done in two render passes.

I rendered my background scene (with my animated objects hidden), with the freeze GI/FG technique

Once you have the background animation rendered, go back to your scene and hide everything that was rendered in your background pass, and unhide your animated characters.

Then place a box to replace the scene. This box will project your background animation, and create a plate for the characters reflections and shadows to fall onto. Think of this box as an actors green screen room…it can be as detailed as you want it to be. If the characters are moving behind other foreground objects like a chair or shelf, these objects should be considered.

We will use the Matte/Shadow/Reflection material. Apply this material to your box. Under the Camera Mapped Background slot, click on the button next to the color swatch and choose Environment/Background Camera Map. Now under the Map slot, this is where we will place our already created background animation as our background plate. Choose Bitmap, then locate to the first image sequence. Be sure you have Sequence checked, then click Open. This will create an .ifl file for your sequence.

We will need an instance of the Environment/Background Camera Map so right click on the map and choose Copy. Now open the environment window by hitting 8. Click the Environment Map button and choose Environment/Background Switcher. To access the parameters drag an instance of this shader into an empty slot in the material editor.

On the Background button, right click and paste instance of the Environment/Background Camera Map. For the Environment/Reflections button apply the Environment Probe/Chrome Ball shader. Where it says Chrome/Mirror, you will need to place an image of a chrome ball of the scene…so of course I had to render a ball with a chrome shader in this scene. But this slot is where this image is placed, and is what determines the reflections in your character. I cranked up the multiplier to 5 to get a decent reflection.

Lastly we will create a Skylight in our scene. In the create tab, go to lights->Standard->Skylight. Place it anywhere. In the modifier settings choose Use Scene Environment.

Other things to note: The lights for your character should closely match the lights in your background. So for this particular scene I created a rectangular directional light to match the light from the windows, so when the teapot was in sunlight it cast shadows to match the background. You can change the exposure of your scene too to get the most accurate match. I would suggest to turn off GI, but keep FG on for your characters. In your Matte/Shadow/Reflection material, be sure that Receive Shadows, AO, and Receive Reflections are all checked to get the best results.

Whew! That’s it. This should get you a basic set-up for your dynamic animation to render. Unfortunately refractions aren’t supported, and doing scenes with glass can be tricky. But now you can render dynamic animations super fast.

Here’s the scene file to make sense of what I’m talking about:

Happy testing!

Have you ever spent hours texturing and lighting a scene, just to find out you need to change the textures on an object, and want to test the materials with the default lights after you’ve lit the entire scene? Before you add any lights in a scene, 3DS Max will render with its default lights. But once you add a light to your scene, the default lights are completely ignored. Even if you turn off your scene lights and hide them, you scene will not render with the default lights. Here’s a trick to test render with the default lights after you’ve added lights in your scene.

Lit scene

Render with default lights, after lighting

Start a new scene. First go to Views->Viewport Configuration. In the Rendering Method tab be sure under Rendering Options that Default Lighting is checked, and 2 Lights is selected, Otherwise, this will not work! Then hit OK.

Then in the menu go to Create->Lights->Standard Lights->Add Default Lights to Scene

Be sure that both Add Default Key Light, and Add Default Fill Light are checked. Also set the Distance Scaling to 1000.0 (this will allow the lights to work for a scene that is in any location with respect to the lights). Then hit OK.

Now your scene has the default lights in the scene. Save this file as your default lighting scene. Now you can merge these lights into any scene you want. After you have merged these lights into your complexly lit scene here is a checklist to be sure that when you render you are just getting the default lights:

•Turn off all of your Indirect Illumination (mental ray)
•Turn off any exposure settings you have (don’t worry, your settings won’t disappear)
•Open the Light Lister, and turn off all of your lights, except for the DefaultKeyLight and DefaultFillLight

Now when you render, your scene will be lit just as it was before you added any lights (even though you have all of your scene lights still there)! Of course when you want to render your scene with lights, then turn everything in the list back on, and turn off the Default lights.

Earilier I wrote about vray dmc glossy samples, so I figured I would do one with mental ray glossy samples as well.

This chart for mental ray takes the combination of samples per pixel vs. A&D material glossy samples.

You decide which one is best for the amount of rendering time. I also found it interesting to compare with the v-ray test and see what overall gave the best performance results.

Check out the pdf, and decide for yourself what are the best settings.

Here’s the max file (max 2008, mental ray) if you’re interested in the rest of the settings. I was using an hdr map, so you will notice a broken link to that map.

There’s alot of talk about what are the best sampling settings in v-ray, but without the results to look at. So I sat out to put together a chart to help me and others understand how to get the most out of the Adaptive DMC sampler in v-ray.

This chart takes the same 3D model with baked light calculations (irr. map and light cache), to keep the render times just for sampling. I compared the combination of the DMC min, max values with the materials reflection glossiness samples to see what would give optimum results.

I also went a step further and compared these settings while tweaking the global DMC Sampler adaptive amount with the noise threshold to get some interesting results.

Check out the pdf, and decide for yourself what are the best settings.

Here’s the max file (max 2008, vray 1.5 sp1) if you’re interested in the rest of the settings. I was using an hdr map, so you will notice a broken link to that map.

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

I’ve been itching to finally say something about this one. If a 3D rendering looks life-like, most likely it has this phenomenon somewhere in the rendering. Chromatic Aberration (CA) occurs any time light refracts from a lens in such a way to disperse colors. This is most obvious in high contrast areas like the image below.

Photograph of Disney Concert Hall

You can simulate this effect in max 2008 with mental ray by using the mia_lens_bokeh shader, and an image map with red, green and blue. Plug the image map into the custom bokeh map. The downside to using an image map is that it really slows down the Arch / DOF Bokeh shader. You will also have to change the samples from 4 to at least 8. I typically use a minimum of 64 samples for my final renders. Note that DOF is what causes CA, so you have to have some blur to get this effect…even if it’s a very small amount.

These were some tests I did to compare a rendering with and without CA. The difference is very small, but it makes it that much closer to what a camera is really doing.

There are also ways to do this in Photoshop after rendering. Plug-ins like PTLens are great at creating or fixing CA.

This is a phenomenon familiar to photographers and is one that I have been obsessed with over the last couple of days. Just recently I have tried to emulate the bokeh effect in my renderings. Simply put, this occurs when an object is out of focus, and a point of light happens to be much brighter than the surrounding points.

There is a very easy way to do this using Max 2008. There is actually a mia_lens_bokeh shader that Autodesk has developed. It’s one of the hidden shaders in architectural_max.mi file, and is useful for creating this type of depth of field as well as other effects such as chromatic aberration. You can unhide the shader by opening architectural_max.mi in a text editor and where you see mia_lens_bokeh, put a # in front of where it says “hidden”. Next time you run Max you will see this shader when you click on Lens shader in your render settings. Remember to drag it into the material editor (instance) to control the properties.

The depth of field in this example was quite extreme, but I was trying to demonstrate the effect. It is important to note that this effect doesn’t work if Enable is checked under Multi-Pass Effect on your camera. In other words, let the shader on the lens do the DOF work not the camera. It will also render faster. If you have DOF on, in your camera settings, the bokeh lens shader just works on-top of this…blurring the image too much. To get the blades to show, I had to crank up my sampling to 64.

  • Debby Winter: Thanks for this interesting article on SEO, I find it very important to provide a clear plan of action and to work with honest SEO consultants. When i
  • Daniel_82: Hello. Can you re-upload the file, or if you can send it to me at an email adress? Thank you.
  • Hotel empresarial: Hello, i want to add my website