Can a NURBS surface be loaded from Blender?

Hello, I created a NURBS surface sphere in Blender exported in glTF 2.0 format. However, when loaded it with THREE.GLTFLoader, it was not visible. Next I added cube mesh superimposed over the NURBS surface sphere and only that is visible but I would expect to see this - imageIs there any way to correctly load a NURBS surface sphere? Here is the blender file.

glTF does not allow NURBS — realtime engines like three.js cannot render them without triangulating them first, so that triangulation is meant to happen before export. I’d recommend converting the surface to a mesh in Blender first before exporting to glTF. It might be worth filing a bug on the exporter (https://github.com/KhronosGroup/glTF-Blender-IO) to have that happen automatically.

2 Likes

I’ve never tried it before, but there’s an example that appears to load NURBS via FBXLoader. I’m not entirely sure what it’s doing under the hood, and I don’t know what’s inside the .fbx file, but it might be worth looking into:

https://threejs.org/examples/?q=nurbs#webgl_loader_fbx_nurbs

Good find! It looks like it just supports THREE.NURBSCurve, though, which would mean you get NURBS curves, converted to lines, but not surfaces. three.js does also have a THREE.NURBSSurface class, although I don’t know if any loaders support it. It still has to be converted to a BufferGeometry for rendering though, so your life will probably be simpler if you can triangulate it before export. :slight_smile:

Agreed. I saw a post on Twitter earlier this week by Lars Berg that generates NURBS using this library and it looks like a lot of work. If @shane already has the geometry built in Blender, it’s definitely simpler to just triangulate it and export.