Using Min Pixel Width with Care in Arnold

Posted by Shih-Chin on Thu, Sep 24, 2015

Keeping objects opaque makes Arnold render much faster. When we render a bunch of hairs, min pixel width is useful to make the hair look softer. However, if the min pixel width is not equal to zero, the opacity of hair ribbon would change subtly, and those ribbons are not always opaque anymore! Furthermore, according to the ribbon thickness measured in screen space at render time, we might surprisedly get different render results. Thus, special care should be taken to tweak this parameter under various circumstances.

Opaque mode is switched based on the thickness measured in screen space.
Tiny distance changes would make different results.

Min Pixel Width & Opaque

Min pixel width is used to resolve aliasing problem by enlarging the ribbon thickness and decreasing its shading opacity at the same time.

Min pixel width enlarges hair thickness and decrease opacity at the same time.

The opaque mode of ribbon from Maya hair would be switched off when:

  1. HairSystem:opaque is off, or
  2. HairSystem:min_pixel_width takes effect (i.e. the raster size of ribbon is smaller than min pixel width)
Download: ai_curve_mpw_test.ma

It’s not recommended to enlarge thickness of opaque ribbons by mix pixel width directly, because this would not keep ribbons opaque all the time. Besides, there is a potential pitfall which would increase the “depth complexity” of each ray. Since when a ray traces toward semi-transparent objects, it has to trace all the way through the scene to accumulate the shading color until the resultant opacity adds to one or the trace depth exceeds the transparent depth.

Depth Complexity

Suppose there are three semi-transparent planes covering a single pixel and AA is set to 4 (16 camera rays per pixel). If we use “depth complexity” to describe the potential traced depth of each ray. The sample pattern within a pixel might look like this:

Depth complexity = {gray: 0, blue: 1, green: 2, red: 3}

If we set min pixel width to one, each ribbon would always cover one pixel width at least. Then the depth complexity for each sample becomes three. In this situation, the worst case is all rays are tracing through three planes to compute the resultant shading color.

For production rendering, there are hundreds of thousands ribbons at least. Imaging we have plenty of nearly transparent ribbons covering a single pixel. Most rays would exhaust their transparent depth, and need more time to render each frame. The most surprising case is presented by Jesse Andrewartha in “Establishing best practices in raytracing at Sony Pictures Imageworks, p.18” [1]: 5% pixels cost 99% render time!!

Test Results

Image Size: 512x512

OpaqueMPWShadow RaysDiffuse RaysRays/PixelRender Time
on0.07402637477566967.850:19
on0.211952992026825142549.159:23
off0.03736741813250617205.742:55
Download: ai_hair_mpw_test.ma

Image Size: 1K

OpaqueMPWShadow RaysDiffuse RaysRays/PixelRender Time
on0.0315806972037965770.81:17
off0.015940730156561199217.8713:09
on0.217914042162032101240.4114:31
on0.5715261105139611571790.7552:47

Conclusion

For hair/fur rendering, it’s always a good exercise to expose hair density and width control to lighting artists. In addition, only use min pixel width for softness/anti-aliasing; hair thickness should be configured from HairSystem:width instead of min pixel width.

In the case of thick hair whose width is larger than the size of several pixels. If we want to make those thick hair translucent, it’s better to turn off the HairSystem:opaque and adjust the opacity from shader. Use min pixel width to switch opacity mode might not always get consistent results and have a potential pitfall which would increase render time dramatically.

References

  1. Andrewartha, Jesse, Søren Ragsdale, and Paul Beilby. “Raytracers and workflow: a production perspective.” SIGGRAPH 2014 Course Notes.
  2. Min pixel width from MtoA User Guide.

comments powered by Disqus