POV-Ray : Newsgroups : povray.general : Hair-Modelling using Springs? Server Time
5 Aug 2024 16:14:11 EDT (-0400)
  Hair-Modelling using Springs? (Message 1 to 9 of 9)  
From: Tim Nikias
Subject: Hair-Modelling using Springs?
Date: 4 Sep 2002 13:38:08
Message: <3d764500@news.povray.org>
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] gmxde


Post a reply to this message

From: Peter Popov
Subject: Re: Hair-Modelling using Springs?
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

From: Fidel viegas
Subject: Re: Hair-Modelling using Springs?
Date: 4 Sep 2002 18:56:53
Message: <B99C4D69.3FE4%fidel.viegas@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] timnikias@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] gmxde
> 
>


Post a reply to this message


Attachments:
Download 'eg93.hair.pdf' (35 KB)

From: Andrew Cocker
Subject: Re: Hair-Modelling using Springs?
Date: 4 Sep 2002 22:25:50
Message: <3d76c0ae@news.povray.org>
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] artrecognitioncouk> wrote in message
news:B99C4D69.3FE4%fid### [at] artrecognitioncouk...
> 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] timnikias@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] gmxde
> >
> >
>
>


Post a reply to this message

From: Ken
Subject: Re: Hair-Modelling using Springs?
Date: 4 Sep 2002 22:33:53
Message: <3D76C36D.F40B38AD@pacbell.net>
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

From: Tim Nikias
Subject: Re: Hair-Modelling using Springs?
Date: 5 Sep 2002 00:29:04
Message: <3d76dd90@news.povray.org>
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] gmxde


> 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

From: Tim Nikias
Subject: Re: Hair-Modelling using Springs?
Date: 5 Sep 2002 00:32:22
Message: <3d76de56@news.povray.org>
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] gmxde


> 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

From: Peter Popov
Subject: Re: Hair-Modelling using Springs?
Date: 5 Sep 2002 02:41:11
Message: <jnudnu4v5eaqvtqe5vt8moamv8qmjio4v5@4ax.com>
On Thu, 5 Sep 2002 06:30:25 +0200, "Tim Nikias" <tim### [at] gmxde>
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] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Fidel viegas
Subject: Re: Hair-Modelling using Springs?
Date: 5 Sep 2002 12:22:07
Message: <B99D4271.413F%fidel.viegas@artrecognition.co.uk>
in article 3d76c0ae@news.povray.org, Andrew Cocker at
mai### [at] andrewcockercouk 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

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