I’m trying to load a single triangle exported to glTF directly from Blender, using Daniel Stokes’ exporter.
.blend
file can be downloaded here
Vertices at (1, 0, 0)
, (0, 1, 0)
and (0, 0, 1)
. The equivalent JSON is this (removed the metadata):
{
"faces":[32,0,2,1,0,0,0],
"name":"PlaneGeometry.2",
"vertices":[0,-0,-1,0,1,-0,1,0,0],
"normals":[-0.57735,0.57735,0.57735]
}
This is the triangle.gltf
file exported from Blender.
I slightly modified the exporter for printing out the vertices and normals, and they were correct. (I put a print(co[j])
and print(normal[j])
in blendergltf.py:518
)
I have to export with selection only checked. If it is unchecked, nothing appears on the scene.
Result: the mesh is corrupted. Normals are wrong and one vertex is bad — Something get mixed in the bufferViews/accessors/whatever that it mixes some values from normals and vertex positions. If you try to import the triangle.gltf
in the threejs editor, it looks like this:
(the red dot is where that stranded vertex is supposed to be)
I also used aframe-gltf.js
loader from @richtr and same happens. If I use developer tools to debug the loaded mesh, it shows:
I guess @Kupoman , @richtr or @xirvr may want to take a look. I hope this is not a trivial problem caused for something I did wrong, the scenario is so simple I cannot grasp what I could have done wrong..
One could argue that the main reason glTF hasn’t taken off yet is because of the lack of exporters…
I’ll try to verify if it’s an exporter problem, ask in their repo, and keep you informed. Thanks.
@feiss I’ve been hacking on the glTF exporter and loader. I believe the issue you’re facing is that the exporter is exporting interleaved buffers. Three supports these, but the importer does not (yet). I can submit a PR.