» Back to Documentation

 

UNDERSTANDING DYNAMICS


Perhaps the most important part of any hair solution is a dynamics system . At the same time, this could be the most frustrating part of hair/fur making process because only at this stage do you actually have to bring something that didn't have to physically work into a simulator that is based on an assumption that it is simulating real-world phenomena. With experience one will discover that once you deal with dynamics a couple of times, your hair modeling process changes because you learn to avoid some pitfalls that can cost you stable simulation later on.

And that is exactly what makes working with dynamics frustrating sometimes: getting stable simulations. A stable simulation means that during every frame of it, all objects retain their real-world properties and don't become super-natural. It also means that the limits of your system's resources (processor, memory, floating point precision) don't interfere with the simulation. To get stable simulations you need to make sure that your hair state stays in the bounds of available resources and physically correct conditions. This article will show you some of the commonly used techniques to make it happen.

Let us begin by looking at how exactly does Ornatrix take guides and represent them as real-world objects that can interact with the environment and all other objects.

Initially guides in the scene are nothing more than linked lists of linear segments. The number of segments and their shape are controlled by user and thus can be arbitrary. Ornatrix' modeling system's goal is to preserve the basic information about the structure of these segments so they can be accurately used by the dynamics engine for simulations.

Guides, however, are only virtual objects that control the shape of hundreds of thousands of real hairs. Not only does the dynamics engine have to convert these guides into real-world objects, but it also has to do so such that every guide represents a large clump of real hair.

This is done by converting every guide segment into a 3d volumetric shape. All of the dense hair associated with that particular segment is then presumed to be inside this volume and the volume simply represent the group of hairs inside it (with equal mass, shape, etc). The volume object that Ornatrix uses is a capsule. As you can see on the diagram to the right, capsules are created for every segment and every two consecutive capsules always intersect thus forming one continuous volume from root to tip.

From previous diagram you could also see that the capsules were too thin, thus representing the actual hair volume around them quite poorly. Ornatrix has an option ("Auto-size wisps") to automatically resize these capsules when simulation starts so that they take as much space as possible without penetrating at the root during first frame.

From the picture on the left you can see how this option resizes the capsules causing them to wrap the surrounding hairs better thus making more realistic simulation. One array of these capsules (representing a strand) is referred to as a wisp. Wisps are a very important part of dynamic simulation because they are the only way of representing many hair in a from that simulator understands.

In some cases, when user specifies wisp size manually, or the automatic generation doesn't do a good job, you can get wisps generated in a way so that they initially penetrate each other. Because each single capsule is considered a separate body, wisps will start to push each other away to reduce the penetration amount. With many guides trying to push each other away you can get instability in the simulation. When wisps are extremely thick you can even get all capsules to penetrate every other capsule at the same time, causing the simulator to run of out memory very quickly.

The best solution is to keep wisps smaller than their optimal size rather than bigger. You will still get quite good results with thinner wisps and your simulation will be much more stable. Note, however, that generating extremely thin wisps will also terminate your simulation. Using wisps that are 0.01 or less units in radius can cause great instability in the simulation even if no collisions between wisps are used. That is caused by the fact that angular moment of inertia for every capsule becomes so big (or small) that it simply causes the simulator to lose its stability.

Aside from allowing mutual collisions between wisps and objects, Ornatrix also provides an option that allows collisions of a wisp with itself. This means that two capsules located in the same wisps can potentially collide. Every two consecutive capsules are automatically prevented from colliding by the simulator because they will always inter-penetrate (due to the nature of wisp's structure).

On the diagram to your right you can see one exception that can occur when your capsule radius is too large, or you segments are too small. The capsules that are separated by a segment between them still penetrate. The segment between them forces these capsules to stick together and attracts them with great force. Because these two capsules penetrate, however, another great force pushes them apart. These two forces get accumulated by the amount of overall such collisions happening between capsules and can quickly de-stabilize your simulation.

The best technique to combat this is to know what kind of radius you need your wisps to be in order not to penetrate, or not to use wisp self-collision at all.

To your left you can see the above problem being solved by reducing the radii of the segment capsules, thus removing any penetration that occurred previously.

Because the actual wisps aren't hard objects by nature (hair is soft and energy absorbent), collisions between them shouldn't prevent them from penetrating completely. Rather it should allow for a soft penetration while still trying to push the two wisps apart.

Ornatrix achieves this by allowing 'soft' collisions between wisps. At the same time it uses hard collisions between wisps and external objects. These softness parameters are completely controllable from within dynamics simulation parameters.

 

Incorrect creation and handling of hair wisps in Ornatrix dynamics engine usually causes almost all cases of instability. Therefore it is important to understand these concepts to troubleshoot your simulation and see what's wrong and how to fix it. Capsules are created from hair segments to represent hair as 3d objects which can collide with other hair capsules, or external objects. These capsules represent the volume of dense hair around them thus eliminating the need to run simulations on dense hair.

Capsules are allowed to collide with each other, but are never attracted to one another. It is therefore important that at the initial stage and throughout animation they aren't forced to penetrate too many other capsules because computing many contacts at once is a memory intensive process. It could be a good idea then to keep the capsule radii small, but making them too small is also a problem which can result in unstable simulations. The rule of thumb is- know how big your objects are in the scene, and if they're too small, make them big enough so you can set big enough simulation parameters.

It is a good idea to keep the overall hair scale around 1.0-100.0 units. Making units too small or too big can cause floating point errors. it is up to you as a technical animator to make sure that hair structure is physically accurate and will simulate well under the conditions that you have specified.