POV-Ray : Newsgroups : povray.general : Sphere sweep along the surface of a sphere Server Time
31 Jul 2024 16:24:22 EDT (-0400)
  Sphere sweep along the surface of a sphere (Message 1 to 5 of 5)  
From: quickfur
Subject: Sphere sweep along the surface of a sphere
Date: 23 Jan 2007 21:55:01
Message: <web.45b6c979c55022a1dd5364bf0@news.povray.org>
Hi all, I'm making a simple model of a creature for my scene using CSG, and
I'm having some trouble modelling the creature's eyelids. Basically, I'm
using a sphere_sweep object to model the eyelids, and I want the eyelids to
lie on the surface of a sphere. I have 5 spheres in the sweep, 3 of which
lie on the sphere and the first and last are adjusted by a macro that
models (or tries to) different eye expressions, interpolated by
cubic_spline. How do I mathematically ensure that these two "control
points" are placed so that the resulting sphere_sweep object always lies on
the surface of a sphere? (Well, actually, half sunken into the sphere since
all I'm doing is modelling the bulge along the edge of the eyelids.) I can
hand-adjust specific cases of the eyelids to make this happen, but I'm
making a little animation and want this to be automatically handled by a
macro.

Also, there is the harder question of how to create the right shape (given
the parameters that specify the sphere sweep) to subtract from the sphere
to make the eye socket so that the eyeball inside is visible. Any help
would be appreciated. Thanks!


Post a reply to this message

From: FrogRay
Subject: Re: Sphere sweep along the surface of a sphere
Date: 25 Jan 2007 03:45:01
Message: <web.45b86c226bfe8377e57578bd0@news.povray.org>
"quickfur" <qui### [at] quickfurathcx> wrote:
> Hi all, I'm making a simple model of a creature for my scene using CSG, and
> I'm having some trouble modelling the creature's eyelids. Basically, I'm
> using a sphere_sweep object to model the eyelids, and I want the eyelids to
> lie on the surface of a sphere. I have 5 spheres in the sweep, 3 of which
> lie on the sphere and the first and last are adjusted by a macro that
> models (or tries to) different eye expressions, interpolated by
> cubic_spline. How do I mathematically ensure that these two "control
> points" are placed so that the resulting sphere_sweep object always lies on
> the surface of a sphere? (Well, actually, half sunken into the sphere since
> all I'm doing is modelling the bulge along the edge of the eyelids.)

I would suggest looking up the trace command (yes it can be a bit tricky at
first but look at the povray posts about trace if you get completely
bewildered).  You would need to use this once for every element in your
sphere sweep unless the area where your eyebrows meet the face is
relatively flat - in that case you could use it once for the entire sphere
sweep object after you have created it.  Doing it this way, I imagine that
you could get your curve correct in the y-direction (looking directly at
the face) and then use the trace function on the individual array elements
to set the z-location (where eyebrow touches face) of each point.
I have never tried this so I'm not sure if moving the points in the
z-direction will throw the whole curve out..but it's worth a try.
If this idea is feasible, hopefully someone can expand on it or explain it a
bit clearer.

> I can
> hand-adjust specific cases of the eyelids to make this happen, but I'm
> making a little animation and want this to be automatically handled by a
> macro.
>
> Also, there is the harder question of how to create the right shape (given
> the parameters that specify the sphere sweep) to subtract from the sphere
> to make the eye socket so that the eyeball inside is visible. Any help
> would be appreciated. Thanks!

As far as the eye sockets are concerned - I'm not why you need a
sphere-sweep here but I may have misunderstood the problem.  Can you not
simply CSG-Difference two sphere shapes out of the main sphere?

All the best for your animation!


Post a reply to this message

From: quickfur
Subject: Re: Sphere sweep along the surface of a sphere
Date: 26 Jan 2007 00:00:01
Message: <web.45b989566bfe8377dd5364bf0@news.povray.org>
"FrogRay" <nomail@nomail> wrote:
> "quickfur" <qui### [at] quickfurathcx> wrote:
> > Hi all, I'm making a simple model of a creature for my scene using CSG, and
> > I'm having some trouble modelling the creature's eyelids. Basically, I'm
> > using a sphere_sweep object to model the eyelids, and I want the eyelids to
> > lie on the surface of a sphere. I have 5 spheres in the sweep, 3 of which
> > lie on the sphere and the first and last are adjusted by a macro that
> > models (or tries to) different eye expressions, interpolated by
> > cubic_spline. How do I mathematically ensure that these two "control
> > points" are placed so that the resulting sphere_sweep object always lies on
> > the surface of a sphere? (Well, actually, half sunken into the sphere since
> > all I'm doing is modelling the bulge along the edge of the eyelids.)
>
> I would suggest looking up the trace command (yes it can be a bit tricky at
> first but look at the povray posts about trace if you get completely
> bewildered).

Do you mean the #trace macro described in the POVRay documentation?


> You would need to use this once for every element in your
> sphere sweep unless the area where your eyebrows meet the face is
> relatively flat - in that case you could use it once for the entire sphere
> sweep object after you have created it.  Doing it this way, I imagine that
> you could get your curve correct in the y-direction (looking directly at
> the face) and then use the trace function on the individual array elements
> to set the z-location (where eyebrow touches face) of each point.
[...]

Thanks for the idea... I managed to figure out a way to do it (hopefully
somebody else will find this useful): basically I draw the shape of the
eyelids on a flat plane (XY plane), which I use to make a prism for cutting
out the sphere that covers the eyeball, thus making the eyehole of the
desired shape. Since the resulting hole is essentially the (parallel)
projection of the flat shape onto the sphere, I just use a little math:
(x,y) gets mapped to (x,y,sqrt(1-x*x-y*y)), assuming that the curve
lies within the unit circle and the sphere to be cut from is also a unit
sphere. I use this formula to map the control points of the curve onto
the sphere, and then use the results to make the sphere_sweep that
describes the eyelids.

At first I still had some trouble with matching the shape of the eyelids
with the shape cut by the prism, because I was trying to do one eyelid at a
time. Eventually I introduced additional points to describe the curve, and
added appropriate control points (which are different for the sphere_sweep
and the prism). The resulting curves don't match 100% mathematically, but
since the eyelids have non-zero thickness, the approximate match works well
enough.


[...]
> As far as the eye sockets are concerned - I'm not why you need a
> sphere-sweep here but I may have misunderstood the problem.  Can you not
> simply CSG-Difference two sphere shapes out of the main sphere?

The sphere_sweep is for making the edge of the eyelids protrude a bit. The
eye hole itself is carved out by a prism with a base shape that describes
(the flat version of) the desired shape of the hole.


> All the best for your animation!

Thanks! I haven't gotten around to an actual animation yet, although I've
successfully developed a set of macros with 6 parameters that specify the
shape of the eyehole. The resulting eye is surprisingly expressive, ranging
from generic looks to shocked expressions, anger, suspicion, and outright
sad. Maybe I'll post some sample images. :-)


Post a reply to this message

From: Tim Attwood
Subject: Re: Sphere sweep along the surface of a sphere
Date: 26 Jan 2007 16:05:59
Message: <45ba6d37$1@news.povray.org>
> Thanks for the idea... I managed to figure out a way to do it (hopefully
> somebody else will find this useful): basically I draw the shape of the
> eyelids on a flat plane (XY plane), which I use to make a prism for 
> cutting
> out the sphere that covers the eyeball, thus making the eyehole of the
> desired shape. Since the resulting hole is essentially the (parallel)
> projection of the flat shape onto the sphere, I just use a little math:
> (x,y) gets mapped to (x,y,sqrt(1-x*x-y*y)), assuming that the curve
> lies within the unit circle and the sphere to be cut from is also a unit
> sphere. I use this formula to map the control points of the curve onto
> the sphere, and then use the results to make the sphere_sweep that
> describes the eyelids.

(see 3.2.1.4.5  Functions, trace)
Trace perty much would do the same thing, transfer a
point on the imaginary XY plane to your object surface.

Trace however doesn't require you know the formula
for the surface of the object you want to find a point on,
so if you have a more complicated shape it could still
work for that.

Also, trace can return the normal of the surface, you could
use that to place the base of objects in relation to the
surface, IE eyelashes, or fur.

#include "transforms.inc"
#declare EyeLid = ...
#declare EyeLash = ...

#declare Norm = <0,0,0>;
#declare direction = z; // into the scene
#declare hit = trace(EyeLid, XYpoint, direction, Norm);
#if (vlength(Norm)=0) #error "Trace missed object." #end

object { EyeLash
   Point_At_Trans(Norm)
   translate hit
   pigment{...}
}


Post a reply to this message

From: quickfur
Subject: Re: Sphere sweep along the surface of a sphere
Date: 26 Jan 2007 21:15:00
Message: <web.45bab5896bfe8377dd5364bf0@news.povray.org>
"Tim Attwood" <tim### [at] comcastnet> wrote:
[...]
> (see 3.2.1.4.5  Functions, trace)
> Trace perty much would do the same thing, transfer a
> point on the imaginary XY plane to your object surface.
>
> Trace however doesn't require you know the formula
> for the surface of the object you want to find a point on,
> so if you have a more complicated shape it could still
> work for that.

Oh, cool! I'm sure I've seen the trace function before, but
for some reason I confused it with the #trace macro that
was used in the raytracer example. Thanks for pointing
it out.


> Also, trace can return the normal of the surface, you could
> use that to place the base of objects in relation to the
> surface, IE eyelashes, or fur.
[...]

Awesome. This would be useful, for sure.

--QF


Post a reply to this message

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