POV-Ray : Newsgroups : povray.general : Options for drawing curves on surfaces Server Time
25 Nov 2024 21:18:29 EST (-0500)
  Options for drawing curves on surfaces (Message 1 to 10 of 10)  
From: Ryan Budney
Subject: Options for drawing curves on surfaces
Date: 8 Mar 2013 17:45:01
Message: <web.513a69813870b8dd1343b2e50@news.povray.org>
Hi all,

I'm writing up my lecture notes for a differential geometry class and attempting
to render some of the more subtle graphics in PoVRay.

Here are two samples:

http://dl.dropbox.com/u/46424505/poinc_modelh.png

http://dl.dropbox.com/u/46424505/octo.png

The first example illustrates an issue.  As you can see in the picture, there is
a hyperboloid, and I'm attempting to draw some curves on the hyperboloid.

I'm wondering what are some more effective ways to do this.  One way to go would
be to make the curve on the surface just another hyperboloid, but I could crop
it by some planes to make it a thin-enough strip that it would approximate a
curve.  But ideally I want the curve to have a thickness.  In the linked file
poinc_modelh.png, the curve is a rather explicit parametric surface.  But with
radiosity, it can take my 8-core system 6 days to render an image like the one
above.  I'd like the render-time to be faster, just so tweaking the image
doesn't take so long. Even with low quality the render time is still fairly slow
with the parametric surface.

One option would be to make the curve out a sphere-cylinder-sphere chain, with
several hundred spheres.  This is pretty fast, but is there a tidy way to
automate the generation of that in PoV script?  When I was younger I'd just
write a C++ script to generate the PoV script but I'm hoping there's a tidy way
to do this in PoVRay itself.  Of course, a problem with this is I'd have to
appropriately crop the spheres if I wanted the effect to be seamless (and the
curves partially transparent).

Are there any other good options I should be thinking of?


Post a reply to this message

From: Alain
Subject: Re: Options for drawing curves on surfaces
Date: 8 Mar 2013 18:25:03
Message: <513a734f$1@news.povray.org>

> Hi all,
>
> I'm writing up my lecture notes for a differential geometry class and attempting
> to render some of the more subtle graphics in PoVRay.
>
> Here are two samples:
>
> http://dl.dropbox.com/u/46424505/poinc_modelh.png
>
> http://dl.dropbox.com/u/46424505/octo.png
>
> The first example illustrates an issue.  As you can see in the picture, there is
> a hyperboloid, and I'm attempting to draw some curves on the hyperboloid.
>
> I'm wondering what are some more effective ways to do this.  One way to go would
> be to make the curve on the surface just another hyperboloid, but I could crop
> it by some planes to make it a thin-enough strip that it would approximate a
> curve.  But ideally I want the curve to have a thickness.  In the linked file
> poinc_modelh.png, the curve is a rather explicit parametric surface.  But with
> radiosity, it can take my 8-core system 6 days to render an image like the one
> above.  I'd like the render-time to be faster, just so tweaking the image
> doesn't take so long. Even with low quality the render time is still fairly slow
> with the parametric surface.
>
> One option would be to make the curve out a sphere-cylinder-sphere chain, with
> several hundred spheres.  This is pretty fast, but is there a tidy way to
> automate the generation of that in PoV script?  When I was younger I'd just
> write a C++ script to generate the PoV script but I'm hoping there's a tidy way
> to do this in PoVRay itself.  Of course, a problem with this is I'd have to
> appropriately crop the spheres if I wanted the effect to be seamless (and the
> curves partially transparent).
>
> Are there any other good options I should be thinking of?
>
>
>
>

The parametric is possibly the slowest primitive. Using precompute with 
the larger value possible can make things faster (the max is 20: 
precompute 20 x,y,z). Use a max_gradiant as low as possible without 
causing holes or steppings. Make the contained_by object as tight as 
possible.

You may look at isosurface. They are often faster than parametrics for 
the same actual shape. In your case, adding "open" should be preferable 
so that the container don't show.

You may also look at the quadric. In "shapes_old.inc" you find some 
predefined shapes like paraboloids and hyperboloids.
A sample:
/* y - x^2 + z^2 = 0 */
#declare Hyperboloid =
  quadric {<-1,  0,  1>, < 0,  0,  0>, < 0,  1,  0>, 0 }




Alain


Post a reply to this message

From: Ryan Budney
Subject: Re: Options for drawing curves on surfaces
Date: 8 Mar 2013 18:55:05
Message: <web.513a79fa27497f371343b2e50@news.povray.org>
> You may look at isosurface. They are often faster than parametrics for
> the same actual shape. In your case, adding "open" should be preferable
> so that the container don't show.
>
> You may also look at the quadric.

Ah, okay I think I see where you're going here.  If you view a hyperbola as:

y^2-x^2 = 1 with z=0

then the surface "near" the hyperbola is:

(y^2-x^2-1)^2 + z^4 = 1/10 or any similar small constant on the right.

I could do this with an isosurface object, I guess with a 4th order polynomial.

I'm not seeing how a quadric would suffice.


Post a reply to this message

From: scott
Subject: Re: Options for drawing curves on surfaces
Date: 11 Mar 2013 04:07:43
Message: <513d90cf$1@news.povray.org>
> One option would be to make the curve out a sphere-cylinder-sphere chain, with
> several hundred spheres.  This is pretty fast, but is there a tidy way to
> automate the generation of that in PoV script?  When I was younger I'd just
> write a C++ script to generate the PoV script but I'm hoping there's a tidy way
> to do this in PoVRay itself.  Of course, a problem with this is I'd have to
> appropriately crop the spheres if I wanted the effect to be seamless (and the
> curves partially transparent).

