There is a subject I wanted to add to my ramblings. What many people may know by now, is that 3D models tend to get stored as a mesh, and that additionally, the U,V texture coordinates of all the vertices - that are also known as points - are stored in the same place, as their X,Y,Z coordinates in model space. Hence, a mesh can be modelled. It's possible that people may not know, that hair can also be modelled.

The reason has to do ith the available graphics primitives. A mesh is often stored as a triangle list, in which each element is a set of three vertex-numbers. Well in addition to triangle lists, modern graphics cards support "line lists", each element of which essentially consists of only a pair of vertices. Hence, when modelling hair, much as triangles form a mesh, line segments can form a strand. What happens to make CGI hair seem more like hair though, is that we begin with a primitive set of strands, which are only an ugly-small number of line segments. These are called our "guide hairs". But then what our framework will do, is to generate a larger number of "population hairs", which do not need to be stored, but which are derived on-the-fly from our guide hairs. What all this does, is to increase the resolution in 3D, of the hair as it finally gets rendered.

One aspect of the video-clip, which plays for one second and which I attached below, that may be confusing however, is the fact that in today's environment, the generation of population hairs and Physics can be accomplished on the GPU, which could lead viewers to the conclusion that I must also have reached to this aspiration, and rendered this hair sample on the GPU - as has been shown elsewhere on the Web.

But alas, my hair sample here - and primitive Physics - were only computed on an earlier *CPU*, and entirely using the software named "Poser 6". Thus, this ability has been around for some time. As for the question of whether hair can be modelled, this translates into the question of whether the guide hairs can be stored in an actual model file. And while the answer with certain file-formats might be *no*, given the correct file-format, the answer is *yes*.

When hair like this is rendered with maximum GPU-acceleration, then our guide hairs are first hardware-tessellated (requiring DirectX 11 or OpenGL 4), and then a Geometry Shader derives the population hairs from the guide hairs (requiring Dx11 or OpenGL 3). And, if real-time Physics, as in 'Game Physics' are to be applied, then this is applied by the Physics engine *to the guide hairs*, not to the population hairs.

Further, when a Geometry Shader gets used, its output-type can also be a triangle-strip, in place of a triangle list. After the first triangle, a strip adds one new triangle per listed vertex, in a zig-zag topology. Likewise, a GS can output a line-strip in place of a line-list, so that after the first line segment, each new vertex adds a segment. This can be extremely helpful if adjacency information is required, as well as to compress a hypothetical file-type.

Eve has been playing with hair dye, but isn't sure if she got her copper-coloured hair right. Some people would say that this is too dark, but then again, the real colour of freshly exposed, pure copper would also be more red, than what gets quoted as "copper-coloured hair." Anyway, she's practical enough not to care, finally, if she really has hair that looks like enamelled transformer wire. Try holding up a fresh copper penny to the last frame of this clip.

One question which I was asking myelf, was If the framework we're given to work with does not support a Physics engine capable of animating hair modelled as line-strips, then most serious Physics engines nevertheless allow for cloth to be modelled, and for the simulation of cloth to take place on the GPU, through particles positioned at each cloth vertex. Such engines usually require a close adherance to one standard connection topology, between the vertices, which is established when the cloth mesh is "cooked".

And so my question at one point became, 'Could Hair be modelled as if it was Cloth?' And I found the answer was Yes. With PhysX 2.8.4 cloth, for example, each instance of cloth has stretch reistance and bend resistance. The bend resistance can be computed in a modified way through setting the NX_CLF_BENDING_ORTHO flag, which means that bend resistance is no longer just an additional distance spring.

Because the GPU has no trig or inverse-trig functions in its instruction set, I assume that the NX_CLF_BENDING_ORTHO flag causes this function to be computed:

cos_theta_C = (a^{2} + b^{2} -c^{2}) / ( 2 a b )

thereby finding the cosine of the angle at point C, instead of the actual angle, and to conserve either, by adding force along line segment c .

This approach could crash, if the positions of any two vertices would ever become exactly equal to zero, thus resulting in (a) and/or (b) to become zero, and causing a division by zero. But I feel that this situation can be made safe (for hair) by using the approach below:

However, because PhysX version 2.8.4 is *mainly* still based on DirectX 9, its use is to be discouraged for hair. DirectX 9 will prevent people from putting a Geometry Shader or a Hardware Tessellator. And then if higher versions of PhysX are used - i.e. v3.x.y - then additional operations *might* exist for explicit hair based on line-strips.

Dirk Mittler

Phone: (514)620-7732

e-mail: mdirk@sympatico.ca