Monthly Archives: April 2013
**UPDATE** Maya 2016 makes these lights an integrated option using the create menu.
**Maya 2015 SP3 delivers the builtin_object_light shader and works correctly/stably with mental ray 3.12 Be sure and follow the other tips like turning off the shading engine until integration is done.**
One of the most requested features for mental ray has been an object, or mesh, light. This is a somewhat experimental feature since it’s not exposed it was not tested in the Maya Betas. *There has been some talk of crashes, but sporadic. The cause has been found and is up for a fix now in mental ray, thanks for the extra reports to find it. Also, be sure and select not to Export with the Shading Engine in the Shading Group node to avoid the naming emission irregularity.*
Lighting a space using Final Gather from self-illuminated objects can be tedious to tune and costly in render times. Typically you need large amounts of rays (accuracy) from Final Gather to achieve smooth lighting this way. You can see such an example below with accuracy set to 1024.
An object light is the ability to define a shape as a light source. This allows greater flexibility in lighting scenes where a physical object is better (like a neon tube sign) or more efficient for rendering than an emissive plane with Final Gather.
The ability to make an object into a light has been available in mental ray for a long time and in an .mi file it’s a simple line that tells the renderer that the object is a light.
mental ray also supports geometric area light sources for point lights, specified by the object keyword. Its first argument must be the instance of a single-group object that defines the geometry of the area light source. All points on the surface of the object will emit light uniformly. It is generally a good idea to keep the triangle count of the object as low as possible for maximum performance. The sampling rates usually have to be set much higher for object lights.
If you look at the .mel for the area light AEtemplates in Maya, you’ll see legacy code where this was accomplished at some point in the past but disabled. The usual reasoning is that object lights can generate a lot of noise in a render that is difficult to clean up.
mental ray 3.11 includes a new shader called the builtin_object_light that tells mental ray that the object is a light. This circumvents anything that might be required by integration to work.
There is no library file that is needed for this shader, e.g. .dll, .so etc. Since it is “builtin” you just need the .mi declaration saved in the include folder for the mental ray plug-in. You can copy the code below and save the file. Keep in mind you should save these scenes as .ma if you wish to maximize compatibility since there are no node IDs for this shader.
declare shader color "builtin_object_light" ( color "surface" default 1 1 1 1, light "light" ) version 1 apply material, photon end declare
I saved it in Windows here: C:\Program Files\Autodesk\mentalrayForMaya2014\shaders\include
Opening Maya (being sure it’s loaded under the Shader Manager).
You can now see the simple UI below.
The simple workflow is:
Assign builtin_object_light material to Object -> create area light -> attach area light .message to Light parameter of builtin_object_light shader. (This picture needs updated below, you should attach the transform, not the shape)
You will notice that the object light still follows the shape node rendering flags like cast and receive shadows. That’s why there is a ring shadow around the box. This is not particularly intuitive so you can turn off cast and receive shadows and render again.
For these examples I have the “visible” parameter of the Area Light On. This means the object light primary ‘look’ is controlled through the “shape intensity” of the Area Light and the light shader. If this option is off, the look is controlled through the builtin_object_light “surface” control.
I actually recommend you leave that parameter On when possible. Having the Area Light Visible set to “Off” causes direct reflection sampling of the light even if the object is still visible. Instead you should use the Shape Node Render Stats to control the visibility of the light like you would any object in the scene.
Below I have the walls of the box semi-reflective and moved the light so that it’s more obvious when it’s hidden.
Now I will turn off the primary visibility on the Shape Node as seen below.
Here is the resulting render:
So now you can control how the light is sampled and seen in your image.
Also notice that light shaders applied to the area light will work as well but may have unintuitive consequences. In some cases light quadratic falloff of the visible light and not just the light effect itself is noticed. This means as the light is scaled or moved into the distance, it will change primary intensity (its lighting effect remains the same).
Being creative with node networks will also allow you to do things like cutouts and transparency on a light as seen below. The light in the scene is a solid plane with a checkerboard attached as illumination as well as connected to a mib_continue to allow rays to pass through. The alpha of the light is also controlled in the same way. The box is left slightly reflective as above to show the reflection of the checkerboard on the back wall.
These options will also combine with the new Light Importance Sampling found in 3.11 for textured lights.
Light Importance Sampling (light IS)
Light Importance Sampling in mental ray 3.11 will allow mental ray to distribute samples more effectively on textured area lights.
Why would I use Light IS?
This means samples are more efficient when lighting a scene where you may have textured object lights or bounce cards using an HDRI as the light source. This is similar to the user_ibl shaders but is now a core feature, potentially applying to more light types in your scene through a global option. In this way, once it is integrated it will deprecate the user_ibl shaders.
The String Option: “light importance sampling” has three settings.
"off", default. Importance sampling is not applied.
"on". Importance sampling is enabled for rectangular and disc area lights with high emission variance, and for all spherical, cylindrical and object lights. This mode is useful for rectangular and disk light with uniform intensity. In this case the core will check to see if the light emission has sufficient variance (between light and dark) to justify light importance sampling (Light IS). Non-planar lights (like an object light for example) always compute for light IS. This also applies to planes being used as Object Lights despite being similar to a rectangular light. This means it is sampled for Light IS but may not make a difference in render quality if not textured.
"always". In addition to “on”, importance sampling is enabled on all rectangle and disk lights. This mode means Light IS is used even if the variance of the light emission is low and might be ignored otherwise. (An additional variance option exists if you want to tweak what is considered to be enough variance to trigger light IS)
There is also “light importance sampling precomp” string option with values of on or off. This option presamples lights (there’s some overhead before rendering) for lights with HDRI attached to them. This can reduce the variance (noise) in a final image. Take note your image might look slightly different with this option on. This option is a compliment to the settings above as it changes how the lights are sampled during the render but not required. Recommended if a lot of your lights are using HDRI or high variance textures.
All of the modes will present log output telling you if the lights you have are being considered for Light IS. If there is more overhead for sampling but your log tells you the lights aren’t using Light IS (not textured or not enough variance) then you might switch it off and render normally.
Take care that since the mayastate shader has not been updated to be aware of this option it will generate a long warning log with “unexpected ray” readouts.
This is a feature that will have more explanation at a later time since it is more involved.
Starting with 3.11, mental ray supports a shutter shape function ability for applying arbitrary exposure shapes to the shutter interval. This allows for motion blur that better matches film. While programmers can write their own functions, the built in trapezoid shape is good enough for most production needs.
Motion picture cameras use a rotary disc—a semicircular disk that spin in front of the film gate—as the shutter device. Light is only captured when the missing part of the disk exposes the film gate. This is referred to as the shutter interval. The portion of the complete circle that the disk is missing is referred to as the shutter angle. A shutter angle of 180˚ is considered normal for a motion picture camera. A larger shutter angle results in a longer shutter interval and more motion blur effect.
A shutter that is completely open for the entire interval would capture the most light possible and would be said to be 100% efficient. The physical nature of rotary disks means that the time it takes for shutters to fully open and close is non-zero. This results in less light being captured at the ends of the shutter interval. This softens the appearance of motion blur at its edges.
You can conceptualize shutter efficiency with a graph that plots exposure vs. shutter interval. An idealized shutter would correspond to a box shaped function on this graph. Real-world cameras have a more rounded shape that can be approximated as a trapazoid. The minimum efficiency of a trapezoidal function is 50%. Most real-world cameras are around 80% efficient.
Why do Maya cameras have a default shutter angle of 144˚ if 180˚ is more ‘correct’?
This is because renderers typically—and incorrectly—describe shutter exposure as being 100% efficient. Using a shutter angle of 144˚ with a 100% efficient shutter matches the total exposure of a real-world camera. That is:
144˚ × 100% = 180˚ × 80%
If you decide to apply an 80% efficient trapezoidal shutter shape to your scene, you may also want to adjust your render camera’s shutter angle to 180˚. This will give you a similar result to the idealized case, except now with more physically accurate (and visually pleasing!) motion blur.
I’ve released a new public render setting user interface for Maya 2014: mr-rendersettings_v0.4.zip.
- Native environment lighting mode integration.
- Exposed trapezoidal shutter shape function for more realistic motion blur. I’ll explain these settings in another post.
- Renamed “Contrast As Color” UI option to “Quaily As Color”. This is more consistent with current naming and is also more intuitive.
- Slight layout rearrangement to improve workflow.
- Moved Adsk specific shader options to legacy.
Feedback and comments are welcome. Please report bugs on on the google code page.
With the release of Maya 2014 comes changes to the integration of mental ray. Foremost is that mental ray is now a truly separate plug-in installation. This means Autodesk can support multiple versions with bug fixes in a release for Maya.
(You can find some of the changes to Maya 2015 here: Maya 2015 – mental ray changes)
Behind the scenes, Autodesk now shares the translator with nVidia. This move received quite a few votes on the Maya Feedback postings and we’re glad to see they have heard the users. This arrangement also happened very near the release of Maya 2014 so more needs accomplished, but for now we are excited to see nVidia ARC working to improve integration under Autodesk’s direction.
For users they will notice a new rendering UI. For those of you that have tried the community UI it will seem familiar. This is because Autodesk adopted a lot of the design from the community UI into 2014! Many thanks to those of you using the UI and testing it as well as Brenton, Corey, and Bart.
We hope this inspires the users to participate in other projects and Betas. Also notice the option for Progressive Rendering combined with IPR. For now, Maya does not use the correct API for Progressive so this is a first step. Future changes will undoubtedly bring its performance in-line with Progressive found in Standalone.
You will also notice the UI allows you to combine Final Gather and Irradiance Particles. This is useful for complex scenes. You can also combine these with a new importance scheme for Final Gather that we will touch on in future posts.
Many defaults through Maya have also been updated as well as the presets for rendering. A short list below:
- Unified Sampling Default Rendering Method
- Raytrace Primary Rays (from 2013)
- Gaussian 2.0 2.0 default filter and width (You should rarely find need for anything else)
- Render View defaults to 32-bit precision previews
- Default Framebuffer is now RGBA 16-half (float) (caveat: Still need to select OpenEXR instead of IFF or use the OpenEXR Production Preset. This is because Maya has no concept of OpenEXR if mental ray is not installed)
- Increased Raytrace Depths
- Raytrace Shadows ON by default in lights with depth 3
- EXR zips compression exposed
- . . .more
You will also see the beginning of some cleanup in other places like moving older materials to a Legacy area in the Hypershade.
In the next few weeks we’ll go over new features and how to expose them for use in Maya 2014. Such features include object area lights (mesh lights), Ambient Occlusion on the GPU, Final Gather Importance, and lots more as updates make their way to Maya.
It’s been some time since mental ray got a face lift in Maya and we’re more hopeful than ever at the changes that will come to rendering and all other facets of Maya.