Nurbs Workspace Plugin Thread

Smart people ~ Great Scripts
Post Reply
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Nurbs Workspace Plugin Thread

Post by froo »

I've been planning on doing this for some time; just wasn't sure if it
was worth doing or not. That was the point of the Workspace poll:
whether it was worth making more plugins for the Workspace side or not.

So. On to it then.

Potential issues:
I don't believe there is a native 'line' primitive in Workspace.
But, I am thinking, I could try a couple things:
1) use DirectX calls to draw lines in the window
2) use a cylindrical tube

The lines/tubes are the 'control curves' above the nurbs surface.
We need a widget for each control point; probably will use a sphere or cube for each.

I found a good paper online, about minimizing the error between the true mathematical
nurbs surface, and the tesellated geometric representation (what trueSpace draws).
I would like to try that, but it will take some time to understand the mathematical
terminology. There's stuff there I have never seen before. :ugeek:

clintonman
Captain
Posts: 3547
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Nurbs Workspace Plugin Thread

Post by clintonman »

Wow, you're pretty ambitious aren't you. :worship:

You could start with curves. I think truespace modelside uses bezier curves and uses a specific type of bezier nurbs surface so the surface might be thought of as an extension of the curve math. Another advantage to starting with curves is that once you have curves it might be possible to implement an animation path system. I made some nurbs plugins a few years back, Ill see if I can find my old notes and if there's anything useful in them I'll let you know.

"2) use a cylindrical tube"
I don't understand that, but another idea for curves would be to use triangles but with only 1 edge visible to represent the curve. Of course this would be inefficient because of all the extra invisible edges.

Can't wait to see what you come up with.
Clinton Reese

http://clintons3d.com

froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: Nurbs Workspace Plugin Thread

Post by froo »

hey Clinton.
yeah, I'm ambitious alright! :)
I have a good book with supporting code as a starting point:
Focus on Curves and Surfaces. I've had it for some time, but finally
found a need for it, a couple months ago: implementing nurbs in Workspace.

I've read through most of it, and have a good understanding of the math.
The good thing is, once you understand the first couple chapters, the rest
are primarily extensions of those first few chapters.

Actually, using triangles would be more efficient than using a 'tube'.
By 'tube', I meant, a circle extruded along the curve. That would require
more vertices, and would also be more unnecessary work. I just need
a visual representation of the control points and control curves.

And you're right; starting with curves would allow for animation along a nurbs path.
When I considered that in the past, is when I realized I needed a 'way' to display
that curve. We don't have a line primitive in the Workspace. But, I am also
wondering if I can just make DirectX calls directly, and draw it in the View window.
If I could, would there be any negative issues with that? Worth thinking about.

froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: Nurbs Workspace Plugin Thread

Post by froo »

Oh forgot to say, yes, any and all helpful notes and info would be most appreciated!
Creating a nurbs object is actually the easier task I believe; trim curves are more
of a challenge though.

clintonman
Captain
Posts: 3547
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Nurbs Workspace Plugin Thread

Post by clintonman »

I found my notes, but there wasn't much to them. I had a printout from the rhino site:

http://www.rhino3d.com/nurbs.htm" onclick="window.open(this.href);return false;

and some sketchy theories written down mostly trying to understand the truespace implementation. The notes say truespace is degree 3 order 4 and the curves are like a series of bezier curves glued end to end and the patches are the same thing only in 2 dimensions. Internal knots repeat 3 times and the end knots repeat 4 times and the total number of knots is num control points + order. I don't think I'm telling you anything you don't already know except maybe that modelside has the bezier style nurbs curves and surfaces.
Clinton Reese

http://clintons3d.com

froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: Nurbs Workspace Plugin Thread

Post by froo »

Ok thanks Clinton. :)
Yes that sounds familiar.
One thing I could do is allow the user to specify the order of the curve;
the basis functions are generated programmatically anyway. I am not
saying, that is what I am going to do. Just saying, it's a possibility.
I cannot recall, if I determined that was a good idea or not. I will have
to refresh my memory on that subject. The big trick, in my mind, is implementing
the trim curves. There's an easy way, and a very low-error way. The Low
error method will require some studyin on my part. :ugeek:

User avatar
Finis
Captain
Posts: 4816
Joined: 21 May 2009, 18:26
Type the number ten into the box: 0
Location: America!
Contact:

Re: Nurbs Workspace Plugin Thread

Post by Finis »

Make it with the Nurbs math stuff etc. separate separate from the interface stuff so you can possibly use it to make a plugin for other 3D programs.

Wigand
Senior Chief Petty Officer
Posts: 204
Joined: 21 May 2009, 17:38

Re: Nurbs Workspace Plugin Thread

Post by Wigand »

And you're right; starting with curves would allow for animation along a nurbs path.
Maybe you could hit two flies with one flap. (german version of: to kill two birds with one stone)
So we can get paths for workspace and animation path and nurbs. :worship:

User avatar
RAYMAN
Captain
Posts: 2344
Joined: 21 May 2009, 18:56

Re: Nurbs Workspace Plugin Thread

Post by RAYMAN »

maybe you could investigate if you can use a geometry library that is free........
You could also use the open nurbs library and the 3dm format.
Michael Gibson has always said that the quality of your nurbs application is only as good as your geometry library....
Starting with curves is a very good idea.
could you be able to use the bridge and use curves from the model side...?
The 3dm file format for modelside would also be awsome.
Peter

froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: Nurbs Workspace Plugin Thread

Post by froo »

Ok; all I did with this, is copy code from the book, into the relevant area of the RnHeightField.cpp file.
RnHeightField is one of the SDK Examples. Instead of averaging the color of the bitmap to get the z height,
I inserted the Bezier surface code. Obviously this looks like hell; I just wanted to see if I could get it to work.
There are issues to be resolved with vertex indexing; that's why we have these funny artifacts.
Anyway, just wanted to show a pic and include the scene so you could have a look.
This did not take too long; about an hour or so of merging code and debugging. So that's a good thing.
You do not have the required permissions to view the files attached to this post.

Post Reply