Pixel Hair Revised

This document is about the idea of pixel-based hair.

First, I will explain how the traditional hair works:

  1. Attach a guide curve to each vertex of the mesh.
  2. Each triangle has three guide curves.
  3. Split the triangle into a number of sample points.
  4. Grow a hair curve from each sample point. Direction of growth is the weighted average of the three guide curves, based on the sample’s barycentric coordinate inside the triangle.

Being a straightforward way to create lots of curves by a much smaller number of guide curves, I think most existing hair tools are using this method. Because guide curves are attached in each vertex, I’d call it vertex hair.

So why bother developing another method for this? Because vertex hair is not good enough. Where to put the control curves totally depends on the topology of base mesh. Sometimes the mesh is so dense there are too many control curves, which is hard to handle. Sometimes the mesh is so sparse there is not enough control curves, not enough details. Sometimes the base mesh must be changed, ruining existing grooming, which could be very unpleasant.

So I come up with the idea to set the control curves free from the mesh. This is how it works:

  1. Control curves are independent form the mesh. They can be placed anywhere on it.
  2. Split the triangle into points as usual.
  3. For each sample point, search all control curves for the three nearest ones that form a triangle around it.
  4. Grow the hair curve like before .

For example:

Random colored control curves

Samples colored by closest control

Hair visualization with a bit noise

The problem is we must find the 3 controls for every sample. This slow process can be cached by a texture. Split the mesh in ST space, so each sample will have a ST coordinate. Do the search, then save the result (3 id and 3 weight) to the relevant texel. Next time when create the hair, probably of a different density, we just look up the texture by sample coordinate to retrieve the result, avoiding the search. So I call this method pixel hair.

The search seems to be the tricky part. I found it is slow and hard to get correct result. So there is another idea: reverse the process. We already have the ST coordinate of those controls, so form a mesh using Delaunay triangulation. Dicing this mesh instead of the base mesh in 3D, we can achieve correct sample-to-control relationship and smooth interpolation of sample weight, without searching!

Control mesh formed by Delaunay method and samples diced in ST

What is the advantage? Those control curves do not depend on the base mesh, so they can be placed more efficiently. Just more controls around the area of interests to get more details, and ignore the area has no hair. Smaller number of controls means easier to handle and faster to do dynamics. Those control curves are just a low-density version of the hair, so it might give better control and more reasonable preview.

Advertisements

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s