POV-Ray : Newsgroups : povray.binaries.images : Trying to understand spline meshes Server Time
19 Nov 2024 00:27:25 EST (-0500)
  Trying to understand spline meshes (Message 1 to 8 of 8)  
From: Greg M  Johnson
Subject: Trying to understand spline meshes
Date: 28 Feb 2004 23:42:26
Message: <40416db2$1@news.povray.org>
//scene file below, discussion in povray.general.


camera { location  <4, 0, -180> look_at <0, 0.25, 0> angle 15}

sky_sphere { pigment {
    function{abs(y)}
    color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
  }
}

light_source {<100,200,-100> colour rgb 1.2}

// ----------------------------------------


// This spline describes the path along the object
// From control points 0 to 1

#declare USpline =  spline {
  //linear_spline
  natural_spline

   // -1, .1,


      0,   <-9.5,3,-4>,
      0.2,   <-8,0,0>,
      0.5,   <0,0,0>,
      0.8,   <8,0,0>,
      1.0,   <9.5,3,-4>}


// This spline describes the cross section of the object
// For a closed shape the spline should have the same values at control
points 0 and 1
// The z coordinate is not used
#declare VSpline =
  spline {
    cubic_spline
    //linear_spline
   -0.125, <0.5,-0.5,0>,
    0,     <0.75,-0.250,0>,
    0.125, <0.5,0.5,0>,
    0.25,  <-0.25,0.75,0>,
    0.375, <-0.5,0.75,0>,
    0.5,   <-1,0,0>,
    0.625, <-0.5,-0.5,0>,
    0.75,  <0,-1,0>,
    0.875, <0.5,-0.5,0>,
    1,     <0.75,-0.250,0,0>
    1.125, <0.5,0.5,0>,
  }

// This spline describes how the width varies
#declare WSpline = spline {
  natural_spline
   // -1, .1,
    0.00, 0.02,
    0.25, 0.2,
    0.35, 0.75,
    0.425,3
    0.575,3
    0.65, 0.75,
    0.75, 0.2,
    1.00, 0.02
    //2.0, .12
 }

#declare Upoints = 50;  // Number of points along
#declare Vpoints = 50;  // Number of points around
#declare Filename = ""

#include "SweepSpline.inc"


#declare Newsplineobject=

object {
  SweepSpline(USpline, VSpline, WSpline, Upoints, Vpoints, Filename)
        pigment {rgb <1,1,1>}
        finish {phong 0.5 phong_size 10}

}


object{Newsplineobject rotate 90*y translate -15*x}
object{Newsplineobject rotate 150*y}
object{Newsplineobject rotate 210*y translate 15*x}


Post a reply to this message


Attachments:
Download 'SweepSplinefixd0202.jpg' (25 KB)

Preview of image 'SweepSplinefixd0202.jpg'
SweepSplinefixd0202.jpg


 

From: Dan P
Subject: Re: Trying to understand spline meshes
Date: 29 Feb 2004 00:15:39
Message: <4041757b@news.povray.org>
Not many people try to make those by hand!
Cool.


Post a reply to this message

From: Mike Williams
Subject: Re: Trying to understand spline meshes
Date: 29 Feb 2004 00:49:11
Message: <40417d57@news.povray.org>
"Greg M. Johnson" wrote
> //scene file below, discussion in povray.general.

I'm not sure that this is a normals problem. Here's the scene with the
normals drawn in. I had to render it fairly large so that you can see the
normals clearly.


Post a reply to this message


Attachments:
Download 'NormalsFix.jpg' (118 KB)

Preview of image 'NormalsFix.jpg'
NormalsFix.jpg


 

From: JC (Exether)
Subject: Re: Trying to understand spline meshes
Date: 29 Feb 2004 04:34:56
Message: <4041b240$1@news.povray.org>
Greg M. Johnson wrote:

> //scene file below, discussion in povray.general.
> [...]
> #include "SweepSpline.inc"
Is this include available ? I can't find it on the net.

JC
-- 
http://exether.free.fr/irtc (more IRTC stats !)


Post a reply to this message

From: Mike Williams
Subject: Re: Trying to understand spline meshes
Date: 29 Feb 2004 14:54:37
Message: <cN1f$AAWwjQAFwIs@econym.demon.co.uk>
Wasn't it JC (Exether) who wrote:
>Greg M. Johnson wrote:
>
>> //scene file below, discussion in povray.general.
>> [...]
>> #include "SweepSpline.inc"
>Is this include available ? I can't find it on the net.

I've uploaded the new version to my isosurface tutorial web page.
Although it doesn't use an isosurface, it does a job that's similar to
some of the isosurfaces on the page
<http://www.econym.demon.co.uk/isotut/more.htm>

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Trying to understand spline meshes
Date: 29 Feb 2004 22:00:01
Message: <4042a731$1@news.povray.org>
Wow great!

Thanks for your efforts.  Apologies if I "cast dispersions" on your macro-- 
it's great work.   Perhaps I'm just doing something unnatural with the
spline.

The circular section version doesn't show this problem-- but my spline curve
is lumpy so perhaps that's part of the problemo.

And Daniel, FWIW, it's the new head on my robot walk cycle at p.b.a.



"Mike Williams" <nos### [at] econymdemoncouk> wrote in message
news:40417d57@news.povray.org...
>
> "Greg M. Johnson" wrote
> > //scene file below, discussion in povray.general.
>
> I'm not sure that this is a normals problem. Here's the scene with the
> normals drawn in. I had to render it fairly large so that you can see the
> normals clearly.
>
>
>
>
>


Post a reply to this message

From: Dan P
Subject: Re: Trying to understand spline meshes
Date: 29 Feb 2004 23:16:51
Message: <4042b933$1@news.povray.org>
"Greg M. Johnson" <gregj;-)565### [at] aolcom> wrote in message
news:4042a731$1@news.povray.org...
> Wow great!
>
> Thanks for your efforts.  Apologies if I "cast dispersions" on your
macro-- 
> it's great work.   Perhaps I'm just doing something unnatural with the
> spline.
>
> The circular section version doesn't show this problem-- but my spline
curve
> is lumpy so perhaps that's part of the problemo.
>
> And Daniel, FWIW, it's the new head on my robot walk cycle at p.b.a.

Sweet :-)


Post a reply to this message

From: Mike Williams
Subject: Re: Trying to understand spline meshes
Date: 1 Mar 2004 01:58:34
Message: <VDn9cAAe5tQAFwJb@econym.demon.co.uk>
Wasn't it Greg M. Johnson who wrote:
>Wow great!
>
>Thanks for your efforts.  Apologies if I "cast dispersions" on your macro-- 
>it's great work.   Perhaps I'm just doing something unnatural with the
>spline.
>
>The circular section version doesn't show this problem-- but my spline curve
>is lumpy so perhaps that's part of the problemo.

No, the spline lumpiness isn't the problem, nor is the fact that the
spline contains a mixture of vectors with different dimensions. 
(I didn't know you could do that, but POV apparently happily considers
them to be colour vectors and won't let you say things like 
  sphere {VSpline(I),0.1}
because VSpline(I) is a colour instead of a position.)

I think you're right that there's a normal problem. It's quite subtle. I
make my normals always perpendicular to the USpline, but they really
shouldn't be. They should tilt slightly as the diameter changes with the
WSpline. I've just uploaded a fix for this. I kept the old version as
SweepSPlineV2.inc because it seems to work slightly better on some
surfaces - I don't know why.

I think that there might be a general situation with mesh objects in
places where the light falls almost tangential to one of the triangles.
If the situation is such that a flat triangle would be in shadow
(because the light is just below the tangent) but a real smooth triangle
would be partly out of shadow where it curves above the plane of the
flat triangle, then the shadow may not look natural. In such situations
you might get round it by increasing the number of triangles.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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