Mentalray: Physical Sky

This post is a “reblog” from my mentalray guru Jeff Patton. You can find this very useful tutorial on Jeff Patton’s website.

Here’s what Jeff Patton said:

I want to share a few tips for rendering architectural interior scenes with mental ray, using the mr Physical Sky and portal lights. These are some fairly specific tips that will hopefully allow you to achieve a smooth indirect illumination solution as well as control the intensity of the sun and other contributing lights.

I’m not going to start from the absolute beginning here. To get the most from these tips you should already be familiar with the basic fundamentals like how to add a daylight system to your scene, enable the photon target option on the mrSun, enable global illumination, etc.. If you’re not, then you’ll need to spend some “quality time” with the 3ds Max documentation/tutorials. With that out of the way, I’ll dive right in.

I’m going to use the Evermotion bathroom scene that shipped with 3ds Max a version or two back. At the end of this article I’ll post a link to my completed .max file for further reference.

I started by stripping any lights from the scene, hiding the window glass, and applying a single material to everything. That’s primarily so I can focus on the lighting tips for this article.

I then created a daylight system and let it assign the mr Physical Sky to the scene environment and assign the mr Photographic Exposure control.

I then edited the daylight system to remove the mr skylight. It’s not needed since I’m going to place portal lights at the windows. You can click the screen capture to view a larger version if needed.

From that point I added four portal lights to the windows (set to use the environment, not skylight since I don’t have one in the scene) and enabled GI (Global Illumination) & FG (Final Gather) and fired off a test render:

Notice the large spots/circles? You may want to spend time tweaking the GI settings or the mr Sun settings to try and remove these but that’s not the actual problem here. I’ll disable the mrSun and render again to show that it’s not related to that light source:

As you can see, the spots are still there even though the mr Sun is disabled. The reason I’m not getting a smooth GI solution here is actually due to the mr Physical Sky of all things. Notice all the white spots where the direct sunlight should be? That’s from the visible sun disk in the mr Physical Sky and picked up by the portal lights & FG. I prefer to remove that because if you don’t you’ll need a lot of sample to clear that noise, plus it of course adds to the direct sun light which can often become too hot/over-exposed.

NOTE: I believe that it’s also mentioned in the 3ds Max documentation that the mrSun shouldn’t be behind the portal lights. I assume for this reason or something similar. So hopefully this adjustment will allow you to place the sun wherever you want/need and still prevent these lighting artifacts.

To “fix” this problem I’ll instance copy the mr Physical Sky shader from the scene environment to the material editor to make adjustments. Here’s what the default sky looks like:

I will adjust the Disk Intensity and Glow Intensity values to 0.0 and decrease the sun disk scale from 4.0 to 1.0, although that doesn’t really matter when the disk & glow values are set to 0.0. The adjusted sky looks like this:

Now the super bright sun disk is no longer there. It’s now just a nice soft gradient that will play much nicer with your photons (GI) and/or final gather options.

I’m now ready to render again after making this simple change to the mr Physical Sky, and nothing else:

Yaay! No more big white circles/spots/etc…just some more easily fixed blotches due to the low quality FG settings I used in this test. So with that resolved I will now enable the mrSun, increase the FG preset to medium, increase the anti-aliasing (min:1 / max:16) and render again:

Not bad. It’s missing a small detail though, and that’s photons from the mrSun. Notice how cool feeling the image is? During my tests I prevented the mrSun from generating GI photons therefore I’m not getting any warm colored photons from the sun in this scene. Some may actually prefer this look since the sun photons are typically a lot stronger and can overpower a scene unless you manually edit it’s values. Here it is with the sun photons enabled (and adjusted, more info on that below):

It’s a bit warmer and brighter with those photons from the mrSun. In case you’re not sure how to disable photon generation on a light, here’s some captures to help explain that:

With the mrSun/daylight system selected, scroll down to the mental ray Indirect Illumination rollout. By default it’s configured to emit photons when GI is enabled via the “Automatically Calculate Energy and Photons” option. Uncheck that option and also leave the Manual Settings disabled and no photons will be emitted from the light source, in this case the mrSun.

Also make note that I have decrease the multiplier on the mrSun from the default value of 1.0 to 0.2. I did this because at the default value it often seems like the mrSun is just too strong (IMHO). It is quite powerful on the indirect illumination side of things as well and that’s why I have also decreased the GI Global Multipliers on the mrSun (also located in the mental ray Indirect Illumination rollout of the mrSun). I decreased the energy to 0.5 and the photon multipliers to 0.25.

If you don’t do this edit to the mrSun photon energy then the mrSun will generate most of the photons in the scene, unless you specify a number of photons in the manual settings. I know this may be somewhat confusing, that’s why I’m providing the scene file at the end of this article. I discuss it further in some of the gnomon videos I made a while back. But basically if you’ll open the mental ray message window and follow the information it generates as it prepares the scene you’ll discover how brighter light sources generate more photons than less bright light sources (as to be expected). However, I would usually prefer to modify that behavior a bit to achieve more even light distribution in my scenes. At the cost of physical accuracy I suppose…but hey, it’s all about getting the desired look no?

