POV-Ray : Newsgroups : povray.general : Sphere sweep along the surface of a sphere : Re: Sphere sweep along the surface of a sphere Server Time
31 Jul 2024 14:27:49 EDT (-0400)
  Re: Sphere sweep along the surface of a sphere  
From: quickfur
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

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