MR Using the Physical Sun and Sky environment
This tutorial covers the details of working with Mental Rays Physical Sun and Sky.
Mental Images provides documentation that is available through the Maya help:.
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.
Creating a Physical Sky
Set Render using to Mental Ray.
Open the Mental Ray tab ans scroll down to the section Environment:
Click the Create' button for Physical Sun and Sky
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.
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: .
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).
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 press 'ctrl+A'. Switch to the tab mia_physicalsun# (# 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.
- 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:.
Color corrections (Tone Mapping)
When you create the Physical Sun and Sky, the Tone Mapper, mia_exposure_simple will 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'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:
- offset for the entire range (darken or lighten the absolute black)
- multiplication factor.
- value above which the range should be compressed
- compression ratio to squash the range that is compressed
- 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. The mia_exposure_control applies gamma correction on the final image. Mental Ray expects file textures to be 'gamma neutral', which they are (probably) not. Chances are you've created them for a gamma of 2.2 or so, which is the default for computer screens. 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.
There are two main methods to solve this problem: Change the Mental Ray internal framebuffer gamma and the Exposure control gamma, or gamma-correct each filetexture.
The first method is the easiest to implement:
- Open you Render settings, Mental Ray 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 to 1.00.
Alternatively you could use the MR Gamma correction MEL script to correct the gamma. 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: