POV-Ray : Newsgroups : povray.general : Nurbs ? Server Time
7 Aug 2024 19:20:54 EDT (-0400)
  Nurbs ? (Message 1 to 10 of 41)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Rune
Subject: Nurbs ?
Date: 1 Jun 2001 09:14:31
Message: <3b179537@news.povray.org>
I know a little about what nurbs are, but I'd like to know more about the
details.

First: what are the differences between nurbs and bicubic patches?

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated May 10)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Nekar Xenos
Subject: Re: Nurbs ?
Date: 1 Jun 2001 10:28:30
Message: <3b17a68e@news.povray.org>
Here's the answer I got when I asked a similar question some time ago:


> If anyone knows the Equations for NURBS, I'd be very grateful.

NURBS = Non Uniform Rational B-Splines, aka Bezier Patches, Bicubic Patches,
etc.  It's all the same stuff.
...Chambers


--
/* Nekar Xenos */#local N=<-20,40,100>;#local K=<20,-40,100>;#local R=seed(0);
blob{#while((K-N).x>0)#local X=N;#local N=N+<rand(R),rand(R),1>/3;#local N=(
vlength(N-K)<vlength(X-K)?N:2*X-N);sphere{<N.y,-N.x,N.z>,1,1 scale .02}sphere{N
,1,1 scale.02}sphere{<-N.x-40,N.y,N.z>1,1 scale.01}sphere{<N.x+40,-N.y,N.z>1,1
scale.01 }#end pigment{rgbt 1}interior{media{emission <2,4,5>*5}}hollow}


Post a reply to this message

From: Ron Parker
Subject: Re: Nurbs ?
Date: 1 Jun 2001 10:54:06
Message: <slrn9hfb4f.1o4.ron.parker@fwi.com>
On Fri, 1 Jun 2001 16:32:23 +0200, Nekar Xenos wrote:
>Here's the answer I got when I asked a similar question some time ago:
>
>
>> If anyone knows the Equations for NURBS, I'd be very grateful.
>
>NURBS = Non Uniform Rational B-Splines, aka Bezier Patches, Bicubic Patches,
>etc.  It's all the same stuff.

Not really.  Bezier patches/bicubic patches are neither non-uniform nor
rational.

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbt 1}hollow interior{media{emission T}}finish{
reflection.1}}#end Z(-x-x.2y)Z(-x-x.4x)camera{location z*-10rotate x*90}


Post a reply to this message

From: Christoph Hormann
Subject: Re: Nurbs ?
Date: 1 Jun 2001 11:04:49
Message: <3B17AF48.DA013825@gmx.de>
Rune wrote:
> 
> I know a little about what nurbs are, but I'd like to know more about the
> details.
> 

http://www.cs.wpi.edu/%7ematt/courses/cs563/talks/nurbs.html

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Tony[B]
Subject: Re: Nurbs ?
Date: 1 Jun 2001 12:05:11
Message: <3b17bd37@news.povray.org>
What I would like to know is if anyone has any plans to add these things to
POV any time soon...


Post a reply to this message

From: Warp
Subject: Re: Nurbs ?
Date: 1 Jun 2001 12:26:32
Message: <3b17c237@news.povray.org>
Ron Parker <ron### [at] povrayorg> wrote:
: Not really.  Bezier patches/bicubic patches are neither non-uniform nor
: rational.

  I think this means in practice that you can fine-tune the parameters
of a NURBS more extensively than those of a bicubic patch.
  I'm not completely sure about this, but I think that with a NURBS you can
control, among other things, the curvature and tangent of the curve at each
control point individually.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: James Tonkin
Subject: Re: Nurbs (Some math)
Date: 1 Jun 2001 15:08:58
Message: <3b17e84a$1@news.povray.org>
In article <3b17c237@news.povray.org>, Warp  <war### [at] tagpovrayorg> wrote:
>Ron Parker <ron### [at] povrayorg> wrote:
>: Not really.  Bezier patches/bicubic patches are neither non-uniform nor
>: rational.

Ok, there's about 4 types of curves being discussed here, from (mathematically)
simplest to most complex, they are:

	Bezier curves
	Bicubic patches
	B-Splines (uniform, non-rational)
	NURBS (which stands for non-uniform, rational, b-spline)

All of them are based on the idea of a set of control points, and a set of
blending functions.

Starting in 2 dimensions, with Bezier curves:

A curve can be defined in terms of a single parameter, (typically 's' or 't'
are used, depending on your mathematical background) which represents the
normalized distance along the curve, from it's starting point (control point 0) 
towards it's ending point (for a Bezier curve, this is control point 3, 
although the algorithim could be generalized to any number of points).  By
'normalized distance' I mean that the parameter (I'll use 't') is 0 at the 
starting point, and 1 and the ending point.

Each control point will have an x and y co-ordinate (<x0,y0> to <x3,y3>), and
an associated blending function.  

For Bezier curves, the blending functions are just the standard expansion
of ( t * (1-t) ) ^3, seperated according to the power of the 't' term.

(Historically, I don't think this was the motivation for development of
 this set of blending functions, but this is how it works out)

So blending function 3 is t^3.
	b.f. 2 = 3 * (t ^2)*(1-t)
	b.f. 1 = 3 * t * ( (1-t)^2)
	b.f. 0 = (1-t)^3

For any value of t, it is then possible to evaluate an <x,y> position by
the formula:

	R = (point 0 * blending function 0) + (p1 * bf1) + (p2 * bf2) +
		(p3 * bf3)

If you examine the blending functions, you'll notice that at t=0 blending
functions 1 to 3 are all 0, and blending function 0 is 1, so R = point 0.
Similarly at t=1, blending functions 0 to 2 are all 0, and blending fucntion3
is 1, so R = point 3.  I.e. the curve passes through the start and end points.
It does not, however, always pass through points 1 and 2 (although there are
cases where it does)

The curve is drawn by evaluating <x,y> for various values of t, and joining
the results with line segments.  Obviously the more values of t you evaluate
for, the smoother the curve that will be drawn.

Bicubic patches are generalizations of Bezier curves into 3-dimensional
sheets.  Instead of a single parameter, the position on the sheet is determined
by 2 parameters, <u,v>.

The blending functions are also generalizations into two parameters.  I think
(I'm doing this from memory, so don't take this as the final word) that they
can be given by doing the same seperation, according to powers of both u and
v, of the expansion of ( u * v * (1-u) * (1-v) ) ^3

Note that for a bicubic patch, the control points are not numbered 
sequentially, but in a grid, and the blending functions are likewise seperated
on two axis.  So:
	bf0,0 = (1-u)^3 * (1-v)^3
	bf1,0 = 3 * u * (1-u)^2 * (1-v)^3
	bf2,0 = 3 * u^2 * (1-u) * (1-v)^3
	bf3,0 = u^3 * (1-v)^3

	bf0,1 = (1-u)^3 * v * (1-v)^2
	bf1,1 = 3 * u * (1-u)^2 * v * (1-v)^2
	bf2,1 = 3 * u^2 * (1-u) * v * (1-v)^2
	bf3,1 = u^3 * v * (1-v)^2

	And so on.

The final point is then given by:
	
	R = sum(i from 0 to 3) {
		sum (j from 0 to 3) {
			point i,j * blending function i,j
		}
	    }

Uniform, non-rational b-splines are again generated as a function of control
points an blending functions.  However, the functions used are more complicated
than the simple polynomial expansion the Bezier/bi-cubics use.  These blending
functions are products of something called the knot vector.

The knot vector is a list of numbers (I think they might have to be integers,
but I'm not sure about that) in non-decreasing order.  The generation of the
blending functions from the knot vectors is some ugly algebra.  There are
relationships between the number of knots (the elements of the knot vector),
the degree of the B-spline, and the number of control points, but I'm not
sure exactly what they are.  For our purposes, the only thing that matters is
that the word 'uniform' implies that the spacing between knots is uniform.

There will be one knot vector for each dimension of the surface.  So a curve
has a single knot vector, while a surface patch has two.

The non-rational part of the word means that each control point has the
same weight (i.e. all have weight 1)

And now, finially, NURBS.  Non-uniform, rational, B-splines.  A further 
generalization of B-splines.  The 'non-uniform' adjective means that the
elements in the knot vector(s) do not have to be evenly spaced (although
they are still non-decreasing).  Repeating elements allows for sharp corners
and discontinuities.

Rational means that each control point has a weight associated with it.  I'm
not sure how the weights interact with the points and blending functions, 
but I believe that it's something like:

	R = sum(i from 0 to 3) {
		sum (j from 0 to 3) {
			weight i,j * point i,j * blending function i,j
		}
	    } / sum{all weights}

Ok, and that's enough math for one afternoon.

Jamie


Post a reply to this message

From: Rune
Subject: Re: Nurbs ?
Date: 1 Jun 2001 20:29:31
Message: <3b18336b@news.povray.org>
Ok, so nurbs are much more powerful than bicubic patches.

Now, I don't understand all those formulas I've been shown, so I still have
many questions.

Bicubic patches always have 4 corners. Can nurbs have 3 or 5 corners?

If you want smooth results you can only match up bicubic patches joining the
corners of 4 bicubic patches at a time. Because of that they can only be
used for objects with very simple topology. I presume any number of nurbs
can be joined up smoothly (typically 3, 4 or 5) ...?

Would it be possible to implement nurbs in POV-Ray? Would it be reasonable?
If so, what would a possible syntax look like?

The reason I'm interested in these nurbs is that I find bicubic patches too
limiting for what I want to do. IMHO POV-Ray would really benefit from such
flexible surfaces that nurbs are. Besides, it seems they're the most common
way of generating surfaces in the CG industry, besides basic polygons...

The above are just my thoughts. I really don't know anything about the
subject...

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated May 10)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Ken
Subject: Re: Nurbs ?
Date: 1 Jun 2001 21:21:49
Message: <3B183F13.57F26972@pacbell.net>
"Tony[B]" wrote:
> 
> What I would like to know is if anyone has any plans to add these things to
> POV any time soon...

This comes up a couple of times a year. It is generally considered not
worth the effort. NURBS are great in a GUI modelling environment but
offer little to nothing to a text file based parsing program like POV-Ray.
Additionally anything you can model with NURBS in a modelling program
can be converted to triangles and rendered in POV-Ray anyway. So the
question is why bother ?

-- 
Ken Tyler


Post a reply to this message

From: James Tonkin
Subject: Re: Nurbs ?
Date: 1 Jun 2001 22:28:38
Message: <3b184f56$1@news.povray.org>
In article <3b18336b@news.povray.org>,
Rune <run### [at] mobilixnetdk> wrote:
>Ok, so nurbs are much more powerful than bicubic patches.

In fact, bicubic/bezier patch/curves are just special cases of
nurbs objects.  (Although I can't tell you offhand what the knot
vector would have to be)

>Bicubic patches always have 4 corners. Can nurbs have 3 or 5 corners?

Well, for quick and dirty results, you can space the control points in
a bicubic in such a way as to generate a triangular patch.  
Alternatively, why not just clip the patch between diagonal corners?

But in general, any of the patches are just a method to convert from 
a two-coordinate (u,v) system into a three-coordinate (x,y,z) one.

Typically, for a patch, u and v represent distances parallell to the
edges of the (non-deformed) patch, however, any two-coordinate system
could be used.  For example, it would be possible to have u,v 
correspond to angle, radius.  So your default patch shape would be a
wedge-shape.

(Hmm, on further consideration, there could be a few difficulties with
 this, as all the radius=0 points overlap.  But it should be codeable-
 around)

So, any number of corner figure can be used as the base shape, provided
you can find a nice way of representing it using two co-ordinates.  The
tricky part is finding the 'nice' way, or even what constitutes nice.

For example, one of the properties of the square bicubic patch is that
curve along the edges depends only on the control points along that edge.
This is because moving along any edge of the patch involves a change in
only one parameter.  ( You change u as you move along the top or bottom
edges, and v as you move along the sides).  I consider this a 'nice'
property, so any triangular-based u-v system should preserve this.  
Other people may disagree.

Nurbs are mathematically a bit more complicated to generate, but the
same theory applies... they're a mapping from (u,v) to (x,y,z)

>used for objects with very simple topology. I presume any number of nurbs
>can be joined up smoothly (typically 3, 4 or 5) ...?

Nope.  Not unless someone comes up with a good method of representing
n-sided figures as (u,v) paramter pairs.

>Would it be possible to implement nurbs in POV-Ray? Would it be reasonable?
>If so, what would a possible syntax look like?

Ugly.  Very ugly.  A nurb patch requires a fair chunk of data to specify it.
There's the N x M array of control points.  A weight for each point, and the
two knot vectors (each of which has N or M, plus degree, plus 1 (I think))
elements.  Oh, and understanding what the knot vector does is not pleasant.

Jamie


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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