Rendering NURBS surface in webGL

久未见 提交于 2020-07-15 09:11:05

问题


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


回答1:


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.




回答2:


I would suggest you to start with following two lectures:

Drawing Bézier Curves

Drawing Lines is Hard

and finally, use this WebGL example as starting point for your assignement:

Resolution independent rendering of Bezier curves in WebGL

Good luck and happy coding! If you achieve something good, please let us know!



来源:https://stackoverflow.com/questions/41171096/rendering-nurbs-surface-in-webgl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!