While I’m discussing all this, let me address another frequently asked question. Why do I have so much blue in my scenes? Simple answer, it’s because the sky is blue. The portal lights are picking up their color from the sky and the sky is blue in this case. What if I wanted less blue? Easy. There are controls on the mr Physical Sky for this. Just uncheck the “Inherit from mr Sky” option on the mr Physical Sky so that you can edit it’s settings.

In the Non-Physical Tuning parameters, decrease the saturation level as desired to reduce the intensity of the blue in the sky. You can also try tuning the kelvin values on the mr Physical Exposure control, but that affects the entire image which may not be desired. This only affects the sky itself and thus the color of the light produced by the portal lights.

Less blue as you can see…a little to flat for my taste so I increased the saturation to something like .35 for the final image:

I know that’s a lot to cover in a blog post, so HERE’s the file that you can download and explore. Sorry, I can only save back to 3ds Max 2010 format.

UPDATE:  Here’s an OBJ version of the scene for those not using 3ds Max.


White Balance in Mentalray

In this tutorial I will be talking about white point and white balance and their use in 3D space such as 3ds MAX and Mentalray.

First of all lets get better understanding of white balance and white point:

In photography and image processing, color balance is the global adjustment of the intensities of the colors (typically red, green, and blue - primary colors). An important goal of this adjustment is to render specific colors – particularly neutral colors – correctly; hence, the general method is sometimes called gray balance, neutral balance, or white balance.

See the full article here.

white point (often referred to as reference white or target white in technical documents) is a set of tristimulus values or chromaticity coordinates that serve to define the color "white" in image capture, encoding, or reproduction. Depending on the application, different definitions of white are needed to give acceptable results. For example, photographs taken indoors may be lit by incandescent lights, which are relatively orange compared to daylight. Defining "white" as daylight will give unacceptable results when attempting to color correct a photograph taken with incandescent lighting.

See the full article here.

As the Sun crosses the sky, it may appear to be red, orange, yellow or white depending on its position. This happens because the Sun light changes its color temperature. Color temperature is a standard method of describing colours for use in a range of situations and with different equipment. Colour temperatures are normally expressed in units called kelvins (K). Note that the term degrees kelvin is often used but is not technically correct (see below).

Image taken from here.

For our 3D scenes we basically have to define what color temperature of our lights are going to render as white. In the picture below (taken from wikipedia) you can see how in a same shot some light sources render as yellow the others blue. This happens because the color temperature for the scene is set somewhere around 4000K. Thus the light sources above 4000 are going to render blue, and the light sources below 4000K are going to render yellow. The match between the white point of the shot and the temperature of the light source is going to cause a white (or neutral) lighting.

So having said that, what's important to us is to define the white or neutral colors in our scene, depending on the light sources we are going to use (and our goals and desires for a scene lighting.

The Tutorial

In this tutorial I will be using a simple scene containing couple objects floating on a ocean surface. In the following scene I used photometric Sun and Sky (a daylight system for mentalray) to achieve a photorealism. Here are the start files you are going to need.

When you download this file and open it in 3ds MAX 2009 or up, and hit render (f9) you should get a result like the one above. You should note the light setups, the environment setups, and the daylight position.

  

Now you should note that the whitepoint for my starting scene is set to 7500. If you check out the "Color Temperatures in the Kelvin Scale" (the first diagram) you should understand that the temperature of the sun at noon is about 5000K to 5500K. Which means that IF your daylight source is up in the sky and IF your whitepoint is set to something about 5500K that should result in the render as a white (neutral) colors. This is important to know as a rule, and then we have to learn how to use it, and how to break it as an artist so we could get the desired results.

Here are the tweaking part of it. Here is the start render and its whitepoint prefs:


Without changing anything I will start progressively to increase the whitepoint just to examine the results:



As you probably notice, when we render our scene with higher value of the whitepoint we get a slightly yellowish shades to our render. That makes the render more like earlier in the morning or later in the afternoon when the sun is lower on the horizon and the light becomes a little more warmer.




Now we have something very similar to the lighting of a clear sky on sunrise or sunset. Naturally, you may come up with way better render and way better overall light setups, whats important for me to show is the nature of the whitepoint and its use for any given scene where you use a daylight system.

Lets try decreasing the whitepoint, just to see what happens. I will start with something lower than 7500K.



Decreasing the white point caused the blue shades to overcome. There almost no neutral light and colors in the render - its because the mismatching of the color temperature of the sun and the render output. This means you don't have a correct lighting in your scene. Of course, that's not necessarily bad, its just the truth. You as an artist should use the technology to create the desired output in the easies possible way for you.

Having said that, you could use your daylight system, its exposure control and the whitepoint prefs, in a various artistic ways to establish different mood in your scene, or simply to have a specific daytime, such as early in the morning, noon or night time.


For those of you who have more interest in the subject topic and would like to learn more you could check out the following great tutorial by Jeff Patton here.

Enjoy playing around with it!