MR Using the Physical Sun and Sky environment
Contents
Introduction
This tutorial covers the details of working with Mental Rays Physical Sun and Sky.
Documentation
Mental Images provides documentation that is available through the Maya help: Sun and Sky.
Requirements
Although the Physical Sky can be used with most shaders, it's recommended to use the Mental Images Architectural (mia) shaders to get the best results.
Rendering using either Final Gather or Global Illumination (or both) is mandatory.
Creating a Physical Sky
Open your Render Settings: use the button in the Status Line or go to .
Set Render Using to mental ray.
Make sure the mental ray plug-in is already loaded! Open
Open the Indirect Lighting tab and click the Create button for the Physical Sun and Sky under the Environment section. Notice the difference between legacy and standard. The TOI-pedia will use legacy tabs.
Maya will create all the required nodes. The settings for the Physical Sky will open in the attribute editor. In the origin, a directional light, called sunDirection will be created. Rotating this light will determine the direction of the sun rays. At render time, Mental Ray will create a matching sky (with a sun disk at the correct location) and the correct physical properties.
Settings
Sky settings
You can open the settings of the physical sky from the Render Settings. Go to the Environment section and click the link button:
The settings will open in the Attribute editor:
- RGB Unit Conversion
- Mental Ray uses a Physical correct light intensity of 127500 lux for the sky dome. As this would produce images that are way overexposed, Mental Ray corrects this using the Unite Conversion factor. The default is fine in most cases. Use the Tone mapper (mia_exposure_simple) that is created by default for fine tuning. See the section Color corrections on this page for details.
- Sun Disk Scale
- Size of the Sun disk in the sky. 1.0 would be accurate, but many prefer a slightly bigger sun disk for a more pleasing result.
A complete overview of these settings is documented in the Mental Ray docs, available through the Maya help: Sky Parameters.
Camera connections
The Physical Sky environment needs to be linked to your camera. When you create a new camera, these connections aren't made by default. You have to do that manually. Open the settings for the physical sky (see above).
- Update Camera Connections (button)
- When clicked, Maya will connect the Exposure control node (mia_exposure_simple) to any camera that was created since the physical sky was created (and thus isn't connected yet).
Sun settings
You can open the settings of the physicalsun through the Attribute Editor of the sunDirection/Directional Light, or through the Attribute Editor of the physicalsky. To do this select the directional light and open the Atribute Editor (ctrl+A). Switch to the mia_physicalsun# tab (# can be any number, in most cases: 1). Most of the settings are good by default for a simple render. Changing the default shadow settings can increase image quality
The settings for the Physical Sun open in the attribute editor:
- Shadow Softness
- Determines the softness of the shadows. 1.0 is physically correct. You could decrease the value to get less grainy (but also less soft) shadows without increasing render time.
- Samples
- Determines the accuracy of the soft shadows. The default of 8 may produce grainy soft shadows. Increase as needed, but this will also increase render time.
A complete overview of these settings is documented in the Mental Ray docs, available through the Maya help: Sun Parameters.
Color corrections (Tone Mapping)
Depending on your settings in Maya 2016 when you create the Physical Sun and Sky, the Tone Mapper mia_exposure_simple, will not always be automatically connected to the cameras that where present when you created the Physical Sun and Sky (with exception of the orthogonal cameras).
If you have legacy tabs in the mental ray Render Settings then the mia_exposure_simple node will automatically be connected to the existing cameras. If you have standard tabs in the mental ray Render Settings then the mia_exposure_simple node will not automatically be connected to the existing cameras.
Connecting the Tone Mapper to the camera
If the Tone Mapper is not automatically connected to the existing perspective and camera views in your scene. You can connect a simple Tone Mapper or a photographic Tone Mapper. Connecting the simple Tone Mapper will be explained.
Open the Hypershape. If the Work area looks messy click the Rearrange Graph to order the nodes in the Work area. If you don't see a perpShade or a cameraShape node in the Work area, open the Cameras tab in the Browser. MMB-drag any perspShape or cameraShape from the Camera tab to the Work area.
To make a connection between the mia_exposure_simple node and the perspShape node, find in the Create panel the mia_exposure_simple node under mental ray > Lenses. Ctrl + MMB-drag the mia_exposure_simple node to the Work area and drop on the top part of the earlier dragged persShape or cameraShape
If you've created cameras since, you need to update the connections of the mia_exposure_simple. You can use the Update camera connections button to do this automatically.
Configuring the Tone Mapper
The mia_exposure-simple node can be accessed in several ways. The easiest way is through your Hypershade:
Open the Utilities tab. You should find an overview of all mia_exposure nodes present in your scene. You can doucle-click the node or select it and open your Attribute Editor.
The mia_exposure_simple node has several settings. A brief overview:
- pedestal
- offset for the entire range (darken or lighten the absolute black)
- gain
- multiplication factor.
- knee
- value above which the range should be compressed
- compression
- compression ratio to squash the range that is compressed
- gamma
- gamma correction
For details on these settings, refer to Mental Ray Tone Mapper Settings.
Start of with the gain setting. If your render is to dark, increase its value. If it's too bright, lower the gain. You should aim to have the dark- and mid-tones rendered properly. You highlights may still be overexposed.
The increase the Compression setting to compress the highlights within the visible color range. Settings of up to 50 may be necessary. Increase the value in steps of 5-10 and make test renderings.
When very high compression settings are needed (>30), you may consider lowering the Knee value a bit. Decrease in steps of 0.05. Don't go below 0.5.
Finally you can use the Gamma to tone down your image (1.8) or make it more vivid (2.2 or even 2.4).
Textures and Tone Mapping
File textures may get washed out, because of incorrect gamma. By default, the mia_exposure_control applies gamma correction on the final image. Mental Ray expects file textures to be 'gamma neutral' (linear color space), which they are (probably) not. Chances are you've created them on a computer screen, which is normally in sRGB color space, with a gamma of 2.2. If the mia_exposure control corrects the final rendered image to the gamma you specified, the textures would get gamma-corrected again, which causes them to look washed out:
The left side shows a render without proper gamma correction, the right side shows the render as it is supposed to be, after proper gamma correction of the file textures.
The preferred solution: Enabling Color Management in Maya and setting the gamma value of your mia_exposure node to 1.0.
- You could change the Mental Ray internal framebuffer gamma and the Exposure control gamma,
- or you could gamma-correct each file texture using the Gamma Correct node in the Hypershade.
The first method is the easiest to implement:
- Open you Render settings, Quality tab. Find the Framebuffer section and open the Primary Framebuffer subsection. Set the gamma to 1/desired gamma, so 1/2.2 = 0.4545 for a end-result gamma of 2.2
- Set the Gamma of your mia_exposure_simple or mia_exposure_photographic to 1.00.
The second method involves creating Gamma Correct nodes in the Hypershade for each file texture and setting it to 1/2.2: 0.4545 for each color channel. This process can be automated using the MR Gamma correction MEL script. This will add gamma correction nodes to all file textures, counter-correcting them for the specified gamma, so the end result should look good.
Physical Sun and Sky Nodes
The Physical Sun and Sky setup uses several nodes. They are accessible in various ways. One unified way to access them all is through the Utilities tab of the Hypershade: