POV-Ray : Newsgroups : povray.general : Another bicubic patch question Server Time
8 Aug 2024 16:18:01 EDT (-0400)
  Another bicubic patch question (Message 1 to 10 of 10)  
From: Rune
Subject: Another bicubic patch question
Date: 9 Dec 2000 12:55:10
Message: <3a3271fe@news.povray.org>
How do I make patches fit seamlessly together when the number of patches
that has corners in the same point is not 4?

The usual trick of having the points aligned in lines doesn't seem to apply,
since it only makes sense when there's 4 patches sharing a corner.

So as an example, how would the code for a sphere made of 6 patches (think
dice) look? And which guidelines should be used to achieve it?

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated October 9)
/ Also visit http://www.povrayusers.org


Post a reply to this message

From: Ron Parker
Subject: Re: Another bicubic patch question
Date: 10 Dec 2000 21:08:51
Message: <slrn938dpm.tin.ron.parker@fwi.com>
On Sat, 9 Dec 2000 18:53:44 +0100, Rune wrote:
>How do I make patches fit seamlessly together when the number of patches
>that has corners in the same point is not 4?
>
>The usual trick of having the points aligned in lines doesn't seem to apply,
>since it only makes sense when there's 4 patches sharing a corner.

You just need to make sure that the control points are all coplanar.  That is,
if you have, say, three patches joined together in a corner like so:

         x
    \   / \   /
     \ /   \ /
      *  A  *
      |\   /|
     \| \ / |/
      xC O Bx
      |\ | /|
        \|/
         *
         |

Assume that the corner is O, and the intersections marked by *s are on the 
edges of two patches.  (The lines going through points marked X lie inside
the joined patches, which are not completely represented here.  If the
picture isn't entirely clear, ask me and I'll try to throw together a POV
scene that describes what I'm talking about.)  

What you have to do to make sure there aren't any "dimples" at O is make sure 
that the three points marked with *s are coplanar with the point marked with 
an O.  To make sure you don't get creases, you have to make sure the points 
marked with an x follow the usual rule for seamless patch joinery: if an x, 
a *, and an x are adjacent, they should be in a straight line.

So, for your sphere made of six patches, you'd put each set of *'d points 
somewhere on a face of the octahedron whose faces are centered on the vertices 
of the cube.

The solution does not generalize, however.  You can have four patches come 
together seamlessly at a point without the four adjacent edge points being
coplanar, but there are other more difficult constraints on that solution.
You can be sure, though, that if the adjacent points are all coplanar, you 
won't get a dimple.  That is, having coplanar points is sufficient for a 
smooth solution, but not necessary except in the case of three patches.
  
-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Chris Colefax
Subject: Re: Another bicubic patch question
Date: 11 Dec 2000 03:58:21
Message: <3a34972d@news.povray.org>
Rune <run### [at] inamecom> wrote:
> How do I make patches fit seamlessly together when the number of patches
> that has corners in the same point is not 4?
>
> The usual trick of having the points aligned in lines doesn't seem to
apply,
> since it only makes sense when there's 4 patches sharing a corner.
>
> So as an example, how would the code for a sphere made of 6 patches (think
> dice) look? And which guidelines should be used to achieve it?

The code below creates something like a sphere based on a cube of patches.
You can toggle the hull to see the tangent lines, edges and corners.
However, I would cautiously say that getting anything as good as the last
(8-patch) sphere is impossible with this arrangement - tweak the V1 and V2
parameters as I might, I can't seem to get a shape that is close to
spherical *and* smooth at the seams (if you comment out the reference sphere
and turn off the hull you can clearly see the discontinuities in shading).
Of course, Rune, you might have a little more luck...!

camera {location <1, 3, -4> look_at <0, 0, 0>}
light_source {<-200, 300, -400> rgb 1.3}
background {rgb 0.5}

// Reference sphere
sphere {0, sqrt(3) pigment {rgbt <1, 0, 0, .5>}}

// Tweaking parameters
#declare ShowHull = yes;
#declare ShowPatches = yes;

#declare V1 = .76; // Edge tangents
#declare V2 = 1.8; // Centre tangents
#declare R = .02; // Hull radius

// Corner points (equates to sphere with radius sqrt(3))
#declare C1 = <1, 1, -1>; #declare C2 = <-1, 1, -1>;
#declare C3 = <-1, 1, 1>; #declare C4 = <1, 1, 1>;

// Edge tangents
#declare T14 = V1*vrotate(vrotate(y, -z*60),
<degrees(acos(sqrt(2)/sqrt(3))), -45, 0>);
#declare T12 = V1*vrotate(vrotate(y, z*60),
<degrees(acos(sqrt(2)/sqrt(3))), -45, 0>);
#declare T21 = vrotate(T14, y*90);  #declare T23 = vrotate(T12, y*90);
#declare T32 = vrotate(T14, y*180); #declare T34 = vrotate(T12, y*180);
#declare T43 = vrotate(T14, y*270); #declare T41 = vrotate(T12, y*270);

// Centre tangent
#declare TM = V1*vrotate(y, <degrees(acos(sqrt(2)/sqrt(3))), -45, 0>);

// Centre points
#declare M1 = C1 + TM*V2;
#declare M2 = vrotate(M1, y*90);
#declare M3 = vrotate(M1, y*180);
#declare M4 = vrotate(M1, y*270);

#declare P = union {
#if (ShowPatches)
   bicubic_patch {
      type 1 u_steps 3 v_steps 3 flatness .01
      C1, C1+T12, C2+T21, C2,
      C1+T14, M1, M2, C2+T23,
      C4+T41, M4, M3, C3+T32,
      C4, C4+T43, C3+T34, C3}
#end

#if (ShowHull)
   union {
      cylinder {C1, C1+T12, R}
      cylinder {C1+T12, C2+T21, R}
      cylinder {C2+T21, C2, R}

      cylinder {C1+T14, M1, R}
      cylinder {M1, M2, R}
      cylinder {M2, C2+T23, R}

      cylinder {C4+T41, M4, R}
      cylinder {M4, M3, R}
      cylinder {M3, C3+T32, R}

      cylinder {C4, C4+T43, R}
      cylinder {C4+T43, C3+T34, R}
      cylinder {C3+T34, C3, R}

      cylinder {C1, C1+T14, R}
      cylinder {C1+T14, C4+T41, R}
      cylinder {C4+T41, C4, R}

      cylinder {C1+T12, M1, R}
      cylinder {M1, M4, R}
      cylinder {M4, C4+T43, R}

      cylinder {C2+T21, M2, R}
      cylinder {M2, M3, R}
      cylinder {M3, C3+T34, R}

      cylinder {C2, C2+T23, R}
      cylinder {C2+T23, C3+T32, R}
      cylinder {C3+T32, C3, R}

      pigment {rgb <0, 1, 0>}
      no_shadow
      }
   #end
}

union {
   object {P}
   object {P rotate x*90}
   object {P rotate x*180}
   object {P rotate x*270}
   object {P rotate z*-90}
   object {P rotate z*90}
   pigment {rgb 1}
   }


Post a reply to this message

From: Rune
Subject: Re: Another bicubic patch question
Date: 11 Dec 2000 12:32:02
Message: <3a350f92@news.povray.org>
"Chris Colefax" wrote:
> The code below creates something like a sphere based on a cube of patches.
(...)
> I can't seem to get a shape that is close to
> spherical *and* smooth at the seams (if you comment out the reference
sphere
> and turn off the hull you can clearly see the discontinuities in shading).

I probably didn't emphasise enough that the only thing that matters is that
they should join  smoothly. They don't have to make out a spherical shape...

Did you have any luck in joining the patches completely smoothly?

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated October 9)
/ Also visit http://www.povrayusers.org


Post a reply to this message

From: Rune
Subject: Re: Another bicubic patch question
Date: 11 Dec 2000 12:32:04
Message: <3a350f94@news.povray.org>
Thanks for your explanation Ron. I think I understand it.

However, I can't get it to work.

I tried to look at the code Chris Colefax posted in his reply. When I
changed the variable V2 to 2.0 the patches seemed to meet the criteria you
mentioned, if I understood them correctly.

(To see it more clearly comment out the reference sphere, toggle of the
patches, use location <3,0,-3> in the camera, and add "orthographic" in the
end of it)

But still the patches aren't joined completely smoothly.

How comes?

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated October 9)
/ Also visit http://www.povrayusers.org


Post a reply to this message

From: Ron Parker
Subject: Re: Another bicubic patch question
Date: 11 Dec 2000 14:51:20
Message: <slrn93ac1q.tvv.ron.parker@fwi.com>
On Mon, 11 Dec 2000 18:16:24 +0100, Rune wrote:
>Thanks for your explanation Ron. I think I understand it.
>
>However, I can't get it to work.
>
>I tried to look at the code Chris Colefax posted in his reply. When I
>changed the variable V2 to 2.0 the patches seemed to meet the criteria you
>mentioned, if I understood them correctly.

>(To see it more clearly comment out the reference sphere, toggle of the
>patches, use location <3,0,-3> in the camera, and add "orthographic" in the
>end of it)

I see it.  It's even more apparent with the camera at location -3.  I'm not
sure what's causing this.  The strange thing is that it applies to the edges,
whose behavior I thought I understood.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Rune
Subject: Re: Another bicubic patch question
Date: 11 Dec 2000 17:41:58
Message: <3a355836@news.povray.org>
"Ron Parker" wrote:
> I see it.  I'm not sure what's causing this.  The strange
> thing is that it applies to the edges, whose behavior I
> thought I understood.

Uh-oh. This doesn't sound good.

Anywhere else I can seek help?

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated October 9)
/ Also visit http://www.povrayusers.org


Post a reply to this message

From: John VanSickle
Subject: Re: Another bicubic patch question
Date: 12 Dec 2000 03:03:24
Message: <3A35EFCE.C4CE1654@erols.com>
Rune wrote:
> 
> "Ron Parker" wrote:
> > I see it.  I'm not sure what's causing this.  The strange
> > thing is that it applies to the edges, whose behavior I
> > thought I understood.
> 
> Uh-oh. This doesn't sound good.
> 
> Anywhere else I can seek help?

Not only do the points in question have to be co-planar,
but the control points at the edge of the patch must lie on
the line between the two adjacent interior points.

A1   A2   A3   A4/B1   B2   B3   B4
A5   A6   A7   A8/B5   B6   B7   B8
A9   A10  A11  A12/B9  B10  B11  B12
A13  A14  A15  A16/B13 B14  B15  B16

In this example, the point A8/B5 (shared between the two patches)
must lie along the line running from A7 to B6.  Likewise, the
shared point A12/B9 must lie along the line from A11 to B10.

It seems to be that whenever you cross from one patch to another, the
border point *must* lie on the line between its adjacent points, and in
the case of corners, it must line on the lines going in both directions.

If you fire up Moray and play with a 2x2 Bezier sheet, you'll note that
some of the control points are not manipulable by the user; they're
set from the other points in order to keep things smooth.

Regards,
John


Post a reply to this message

From: Ron Parker
Subject: Re: Another bicubic patch question
Date: 12 Dec 2000 08:11:41
Message: <slrn93c90e.of.ron.parker@fwi.com>
On Tue, 12 Dec 2000 09:28:46 +0000, John VanSickle wrote:
>In this example, the point A8/B5 (shared between the two patches)
>must lie along the line running from A7 to B6.  Likewise, the
>shared point A12/B9 must lie along the line from A11 to B10.

That's what I thought, too, but that appears to be happening in the
sample code and it's still pretty obvious where the patch boundaries
are.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: John VanSickle
Subject: Re: Another bicubic patch question
Date: 13 Dec 2000 01:27:59
Message: <3A372AEF.F1D81BCB@erols.com>
Ron Parker wrote:
> 
> On Tue, 12 Dec 2000 09:28:46 +0000, John VanSickle wrote:
> >In this example, the point A8/B5 (shared between the two patches)
> >must lie along the line running from A7 to B6.  Likewise, the
> >shared point A12/B9 must lie along the line from A11 to B10.
> 
> That's what I thought, too, but that appears to be happening in the
> sample code and it's still pretty obvious where the patch boundaries
> are.

Hmm.  I guess I'd better get cracking on that subdivision surface
modeller.

Regards,
John


Post a reply to this message

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