Solved

Knots in opengl nurbs

Posted on 2002-04-27
1,457 Views
I have the points on the outside of an object.  This object is a distorted cylinder in shape, and there are 40 points in it. I want to make a nurbs surface from theses points, but cannot figure out what the knots are or how to compute them.  All the examples I can find have an array of even size (how do they find this size??) containing half zeros and half ones {0,0,0,1,1,1) for example.  Trying random knot arrays either draws nothing at all or a very strange shape that passes through 2 or more points from the object but looks like a wadded up piece of paper.  Also, do the points in the object need to be in some specific order?  Should the object be drawn with 2 nurbs (all examples are a distorted plane, not cylindrical)??
Thanks...

0
Question by:jonnin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 4

Expert Comment

ID: 6973656
I suggest that as knots are a fairly fundamental concept to b-splines (including NURBS), you may want to pickup a graphics  or computational geometry textbook.  It's a classic topic, so there should be no sortage of good references.  I'll try and give an explanatation here, but it's the sort of thing that's much easier when you have some pictures to go with it.

The knots are essentially points in a space where the b-spline basis functions are evaluated.  The results of the basis functions over the knots mapped to the rendering space is what gives the b-spline or b-spline surface.

The array that you bring up is that of the knot indeces.  For n knots, you could use the sequence {0, 0, 0, 1, 2, ..., k-1, k-1, k-1}.

---

As an aside, it's my opinion that NURBS are seriously constraining and outdated.  There are far better and easier solutions to creating nice surfaces, my favourite technique being subdivision.
0

LVL 2

Author Comment

ID: 6977040
I have books, but they do not explain it well. (math and what a knot is in those terms, but not how to pick them or how many to use). I'm not buying another just for this; I only do graphics about one week a year =)
So how many knots are needed? Gl will not draw anything unless the right number of knots is used.

My object was a bajillion triangles from 3d max, I was going to try a nurbs to improve performance (just to see) before trying to decrease the triangles in max.
0

LVL 4

Accepted Solution

ct.smith earned 200 total points
ID: 6977857
It's too bad you don't want to sit down with a book for this one, but if cost is the only concern then a you may find a library useful :)

Anyways, a cubic b-spline needs a minimum of four knots to start, anything beyond four is where you'll start to see a reasonable surface.  There is no maximum number of knots.   In general, three knots to correspond to you first geometric control point, three for the last and one for each in between.

Just a caveat, NURBS are quite prone to problems such as tearing and catastrophic cusping, so they are really only appropriate for open surfaces.  For a complex model that has closed surfaces, you may find the results dissappointing.
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Simple Linear Regression
Why Skyport?
Suggested Courses
Course of the Month7 days, 22 hours left to enroll