This tutorial aims to demonstrate some of the workflows used to reduce render times when rendering tree leaves with Arnold. In this example we are using a Maya Paint Effects scene that has been converted to polygons. However, these techniques can also be applied to other types of geometry that involve opacity maps.
The typical workflow for Opacity is to connect an alpha mask to the opacity attribute of a Standard Surface shader (remembering to switch off 'Opaque' in the Arnold attributes for the leaf geometry.
Leaves with alpha map connected to Opacity attribute of Standard Surface shader
One way to speed up rendering of the leaves is to use the Ray Switch node. The Ray Switch gives us greater flexibility for including and excluding only the rays that we want to render. In this situation we do not need to include every shading aspect for each leaf. One workflow method would be to:
- Assign a Ray Switch shader to the leaves.
- Connect the Standard Surface shader which has the diffuse and opacity map to the Camera rays of the Ray Switch shader.
- Connect a different Standard Surface shader to the Diffuse Reflection and Shadow rays of the Ray Switch shader.
This way, only the Camera and Diffuse rays (using a simple Diffuse Standard Surface shader) are calculated which will speed up render times:
Ray Switch: 1 min 3 secs Without Ray Switch: 1 min 48 secs
Ray Switch: 6 mins 40 secs Without Ray Switch: 15 mins 47 secs
There is a workaround within Paint Effects that can avoid the issue of opacity altogether. Since the idea is to not have any texture-based transparency, the Width Scale will determine the shape of the leaf. The way to think about the texture is kind of a reverse envelope or lattice deformation of the Width Scale shape (which is half the shape of the leaf / half of the texture).
Below is an example of the workflow involved:
- Select the Paint Effects brush attributes (in this case strokeBirchBlowing). Go to Leaf Width Scale. This can be found under Tubes> Growth >Leaves.
- Draw a fairly detailed leaf profile, as long as there are not any undercuts.
- In an image editing program, use an alpha-less texture to match the shape of the leaf. The leaf texture needs to be scaled to the edges of the texture map so there are no gaps.
- Connect the modified leaf texture to a Standard Surface shader and assign it to the leaf geometry.
- Convert the Paint Effects brush to polygons and assign the Standard Surface shader to it.
Modified leaf texture assigned to leaf geometry with modified leaf width scale
Many thanks to Jonathan Richter for his assistance with this tutorial.