Next, the … I don’t even know what a “degree of the polynomial basis” is… but the manual says it should be an int between 1 and 4, so putting 2 should be safe.
In I’d put my vertex, like this:
<VertexRef> { 0 1 2 <Ref> { verts } }
…em…well… what do I put here?
type … it’s not mandatory, but what does XYZ, HPR, or T actually mean?
Or maybe someone has a valid egg with a NURBSCurve that I could take a look at?
NURBS are more-or-less standard math in 3-D graphics, though they’re not as common now as they were at the top of their hype curve. Try this page for an introduction to some of the concepts: http://www.rhino3d.com/nurbs.htm
Usually, your NURBS curves will be order 4 (which is degree 3, as described on the above page).
Your knot vector is usually a sequence of increasing integers, with the first three and last three numbers all the same (if you have order 4 curve). For instance, 0 0 0 1 2 3 4 5 5 5. You have to match the number of knots to the number of vertices you have. You can do other tricks with different knot vectors, but that’s more advanced.
You have the right idea with the four-component vertices. Usually you just tack on a 1 at the end. You can do other tricks with a different value than 1, but that’s more advanced too.
XYZ, HPR, and T describe the intended meaning of the components of your curve. For a curve in space, it will be type XYZ. HPR means that the three components refer to the H,P,R components of a rotation, instead of the X,Y,Z components of a point in space. This kind of curve can’t be rendered, but you can use it to modify an object’s rotation according to a given value of t. A “T” curve uses only the X component and ignores Y and Z, and understands the X component to be another value of T: this is a mapping of time to time, otherwise called a “timewarp” curve, which is an advanced concept and rarely used.
and Panda is happy with that. I’ve tried to make it visible adding subdiv { 4 } to the file, but nothing seems to be rendered. When used as a mopath, a model moves more or less in a way I’d expect (a kind of spiral).
Knots still puzzle me. I’ve used two vectors to compare, one is:0 1 2 3 4 5 6 7 8 9 and the other: 0 0 1 1 2 2 3 3 4 4. When I use them as mopaths then the shape my object fly is more or less the same (it’s hard to tell if you can’t see them), but the second one is much faster (in terms of movement speed not FPS).
In order for the subdiv trick to work, you have to be using the new-style nurbs object. You can switch to the new style by setting:
egg-load-old-curves 0
in your Config.prc, and then emptying your model cache. But when you switch to the new style, you can’t use it as a mopath any more, sorry about that–we haven’t fully migrated all of our code to the new style nurbs object yet.
Really understanding the NURBS knot vector is about as common as really understanding quaternions. You might be able to find a good explanation somewhere on the web. Fortunately, you don’t need to really understand it to use it.
egg-load-old-curves 0 works for me, and it’s quite helpful for debugging, fortunately I don’t have to see them and use them at the same time, so there’s no need to update that code on my account.
I understand both of them perfectly. You feed them some numbers, magic happens, and you get a result