# nurbs from scratch in general

i’m basicly interested in adding nurbs functionality to a real-time clod system i’m developed.

you can see a recent screen here:

basicly the system likes models with constant curvature, so it is generally useful to be able to convey parametric geometry to the system.

support for nurbs surfaces would greatly expand its expressive power.

i’ve been doing some reading and checking out some code here and there. right now i’m pretty much just interested in finding some useful resources in advance and maybe finding someone with a fair amount of experience programming nurbs systems.

i have more experience with the matter than it may appear. i’m just starting this thread prematurely in the hope that once i hit a snag i might have some where to go.

ideally i hoping the workflow will looking like:

1. solve surface coordinates at the control points – essentially building a mesh with one vertex per ‘visible’ control point.
2. within regions bound by 3 or 4 edges linked by control points forming a triangle or quad, i would like to be able to solve the surface coordinate for any given UV pair in quad regions (or baryocentric coordinates maybe for triangular regions) fairly directly – that is i don’t want to have to integrate over a curve or anything, just rather pump some uv coordinates in an equation given some variable parameters between control points and get back a vertex for instance.

sincerely,

michael

oh yeah, i’m also interested in a good simple common nurbs file format i can use for importing simple models (no trimminng or anything).

i understand that importing nurbs and moving models between different applications can be a pain.

i probably need to use the glu nurbs api or something to debug the importer before i go to far.

Here is a suggestion for part 2 of your outline above:

You can build one continuous surface that consists of
several Bezier patches. The control points of each
patch are its four vertices (it is a quad after all)
and its neighbours’s vertices – assuming that you
are away from the edge of the surface and you will
treat that differently. You can introduce “global UV”
pairs which run from 0 to N+1, where N is a positive
integer, but the values U and V are floats. Then,
from the “integral” part of the number you know on
which patch you are drawing, so you select the control
points based on that. From the decimal part (which
runs from 0 to 1) you get your “local uv” pair. Of
course, you can have a mapping from 0 to 1 for everything.

It is more difficult to get U and V given vertices
in space than coming up with parametrized surfaces
with continuous derivatives (curvature if you like),
etc. This is difficult because given an (x,y,z) vertex,
you will need to get a projection of the vertex to
your surface and work from there to find local u and
v. Very painful and computationally demanding…

Maybe we are not on the same page on this one…

well for a week while my computer is busy doing some intensive preprocessing work i’m planning to keep reading everything i can find on nurbs.

from what i’ve read so far i figure the approach i’m planning should be doable. and local integration should be limited to two parameterized edges for a 3rd order curve, three edges for 4th order… n edges for nth order.

basicly all that i’m doing is building the nurbs geometry from control point to control point, then filling in the vertices between the control points in real-time with respect to view dependant subdivision.

i have a senior or junior level computer graphics book which relegates a chapter to parametric curve generation and surfaces from bezier to nurbs curves.

the surface portion of the chapter is a little more fly by night though…

interestingly enough it is possible to solve u,v interpolants of a bezier patch via a handfull of matrix operations.

p(u,v)=[0][1][2][3][4]

for a cubic parameterization…

where matrix 0 is a vector like so:

[u^3,u^2,u,1]

matrix 4 is likewise though substitute v for u.

matrix 1 and 2 are bernstein polynomials constituted as such:

-1+3-3+1
+3-6+3
-3+3
+1

the central matrix is your control points. in 3D you would just do the matrix multiplications for each dimension indapendantly.

for a quadratic parameterization presumably you could lop a dimension off the matrices.

i’m interested in this matrix aproach as i imagine it would generalize fairly well, and allow me to store parameterizations locally easilly.

the inner three matrices combination could be precomputed for a local region. sampling the surface at that point would just be a matter of multiplying the vectors through the central matrix.

for nurbs however the textbook is much more scant.

i figure it is possible to generalize this approach to a nurbs model, but my book makes no mention of it.

this is where i was hoping i could call on the wisdom of some master or another.

i figure the nurbs weights would simply go with the control points in the central matrix. then maybe the bernstein polynomial matrices need to be replaced with knot dependant matrices.

i’m sure i could give it more thought, but i’m hoping i can get a kick in the pants by sharing my dilemna here.

is this the most common sampling approach for powerful nurbs systems?

so no one wants to help crack this one open?

i guess i will have to figure this stuff out myself then.

this book i have is fuzzy on how the knot vector effects the basis functions… it always just says ‘assuming a regularly spaced knot vector’, and never actually describes the relationship.

is it difficult to sample an irregular knot vector? i’m assuming the knots do not even have to correlate with control points.

actual nurbs implimentations at best seem to restrict the knotting to one per control point with the option of doubling up… i noticed Maya™does not even allow the user to manipulate the nurbs weights (what a joke).

even the best proprietary nurbs modelers i could find do not possess the functionality to say, manually create a scalable circle.

please if you can, weight in!

if you consider yourself a nurbs officianado, please let me know at least my words and thoughts are falling on deaf ears.

how many people out there ‘really really’ understand this stuff anyhow?

i guess i’m going to have to start looking for useful info on the internet. (this aught to be fun) any suggestions?

sincerely,

michael

The FBX format will transfer Nurbs Surface happily between packages - there should be plugins available for the main animation and modelling packages.

i noticed Maya™does not even allow the user to manipulate the nurbs weights (what a joke).
it does allow you to edit the weights - use the 3D paint tool, the surface editing tool or just manually set them via the API or script.

even the best proprietary nurbs modelers i could find do not possess the functionality to say, manually create a scalable circle.
Maya/XSI/Houdini to name 3 that do.