POV-Ray : Newsgroups : povray.general : Hair-Modelling using Springs? : Re: Hair-Modelling using Springs? Server Time
5 Aug 2024 14:20:01 EDT (-0400)
  Re: Hair-Modelling using Springs?  
From: Peter Popov
Date: 4 Sep 2002 16:32:06
Message: <eopcnu0q4o8poi4l48nlcijcnpff1cau7q@4ax.com>
Tim,

no intend to sound discouraging, but making a physical model of hair
is a massive endeavor! If you can rent the DVD of Final Fantasy : The
Movie, I think there are some figures that show how really slow this
thing.

The problem is not simulating a single hair itself, this is more or
less trivial (well, doing it *efficiently* falls beyond the scope of
trivial :) )

The real problem is to simulate the interaction between several dozen
thousand hairs. Whatever shortcuts you take - bounding octree
optimizations, penalty functions, implicit integration and so on, you
end up with a *lot* of collision tests.

Well, for the case of a couple hundred hairs, this is not so drastic,
but still the basic unoptimized approach is a O(n*n) complexity one.
Add to that the segments that each hair is broken into and you get the
picture...

Now, to the point. I think you'd better leave any thoughts of springs
for the moment. The equations are just too stiff. Although hair is
somewhat elastic on tension, you'd better treat it as rigid. That is,
made of rigid segments joined with ball-socket joints. This brings the
problem down to simple IK with constraints or even better, penalties,
and this one is already not that hard to solve, CPU-time-wise.

I also suggest you separate the IK model from that that will be used
for rendering. By this I mean that you can go with a much lower
precision for the IK than that you will need for rendering. For
example, a hair can easily be simulated with 10 segments, but when you
render them, you can pass a spline through the joints and make them
1000, or use a sphere sweep. Using that precision for calculation is
pointless.

I will assume you have a basic idea how to implement simple IK, if
not, there are many tutorials on Ken's links that you can follow. I
recommend Hugo Elias' page. The model there sacrifices on physical
accuracy, but is really simple and really simply explained.

The next thing you would want to add are penalty functions. Think of
them as repulsion forces pushing the hair away from the sphere, the
plane and itself so that it doesn't intersect. Not much of a force,
rather a concept, because in pure IK forces are not really used.
Anyway, the penalty functions you will want to use will be based on
distance. Distance from a sphere is trivial, from a plane almost as
easy and as for a segment in 3D space, I can't tell you the exact
formula off the top of my head, but it's right there in the POV source
code - more precisely, in the blob cylinder component code.

Well, I guess not really the answer you expected, but I hope I gave
you enough hints to get you started :)

>Nontheless, I also need springs which pull nodes back
>together, as to keep a certain length for the hair.

This one I don't understand. Can you please clarify?


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.