Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rendering NURBS surface in webGL

I need some help with rendering a NURBS surface in webGL. Some days ago our professor assigned us to draw with NURBS a flag and to animate it. We have to use webGL (and cannot trhee.js...). I have no idea on how to proceed (even though I know the theory about NURBS and tessellation more or less). Any hint?

Disclaimer: I'm not asking for a solution. It's against the rules and I want to get it myself. I just need to be pointed on the right direction.

Thanks in advance

like image 834
magicleon94 Avatar asked Dec 22 '25 23:12

magicleon94


1 Answers

Just because you can't use three.js doesn't mean you can't look at it to figure out how it works! This example renders NURBS and you can view the source code. (Hint: It uses THREE.NURBSSurface, THREE.NURBSUtils, etc... which is then plugged into a ParametricBufferGeometry)

As for the WebGL part, if you're familiar with OpenGL, it's a lot of the same stuff just cut back a bit on features. You need to make a canvas with a context WebGL, generate all your data on the CPU (definitions of the surface, tessellation, etc), and then pass all the vertex and index data to the GPU rendering it all with a shader.

like image 194
Cobertos Avatar answered Dec 25 '25 14:12

Cobertos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!