question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

glTF and Blender export : corrupted normals + vertices data

See original GitHub issue

I’m trying to load a single triangle exported to glTF directly from Blender, using Daniel Stokes’ exporter.

.blend file can be downloaded here

image

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:

image

(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:

image

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…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
mrdoobcommented, Nov 8, 2016

One could argue that the main reason glTF hasn’t taken off yet is because of the lack of exporters…

3reactions
yrnscommented, Nov 11, 2016

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

glTF Re-Export Vertex Normals Issue
I've created an animated glb and all works well when exported the first time. problem starts when i import it back to blender...
Read more >
Blender export limit or user error?
Things I've tried: BOTH Object key-frames, AND BONE weighted POSE animation with Vertex Group. similar results, feels like a cut off.
Read more >
glTF 2.0 — Blender Manual
Discontinuous UVs and flat-shaded edges may result in moderately higher vertex counts in glTF compared to Blender, as such vertices are separated for...
Read more >
Game Engine Export — AutoRigPro Doc documentation
Exporting actions that are not linked to the rig may potentially corrupt the character animation. To see why, open the Action window of...
Read more >
Wrong Normals When Blender Export Object File To Webgl - ADocLib
js contains class definitions and global functions that will convert a model defined in an.obj data file into a set of 1D arrays...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found