r7089 : Basic support for NURBS curves and surfaces added

This is awesome.

:evil: :evil: Can’t wait for the tutorial :evil: :evil:

I wonder, why games dont use NURBS model?


Great, is it possible to have basic code sample on nurbs (i’m not a math expert), nothing about it on wiki… ?

a appreciate your help for starting my custom modeler…


They might become more usefull when using geometry shaders, however I don’t reall ysee any advantage else.

So who saw “7089” and thought @phr00t made a new game?

This guy :slight_smile:


Don’t worry, I’ll get to it. I just need to make (7089 - 3079) / 10 = 401 sequels :stuck_out_tongue:

Thanks for your suggest, i found a relevant document about knots : http://www.saccade.com/writing/graphics/KnotVectors.pdf

i guess i will use in a first implementation the “Shape.Surface” class to deal with nurbs and on a second iteration, enhance the modeler with geometry shader.

it seems geometry shader is available since opengl 3.2 only (and directX 10) and not supported on most of current hardware (ok on my desktop but not on my laptop).

i’m interested in geometry shader + JMonkey3D, some articles / samples available ?

regards and thanks to the team for the work from the past 2 years !

1 Like

as i good know jme dont have geometry shader at the moment

Yes, but since its opensource and quite clean, geometrys could probably be added relativly easily if anyone need them. (Not this year for me, I’m having enough stuff to do for now)

hello guys, i’m trying to write down sample code in order to provide it as an article later in the wiki (about nurbs)…

Currently i’m trying to create a nurb which interpolates two functions (to B-spline, one on Y axis, the other on Z axis).

Each curve would be as is :


the degree is 4 and knot vector is : [0 0 0 0 1 2 3 3 3 3]

so i’ve made a method to init the nurb surface :

[snippet id=“21”]

this is the SimpleInitApp method :

[snippet id=“22”]

NB: i’ve added UpdateBound methode and an AmbientLight because i saw some trouble without them in forum post.

after all these step i can compile but dont see anything !

Can someone help me to understand than i can’t figure out ?

Thanks for your Help !

@kaelthas Are there any snippets on how to do a simple nurb surface?

i’ve just making some tests with Spline and SplineType.Nurb (used by the Curve object) and i can display the spline :

in the SimpleInitApp methode change “Surface mesh = InitSurface();” by “com.jme3.scene.shape.Curve mesh = InitCurve();”

Init curve method is :

[snippet id=“24”]

i was seaching computes différences between Spline (used by Curve) and the Surface object, and when i follow the code, in the Spline.java file i see :

[snippet id=“25”]


@kaelthas : can you explain me how you did the trick for compute nurbs (started from scratch ?)…definitively, if you can provide some sample code…

i’m waiting for your help …


So is the NURBS stopped? Is it ok to use Surface?

hi kotoko, in fact know, i successfully used nurbs after but have sample code to provide (in an old repository, on another computer…)

to sum up (and as i remember) you need to understand what is a spline, because you provide splines in parameters of the nurbs…

i was displaying a nurb by providing two spline in parameter, the 2 splines were the same (a sinusoidal fragment, you can setting knots for that) but with a different value for the Z axis

after i had a display bug, i can figure out be when i was moving around the nurb, some part of the nurbs was not displayed.

i suggest you include mouse management in your code to turn around the shape and see possible display trouble (and so dont spent time as me to figure out why content between splines was not ok)

hope this help

Ok thanks, I’ll try that.

Just one more thing, is it better to make one big surface with lots of control points or many object later optimized?

Also, can we make holes?

Technically. Surface is designed by computing point regarding math function (spline)

Interest is you can have complex shape with few point, problem

It s you can not manage boolean operations easyly because you dont substracte

Two shape for getting hole for exemple. Not do it yet but i guess you need to define

Surface to substract with intersection calcultation, after i dont know how to manage…

After, used several nurbs or a big one depend on Your wish i guess, with a

Big nurb, action on one knot will have impact on all the nurb i guess, can be cool for modeling

Tools i guess.

I didnt push my test because i m coding in winter :wink:

But dont hesitates to supply some feedback about Your work, i m very

Interested in!