Couldn't you just "merge" the spheres and cylinders, then no cropping 
should be necessary. A simple while or for loop in POV could create the 
chain of spheres and cylinders, so long as your spheres are spaced close 
enough it will look like a smooth curve. I did this a long time ago to 
model speaker cable (two solid cores inside a semi-transparent case) and 
it worked nicely.


Post a reply to this message

From: Ryan Budney
Subject: Re: Options for drawing curves on surfaces
Date: 11 Mar 2013 13:50:01
Message: <web.513e18d427497f3785b1e6b80@news.povray.org>
> Couldn't you just "merge" the spheres and cylinders, then no cropping
> should be necessary. A simple while or for loop in POV could create the
> chain of spheres and cylinders, so long as your spheres are spaced close
> enough it will look like a smooth curve. I did this a long time ago to
> model speaker cable (two solid cores inside a semi-transparent case) and
> it worked nicely.

Ultimately I think this is what I should do.  Isosurfaces are a major
performance increase over parametric surfaces, but the problem with using
isosurfaces is the constraint equations become close to degenerate around the
surface I'm trying to describe.  That, and I have to up the "accuracy" and
"max_gradient" features so much that it starts to become slow again.

I didn't know about the "while loop" feature in PoVRay until today.  That really
helps!    I think this is the way to go.


Post a reply to this message

From: waggy
Subject: Re: Options for drawing curves on surfaces
Date: 11 Mar 2013 19:35:00
Message: <web.513e69d127497f3721be1230@news.povray.org>
Ryan Budney wrote:
> One option would be to make the curve out a sphere-cylinder-sphere chain, with
> several hundred spheres.

My preferred option in similar cases is to use a sphere_sweep.


Post a reply to this message

From: Alain
Subject: Re: Options for drawing curves on surfaces
Date: 11 Mar 2013 22:24:39
Message: <513e91e7@news.povray.org>

>
>> Couldn't you just "merge" the spheres and cylinders, then no cropping
>> should be necessary. A simple while or for loop in POV could create the
>> chain of spheres and cylinders, so long as your spheres are spaced close
>> enough it will look like a smooth curve. I did this a long time ago to
>> model speaker cable (two solid cores inside a semi-transparent case) and
>> it worked nicely.
>
> Ultimately I think this is what I should do.  Isosurfaces are a major
> performance increase over parametric surfaces, but the problem with using
> isosurfaces is the constraint equations become close to degenerate around the
> surface I'm trying to describe.  That, and I have to up the "accuracy" and
> "max_gradient" features so much that it starts to become slow again.
>
> I didn't know about the "while loop" feature in PoVRay until today.  That really
> helps!    I think this is the way to go.
>
>
>

I just tought of another possibility:
sor and lathe

You use the equation of the flat, 2D, hyperbola, evaluate it at many 
points using a #while loop.
Use those calculated points to define the curve. The sor and lathe will 
take care of makint it into a circular shape around the Y axis. You can 
translate and rotate the resulting object as you need.

If you add "open", there will be no end cap: You only get the actual 
surface with no thickness.

If you use an isosurface, "open" does the same.
Next, you can use some cylinder or cones to remove empty areas of the 
container box or sphere. It may help reduce the max_gradient. Use 
"evaluate" instead of max_gradient, it can make things somewhat faster.

Another option would be to subdivide your object using smaller 
containers, then, you recombine the parts with an union. Using boxes 
should be more effecient than spheres. That way, you may be able to work 
around the areas with the larger gradients.


Alain


Post a reply to this message

From: Cousin Ricky
Subject: Re: Options for drawing curves on surfaces
Date: 13 Mar 2013 15:35:00
Message: <web.5140d46f27497f3778641e0c0@news.povray.org>
"waggy" <hon### [at] handbasketorg> wrote:
> Ryan Budney wrote:
> > One option would be to make the curve out a sphere-cylinder-sphere chain, with
> > several hundred spheres.
>
> My preferred option in similar cases is to use a sphere_sweep.

I've pretty much given up on sphere_sweeps.  Too many artifacts.


Post a reply to this message

From: waggy
Subject: Re: Options for drawing curves on surfaces
Date: 13 Mar 2013 16:10:00
Message: <web.5140dc4d27497f3721be1230@news.povray.org>
"Cousin Ricky" wrote:
> "waggy" wrote:
> > My preferred option in similar cases is to use a sphere_sweep.
>
> I've pretty much given up on sphere_sweeps.  Too many artifacts.

I hear that. I considered adding, "when it works", but thought I recalled at
least one bug fix in recent releases. My current use is in a fairly low-res
animation, where any glitches aren't noticeable.


Post a reply to this message

From: scott
Subject: Re: Options for drawing curves on surfaces
Date: 14 Mar 2013 04:32:03
Message: <51418b03$1@news.povray.org>
>> My preferred option in similar cases is to use a sphere_sweep.
>
> I've pretty much given up on sphere_sweeps.  Too many artifacts.

Too slow as well. I don't know if it's sped up recently, but even a huge 
number of spheres/cylinders was always way faster.


Post a reply to this message

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