Blender: transparent particles vs geometry

Rendering scenes with lots of particles can be quite expensive. I render trees quite often and these trees typically have their leaves implemented as a particle system with thousands (or several tens of thousands) particles.

When creating particles that resemble leaves or twigs you basically have two options. The most common one is to take a photo-realistic texture with an alpha channel and use this on a simple uv-mapped rectangle. Another approach is to model the leave or twig, with as little geometry as necessary, and use that as a particle. The uv-mapped texture could still be used but no alpha channel is used. The results can be almost indistinguishable:
 

(transparent texture on the left, real geometry on the right.)

Now the big question is, what is faster? Or to be more precise, what renders faster? (Because modeling a leaf or twig takes some time too, even is it is just a flat contour).

Short answer: using real geometry can save you about 20% or more render time compared to using transparency!

The setup

We used the Cycles renderer on Blender 2.79 throughout on a midrange system (4core/8thread i7 @ 4Ghz, 16GB ram, NVidia GTX 970).

We used trees with identical particle systems except for the actual particle objects. The particle objects were either a simple uv-mapped square or a very simple mesh. We made two variants: a simple circle and a collection of three circles. These two variants enable us two look into the effect of different transparent fractions (the one with the full circle is 4 - π r² ≅ 21% transparent, the one with the small circles is 4 - 3 *(  π r²/4) ≅ 41% transparent)










The transparent meshes are 1 quad each (2 triangles) while the real meshes are 12 and 36 tris respectively.
The materials were simple:
 
(Note that we still use an image texture for the geometry node for the color, but we ignore the alpha information)

The results

For all four variants we used identical trees with 2634, 6294 and 12252 particles and rendered them on the GPU with 32 samples and 8 transparent bounces:

That is a significant difference, almost 50%! The difference when rendering on a CPU is less but still pronounced:
Still up to 20% to gain!

The slope of all the lines is fairly gentle: doubling the number of particles certainly doesn't increase the render time, and this can be explained when you realize that more and more particles will be obscured by others so no rays will be wasted on them. The surprising bit is that there is (almost) no divergence between the large and small leaves, even though the small ones will let pass double the amount of rays. Maybe in a less dense setup this would happen, but here it seems insignificant.

Now the number of transparent bounces is a significant factor here. We left it at the default of 8. For transparent renders we really do need these bounces otherwise leaves that are obscured by other ones will not be visible through the transparent part if a ray traverses deep enough into the tree:
 
(1 bounce on the left, 16 transparent bounces on the right. Note the lack of see-through spots and general darkening for the one with very few transparent bounces)
Now when we render with real geometry the number of transparent bounces makes no difference:
For transparent geometry it matters a lot and we need at least 8 and maybe more bounces if we render dense particle collections like tree crowns. The image above is for GPU, the graph for CPU is similar in the sense that at 4 transparent bounces or more the mesh particles are significantly faster but at a lower number the picture is a bit muddled:


Conclusion

Whether rendering on CPU or GPU it looks like creating simple geometry to model the outline of particles is preferable to using alpha mapped textures. Your mileage may vary of course (my Blender 2.79 on an Intel i7-4790K @ 4.00GHz / NVidia GTX 970 combo might behave differently than your setup), but I expect the general trend to be the same.

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Very interesting! Thanks for taking the time to check this. It is good to know for the future since I will have quite a lot of particles in the project I am working on.

    ReplyDelete
  3. I'll take this one to the bank, always running into issues with transparent textures,

    cheers!

    ReplyDelete