Author Archives: bnrayner
Normal displacement is displacement relative to the surface normal. Heres a quick tutorial for using normal displacement with Mayatomr.
- Base mesh (created by down-res’ing a high-res reference mesh)
- Normal displacement map (exported with values that match the base mesh to the reference mesh)
Open Maya; import base mesh; apply material shader. Typically your base mesh will have a low poly count:
From the material’s shadingEngine, attach a displacement shader.
shadingEngine > Shading Group Attributes > Dispacement mat. [map button]
Select the “File” node from prompt and load the correct displacement map. Note: Maya automatically creates a displacementShader between the shading group and the file node. Because normal displacement only requires a scalar (greyscale) value, the file node connects to the displacementShader via it’s alpha channel. “Alpha Is Luminance” has also been enabled so that the alpha is the average of the RGB channels. Set the file node’s Filter Type to Off.
file > File Attributes > Filter Type = Off
This is important because you do not want Maya to try and interpolated displacement samples. If you render now, you’ll get an interesting looking result.
The reason the image looks like this is because the displacement map is only 8-bit. Mental ray expects negative values to be inward displacement, positive values to be outward displacement, and zero to be neutral displacement. Because 8-bit images only map to positive values (0.0 to 1.0), the sculpting application has exported a displacement map where 0.5 corresponds to neutral. Offsetting the alpha by that amount (subtracting) will adjust for difference.
file > Color Balance > Alpha Offset = -0.5
You will most likely want to leave Alpha Offset at 0.0 for 32-bit/floating-point displacement maps (depending on how it was exported).
The mesh still does not match. Here’s why:
- The base mesh still has hard normals causing the displacement to open up seams as it pushes the surface outward.
- As soon as you attach a displacement shader, Mayatomr “helps” users by applying a length-distance-angle approximation to the polygon surface. This is not ideal.
We can fix both these problems by turning the mesh into a Catmull-Clark subdivision surface (ccmesh). Using the approximation editor, apply a parametric subdivision to the surface. By default, applying this approximation triggers Mayatomr to export the object as a ccmesh.
Window > Rendering Editors > mental ray > Approximation Editor
mental ray Approximation Editor > Subdivisions (Polygons and Subd. Surfaces) > Create
mentalraySubdivApprox > Subdivision Surface Quality > Approx Method = Parametric
The seams have closed up, however the mesh has lost all detail. The shadows look particularly bad because of the low triangle count. Increasing the number of subdivisions will bring back detail. To match the reference mesh, set N Subdivisions = N(reference) – N(base), in this case 5 – 1 = 4.
Lower N Subdivisions result in a loss of detail.
Larger N Subdivisions may cause visual artifacts as you exceeded the resolution of the displacement map (displacement map pixels become visible).
Unfortunately, normal displacement is inherently limited in the geometry it can describe. For modern workflows (and the my next blog post!) use vector displacement.
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.
I’ve updated the public mental ray UI for 2013. One big change is native environment lighting mode integration.
If you have any feedback or bug reports, please post them on the issues page 🙂
Please note this does not currently work for SAP as Autodesk has altered a .mel file.
You can find the original post here.
You can find the initial release UI for Maya 2014 starting here.