![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
I've been doing some work on creating furballs recently,
and I've come to the conclusion that I wanted to write a
script which places hairs, bends them according to
gravity, but also stays out of planes and spheres (easy
to implement, required for furballs) and uses springs
in order to have no hairs intersect.
Nontheless, I also need springs which pull nodes back
together, as to keep a certain length for the hair.
I don't want to run for animations yet, so I don't need
some magnificient code which I can run through animations,
just some code which can calculate some hundred strands
of hair, grow them from a sphere, and doesn't let them
intersect the sphere, themselves, and a plane underneath.
Any links, or formulaes for springs (both ways: nodes
getting too close, in order to move them apart, and nodes
getting too far off, in order to get them close enough together
to keep the length of the hair)?
--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmx de
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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] vip bg
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hi Tim,
I don't remember where I got this file, so I include it here. Have a look at
it. It may be useful to you. I didn't have the time to look at it properly
as I'm still trying to learn povray properly.
All the best
Fidel.
in article 3d764500@news.povray.org, Tim Nik### [at] tim nikias@gmx.de wrote
on 4/9/02 6:39 pm:
> I've been doing some work on creating furballs recently,
> and I've come to the conclusion that I wanted to write a
> script which places hairs, bends them according to
> gravity, but also stays out of planes and spheres (easy
> to implement, required for furballs) and uses springs
> in order to have no hairs intersect.
>
> Nontheless, I also need springs which pull nodes back
> together, as to keep a certain length for the hair.
>
> I don't want to run for animations yet, so I don't need
> some magnificient code which I can run through animations,
> just some code which can calculate some hundred strands
> of hair, grow them from a sphere, and doesn't let them
> intersect the sphere, themselves, and a plane underneath.
>
> Any links, or formulaes for springs (both ways: nodes
> getting too close, in order to move them apart, and nodes
> getting too far off, in order to get them close enough together
> to keep the length of the hair)?
>
> --
> Tim Nikias
> Homepage: http://www.digitaltwilight.de/no_lights/index.html
> Email: Tim### [at] gmx de
>
>
Post a reply to this message
Attachments:
Download 'eg93.hair.pdf' (35 KB)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hi Fidel,
I hope I'm not out of line by saying that this is the wrong group for posting
binaries. You
should cancel your post and repost the pdf file (although I'm not sure where a pdf
file should
go).
All the best,
Andy Cocker
"Fidel viegas" <fid### [at] artrecognition co uk> wrote in message
news:B99C4D69.3FE4%fid### [at] artrecognition co uk...
> Hi Tim,
> I don't remember where I got this file, so I include it here. Have a look at
> it. It may be useful to you. I didn't have the time to look at it properly
> as I'm still trying to learn povray properly.
>
> All the best
>
> Fidel.
>
>
> in article 3d764500@news.povray.org, Tim Nik### [at] tim nikias@gmx.de wrote
> on 4/9/02 6:39 pm:
>
> > I've been doing some work on creating furballs recently,
> > and I've come to the conclusion that I wanted to write a
> > script which places hairs, bends them according to
> > gravity, but also stays out of planes and spheres (easy
> > to implement, required for furballs) and uses springs
> > in order to have no hairs intersect.
> >
> > Nontheless, I also need springs which pull nodes back
> > together, as to keep a certain length for the hair.
> >
> > I don't want to run for animations yet, so I don't need
> > some magnificient code which I can run through animations,
> > just some code which can calculate some hundred strands
> > of hair, grow them from a sphere, and doesn't let them
> > intersect the sphere, themselves, and a plane underneath.
> >
> > Any links, or formulaes for springs (both ways: nodes
> > getting too close, in order to move them apart, and nodes
> > getting too far off, in order to get them close enough together
> > to keep the length of the hair)?
> >
> > --
> > Tim Nikias
> > Homepage: http://www.digitaltwilight.de/no_lights/index.html
> > Email: Tim### [at] gmx de
> >
> >
>
>
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Andrew Cocker wrote:
>
> Hi Fidel,
>
> I hope I'm not out of line by saying that this is the wrong group for posting
binaries. You
> should cancel your post and repost the pdf file (although I'm not sure where a pdf
file should
> go).
povray.binaries.tutorials would be acceptable.
--
Ken Tyler
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
About the springs:
If I only use springs to move nodes apart, they may
stretch and stretch and the distance between two of
them get too long.
That's why I needed the formulae for springs which will
tie two nodes together, using more force the more they're
apart.
About IK:
I know that my approach is kinda freaky, but my latest
algorithm made use of electrostatic repulsion (see some
recent animations in binaries), it was rather fast and needed
only few iterations to come to a stable state.
Using this method I wanted to tie nodes together to get a
hair, and then use the same repulsion system to avoid
intersections.
But I'll think about IK, though I'm not too happy with
the idea of dropping my first thought, I'd rather at least
try it if its worthwhile for at least some bunch of hairs...
Thanks for your detailed answer though!
Tim
--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmx de
> 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] vip bg
> TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Thank your for the resource, but sadly, I cannot
really grasp the idea. I'm no mathematician, and
didn't have enough math at the University yet as
to properly understand everything by first read,
but I'll see if I can work my way through...
Thanks,
Tim
--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmx de
> Hi Tim,
> I don't remember where I got this file, so I include it here. Have a look
at
> it. It may be useful to you. I didn't have the time to look at it properly
> as I'm still trying to learn povray properly.
>
> All the best
>
> Fidel.
>
>
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Thu, 5 Sep 2002 06:30:25 +0200, "Tim Nikias" <tim### [at] gmx de>
wrote:
>I know that my approach is kinda freaky, but my latest
>algorithm made use of electrostatic repulsion (see some
>recent animations in binaries), it was rather fast and needed
>only few iterations to come to a stable state.
Well, what do you think a distance-based penalty function is? :)
The idea behind using IK is that a) the computational overhead is
smaller than with real thread dynamics and b) you can more or less
make the system do any kind of haircut.
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vip bg
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
in article 3d76c0ae@news.povray.org, Andrew Cocker at
mai### [at] andrewcocker co uk wrote on 5/9/02 3:26 am:
> Hi Fidel,
>
> I hope I'm not out of line by saying that this is the wrong group for posting
> binaries. You
> should cancel your post and repost the pdf file (although I'm not sure where a
> pdf file should
> go).
Sorry, I guess I posted it to the wrong newsgroup.
Thanks for the reminder.
Fidel.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |