2010-07-01

Efficient Interior Lighting with mental ray



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)
7. Save .fgm, switch to Read FG Points Only from Existing Map Files
8. Turn ON mr Sky Portals (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 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.

A little about filtering your FG map:  If you calculate FG with no filtering, when you render there is no need for  mr sky portals.  If you calculate FG with standard filtering, then when you render you will want to use mr Sky portals.  Both of these methods will give you the same lighting results.  The first technique (no filtering) gives you faster lower quality results.  The second technique (standard filtering) will give you slower, better results.

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 on mr Sky Portal (optional), and render image


Now that you have your FG map saved to a file, we can create our render.  Now you can turn on the mr Sky Portals if you rendered with a FG map that has standard filtering.  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.  If you can afford to have them on, then do, but to get a fast rendering out you may want to forgo having these lights on, and use no filtering when calculating your FG map.  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.

60 comments:

  1. That was a great tutorial. Finally,someone has explained very simply how the photon disks should look (overlapped) before you applying FG. I would always get a dark and dirty solution and it would take forever to render. Thanks for that.

    ReplyDelete
  2. ,, Can you post some technique or tricks how to make my textures look good and realistic?...,because that is my only problem on how can I have a realistic render..

    Thank You So much, GodBless You

    ReplyDelete
  3. please sir Ramy,, Can you Gave Us a trick or a Way how to texture different kin of materials, because I am using sketchup max( Like What You are Doing un Your Models) and then texturing them in 3ds max,, but you are so great, please help us/me and the sketchup max users on how to make a realistic texture,, because whe I Render Mu Model(Assuming that It has been Textured)It does not look Good(Unlike your models from Your slide show).. :'(... Please help me/us,,, I'am Begging You......

    Thank You So Much......

    ReplyDelete
  4. on step 8. Turn off mr Sky Portal (optional), and render image, this can be a mistake. Basically, their only function during FG processing is to block fg rays to prevent double illumination. During rendering, they then cast illumination. What you suggest here eliminates the reason why you would have put sky portals in all togheter.

    ReplyDelete
  5. Pierre-Felix,
    I have never been sure what exactly happens with the FG calculation when FG interprets mr Sky Portals. But I have found that having mr Sky Portals on during FG calculation makes my FG maps brighter. If you can prove me wrong please let me know.

    ReplyDelete
  6. .. Ramy, what Kind Of Textures and material are you using?

    ReplyDelete
  7. Hello Ramy, nice blog, a lot of useful things to discover and to learn.
    bookmarked

    ReplyDelete
  8. nice idea to decorate the room by the lighting effect

    ReplyDelete
  9. Ramy,,. What is he Use of Render Element?...How often you are using that?...Can it Make MY render Output looks realistic?....thanks

    ReplyDelete
  10. EDIT: Pierre-Felix Breton pointed out that having mr Sky Portals on during FG seems incorrect. After doing some research I've edited this post to be correct.

    ReplyDelete
  11. I have a question,,,how did you change your material\texture from sketchup to 3ds max?.. will my materials\texture affect or change if I will use all color white diffuse in my all materails?...I mean, if I will use a brick texture under A&D material then what should be the diffuse color?....or the appropriate diffuse color for certain textures?......thank you so much for the help,

    ReplyDelete
  12. I salute you..!!!,,, I always look at your photostream,,, wow, almost everyday,,. You are a great sketchup\max user......GOD bless You

    ReplyDelete
  13. ramy,,, are you using after effects for both animation and 3ds stills?....using After effects to make your 3ds stills realistic?....thank you

    ReplyDelete
  14. what if I've already created my interior lights and I need to go back in my GI and tweaking up my setting, so i need to turn off again my FG.?!,, It mean I will delete again all my interior lights?.,,or I should just unchecked it from light listener,,unchecking my lights from light listener equivalently means turning them off?.. or just hiding them in your scene?....thank You again Sir...

    ReplyDelete
  15. 1. go to this post to understand materials from SU to Max:

    http://3dsmaxrendering.blogspot.com/2008/09/sketch-up-to-3ds-max-does-work.html

    2. I do use After Effects for post work in animations and stills....Sometimes I use Composite 2011 (comes with Max 2011!)

    3. Just turn off your lights, and re-calc your GI. Unchecking your lights in the light lister is like turning them off. If you hide your lights and they're still checked on, they will still render though.

    ReplyDelete
  16. thank you so much....it's clear to me now

    ReplyDelete
  17. so,, what particular things you are doing inside after effect in your stills?,,,,.. and how often you use after effects in your stills?...,, is it like an sketchup-Max?..Max-After effects...., thank you

    ReplyDelete
  18. for example, in particular scene of holibrook elementary school, did you used an after effect for that to make it more realisic?.

    . thank you for sharing that knowledge..

    ReplyDelete
  19. . wow, nice new post rendering from your photostream,,,..did you used after effect in your 3d stills?...or what other softer did you used to beautify the Image?...thank you for sharing us tricks and techniques..

    ReplyDelete
  20. ramy,, can you also post technique for "efficient EXTERIOR lighting rendering with mental Ray"?.....thank you, I know your Fan and Viewers need that tutorial from you,,, thank you..

    ReplyDelete
  21. ramy,, can you tell me what scene or model that you apply after effects for some post work in your 3d stills?..thank you again

    ReplyDelete
  22. Nice render! Nice idea! Congrats for this image!

    ReplyDelete
  23. sir ramy I have a question concerning also about my exposure control "Understanding Cameras for Rendering!".. my question is when should I play or tweak for those values in exposure control, is it after or before computing my GI or after/before computing my FG?....,, when should I start playing with it?...thanks a lot

    ReplyDelete
  24. what is the purpose of using an After Effect in your stills?.......Thank you very much

    ReplyDelete
  25. exposure should be the first thing you set before getting into lighting. If it's an interior space during the day then use "Physically Based Lighting, Indoor Daylight". etc.

    ReplyDelete
  26. Hi- Thank you very much, have been searching for a tutorial like this with no success for a long time. Would you mind sharing the settings you used for your photometric lights, especially the square fluorescent lights. I have been having trouble getting lights similar to this to show correctly. Much appreciated, thanks.

    ReplyDelete
  27. ramy,, is that already your final render image?...why is it different with your other rendering which looks much realistic?..... thanks

    ReplyDelete
  28. because I often take the image from max into a program like Photoshop and change the levels, curves, etc. to make it look pretty-er!

    ReplyDelete
  29. ramy I have a problem regarding with your turorial,,,, after texturing and Going through the step One, the render time is so long and the mental ray message will appear..., why?...thanks.

    ReplyDelete
  30. Check your sample settings (on the material side & renderer side)...that they aren't too high.

    Also check that you're GI & FG settings are not too high.

    ReplyDelete
  31. Hi Ramy,

    I may be missing a step, or just read incorrectly, I don't understand how you used the GI pmap to help speed up the FG render...
    Do I have to do anything special to the pmap file? It just seems like I'm simply refering to a pregenerated FG map file during FG render and ignoring the GI map file... help please!

    ReplyDelete
  32. the pmap doesn't speed up the FG calculation, but it improves the FG map quality. After calculating the pmap, save it to a file, and choose read pmap only. Then when FG is calculated it uses the pmap from disk to "help" with the FG calculation.

    ReplyDelete
  33. ramy,, can you post your final render of that image which looks more realistic?....like in your photostream images.. thank you

    ReplyDelete
  34. Ramy,, What Kind of setting (under the Exposure Control oF mental ray) you are using in Exterior rendering?.....and what kind of sky?..I mean the Clouds that looks real,,,thank you Very much

    ReplyDelete
  35. ramy I'm jus asking You regarding with that Image Above,, is that the PSES?one of PSES scene that you have posted in Video?.....Woow.. You are Soo great!!!!

    ReplyDelete
  36. how to reduce the number of polygon from the imported sketchup model?.....Thank You

    ReplyDelete
  37. ramy I have a problem in my Global illumination,,,When I turn it on,, The rendering time (Calculation of photons) is Sooo slow,,I waited for almost 30mins,,and the rendering progress did not moved,, and still in 6.7 percent....even I already change d my samples setting on both materials and render settings... how can I solve It?.....Thank You so much

    ReplyDelete
  38. Hi. I just want to thank you for this written tutorial. It is very well complimented by the Lighting Interior Spaces video that I bought from Gnomon. That made undertanding the whole process very clear with lots of great tips as well.

    I am really looking forward to your post-production videos that you mentioned. When might they be available for purchase?

    Akem

    ReplyDelete
  39. what is the purpose of using the mr sky portal?

    ReplyDelete
  40. -For slow GI:
    try turning interior lights off. That can speed up GI dramatically.

    -mr sky portals:
    They are for focusing FG at areas where the portals are. With mr sky portals, often GI is not needed. You also get nice soft shadows with the portals.

    ReplyDelete
  41. ramy , i have a Question, concerning with your KHS model,,(wow that is so amazing!),,what application did you used to model that?...is it the same model for the exterior and interior renders?....thanks!

    ReplyDelete
  42. Thanks for the kind words! It was modeled in SketchUp, imported into 3ds max for texturing and lighting. It was rendered with mental ray, and post work was done in After Effects. The interior and exterior are two separate models.

    ReplyDelete
  43. ...wow,,,,I salute you ramy,,We are hoping that you post some tutorial on how to achieve those kind of realistic rendering,,, Thank you very much for being kind to us...GodBless

    ReplyDelete
  44. ramy ,,what particular setting of the interior lights you are using?...and also for all of your post-work,concerning with their lights,?....thanks

    ReplyDelete
  45. ,,Ramy i have a question About texturing,, what is the purpose/meaning of the"numerical expression evaluator"?and whare can I Find It?,,,,thank you very much

    ReplyDelete
  46. Hi Ramy.

    How is the name of music that you used in your project CS High School?

    ReplyDelete
  47. where i gt the 3d file of the scene....?

    ReplyDelete
  48. Thanks for the marvelous posting! I definitely enjoyed reading it, you happen to be a great author.I will be sure to bookmark your blog and will eventually come back later in life. I want to encourage you to definitely continue your great posts, have a nice morning! Flos Archimoon

    ReplyDelete
  49. Hi there and thanks for this interesting and important post.
    Lighting

    ReplyDelete
  50. hi ramy, is it possible to see photon distribution without rendering the scene? ( when i calculate GI map, it seems i have to render the scene as well to see the photons).

    ReplyDelete
  51. Zafer,
    no it's not possible to see photon distribution without rendering.

    ReplyDelete
  52. Hey Ramy,

    Awesome blog, loving it and learning tons from you. I have a question with this process, I guess I should preface this by saying I am new to 3DS Max but not new to Sketchup and 3d modeling. So during this process once you have set your GI Map file and your Final Gather file, can you go back to your lights and change the intensity? Would you then need to create a new Final Gather Map File?

    Thanks your keeping an awesome blog, look forward to seeing more of your work.

    ReplyDelete
  53. Chris, you don't "have" to. But if you don't the GI and FG maps will be read from your old lighting setup, you will might get some weird un-realistic results. However if it works for your scene, there is no problem with doing that if you have GI and FG maps that you're happy with.

    ReplyDelete
  54. Hello Mr.Hanna,

    In some of the previous replies you mentioned GI is often not needed when mr Sky Portals are on. Usually when i use mr sky portals, they cast shadows with "visible" edges, or not as smooth and soft as i desire, since they do not provide an option to soften their own shadows. Does GI help the shadows to be even more softer, or is there any way how to achieve that? Im currently trying to make a render of an interior scene lit just with northern light (a room with large window facing north). Northern light means gentle, soft, indirect light. Generaly speaking, my aim is, wheather is it possible or not to simulate such a light conditions by using GI and gently side-illumination (with PM light,or Sky portals). Hope you did understand, im not american nor english. Any reply or hint would be highly appreciated. Juro "Jaybe" BiroŇ° ;)

    ReplyDelete
    Replies
    1. For an ideal situation, you can try GI & FG with the mr sky portal all together. I've noticed that these work well together visually. Hope that helps.

      Delete
  55. please post a tutorial about Efficient exterior Lighting with mental ray & its material creation?
    try to resolve problem against how can you show photo realstic your exterior?
    please send your post on gracehofp@gmail.com

    ReplyDelete
  56. i need your suggestion about
    can mental ray give more realstic effect in render from v ray in 3ds max?
    please post a tutorial about Efficient exterior Lighting with mental ray without v-ray ?
    Can you post some technique or tricks how to make my textures look good and realistic?Because that is my only problem on how can I have a realistic render
    thanking you ...grace hofp

    ReplyDelete