» Back to Documentation

Optimizing hair pipeline: Basics

OPTIMIZING HAIR PIPELINE: BASICS

Most of the objects in 3d CG software consist of datasets and higher-order groups that bind these datasets into manageable and logical structures. In case of meshes these datasets are long arrays of vertices in 3d space and higher order structures are the faces and edges that exploit this array and provide structural information on how the mesh should be constructed from them. In here lies the whole advantage of using polygons over solids and voxel-based volumes. By moving individual vertices the topological (higher-order) structure doesn't change and thus you can deform the mesh into any shape without worrying about its integrity.

Ornatrix handles hair much the same way. The lower order vertex array is stored to define shape for every the sparse or dense hair structure (read more on hair approximation here). Then higher order structures which are referred to as roots are used to articulate this dense vertex array into strands. In order to manage hair Ornatrix utilizes many techniques to make it easier and more intuitive for the user to deal with the hair volume. These techniques usually require more data to be stored with the hair object. When reaching the end of modeling pipeline hair can multiply its count exponentially and thus this extra data can easily grow beyond what your computer can handle and form significant bottlenecks.


It is therefore very important to understand exactly when these techniques should be used and how to make their effect most optimal. The key is to keep the correct balance between RAM and CPU usage. One often comes at the expense of the other and render times can be affected greatly by a small disbalance. On one hand it is often possible to do many pre-computations and take off the burden from CPU by eliminating same calculations over and over again. With very dense hair models this can take up a lot of RAM and cause swapping which causes the CPU to read and write data to hard-drive. Not only is that slower than doing computations on the fly, but it can also severely affect the performance of any other applications in your OS session. On the other hand one can use minimal amount of memory and do all the computing whenever it is required. This is a waste of system resources since they are not used and very often by pre-computing and storing values it is possible to reduce computation by millions of times.

Besides automatically managing system resources Ornatrix allows you to have a lot of control over how much memory ends up flowing through the pipeline. If correctly understood this can save you a lot of time. The basic concept of controlling the hair pipeline is to place as many constraints on hair objects as you can. By eliminating information that you don't need you can cut off a significant part of 'wasted' information which doesn't end up getting used or can be easily ignored.


Further sections of this article are divided as follows:

Sparse-dense relationship - talks about many useful tricks of hair information inheritance by using strand approximation and control transfer.

Optional data - covers an advanced topic of optimizing memory usage.

Rendering - talks about potential rendering issues of different types of strands and how to avoid them.