Monthly Archives: October 2011
Unified Sampling
For the layman, unified sampling is a new sampling pattern for mental ray which is much smarter than the older Anti-Aliasing (AA) sampling grid. Unified is smarter because it will only take samples when and where it needs to. This means less wasted sampling (especially with things like motion blur), faster render times, and an improved ability resolve fine details.
Technically speaking, unified is Quasi-Monte Carlo (QMC) sampling across both image space and time. Sampling is stratified based on QMC patterns and internal error estimations (not just color contrast) that are calculated between both individual samples and pixels as a whole. This allows unified to find and adaptively sample detail on a scale smaller than a pixel.
Advantages of unified sampling:
- Fast ray traced motion blur. Also motion blur should be smoother and require less memory.
- Fast ray traced depth of field.
- Better at picking up small geometry and detail.
- A foundation for future rendering techniques and materials.
You SHOULD use unified sampling. Here is how…
How to Enable Unified Sampling (Prior to Maya 2014 without the Community UI)
Unified sampling is not exposed within Maya but can be enabled and with string options.
“unified sampling”
- Enables or disables unified sampling.
- boolean, defaults to false
Note: You should use “Raytracing” with regular and progressive unified, NOT the default of “Scanline” (Render Settings > Features > Primary Renderer). This is because the scanline mode is old, deprecated, and none of the cool kids are using it. Switching to raytracing from scanline can take minutes off your render while reducing memory usage. Using “Rasterizer” with unified sampling enables the unified rasterizer.
Unified Controls
In addition to performance improvements, unified sampling simplifies the user experience by unifying the controls for various mental ray features including progressive rendering, iray, and even the rasterizer. For regular unified and progressive unified, you basically just have one control that you need to consider: Quality.
“samples quality”
- This is the slider to control image quality. Increasing quality makes things look better but take longer.
- It does this by adaptively increasing the sampling in regions of greater error (as determined by the internal error estimations mentioned before).
- You can think of quality as a samples per error setting.
- Render time increases logarithmically with “samples quality”.
- Generally leave it somewhere between 0.5 (for fast preview) and 1.5. 1.0 is deemed “production quality”. You can go higher (or lower) if the situations demands it. Possibly values are 0.0 and above.
- scalar, defaults to 1.0
Additional Controls
“samples min”
- The minimum number of samples taken per pixel.
- Set to 1.0. Don’t change this unless you have a pretty gosh darn good reason.
- Using a value less than 1.0 will allow undersampling. This could be useful for fast previews.
- This is only a limit. Use “samples quality” to control image quality.
- scalar, defaults to 1.0
“samples max”
- A limit for the maximum number of samples taken per pixel.
- The default setting of 100.0 will generally provide you with a large enough range of adaptivity for production work. Some situations, such as extreme motion blur or depth of field, may require more than a hundred samples per pixel to reach the desired quality and to reduce unwanted noise. Setting “samples max” to 200.0 or 300.0 in these situations can help.
- This is only a limit. Use “samples quality” to control image quality.
- scalar, defaults to 100.0
“samples error cutoff”
- Provides an error threshold for pixels that, when error falls below this value, mental ray will no longer consider.
- This is only useful for scenes with very high quality values (like 3.0+) where areas of low error are still being sampled/considered.
- In general, use “samples quality” as the sole method to control image quality and leave “samples error cutoff” at 0.0 (disabled).
- If you choose to use this setting, set it to a very low value like 0.001.
- scalar, defaults to 0.0
“samples per object”
- Allows you to override “samples min” and “samples max” on the per object level.
- If enabled, overrides are set under the mental ray section of each object’s shape node.
- “Anti-aliasin Sampling Override” is the override switch
- “Min Sample Level” sets “samples min”
- “Max Sample Level” sets “samples max”
- Note: these values have different meanings for unified sampling than they do for AA sampling. i.e. a value of 3 corresponds to 3 samples per pixel, not 2^(3*2) = 32
- boolean, defaults to false
You can learn more about using Unified Sampling in the Unified Sampling for the Artist post.
Additional Notes
When unified sampling is enabled, mental ray will ignore certain settings:
- The AA settings (ie min sample level, max sample level, anti-aliasing contrast) are ignored because you are now using the new unified sampling pattern.
- Jitter is ignored because unified is inherently QMC jittered across image space.
- With motion blur enabled, time samples/time contrast (these are the same setting) is ignored because unified is also QMC jittered across time. You still need to set motion steps for motion blur.
Quality and error cutoff can be set to per color values for RGB. This is probably overkill for 99% of situations. If you wish to control per color values, you can adjust the string options to look something like this:
- “samples quality”, “1.0 1.0 1.0”, “color”
- “samples error cutoff”, “0.0 0.0 0.0”, “color”