three.js
three.js copied to clipboard
FBXLoader: Incorrect mesh parsing
Apparently it loads correctly in Unity. Thanks @jcarpenter for the files.

/cc @looeee
@mrdoob it's on my todo list 👍
The issue here is that the polys have greater than 4 sides, which is not currently supported by the loader. Here's the vertex index for one of the letters:
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, -29, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, -43, 14, 15, 1, -1, 15, 16, 2, -2, 16, 17, 3, -3, 17, 18, 4, -4, 18, 19, 5, -5, 19, 20, 6, -6, 20, 21, 7, -7, 21, 22, 8, -8, 22, 23, 9, -9, 23, 24, 10, -10, 24, 25, 11, -11, 25, 26, 12, -12, 26, 27, 13, -13, 27, 14, 0, -14
Negative numbers indicate the final vertex in a polygon - so the first two polygons here have 14 sides. @mrdoob, @jcarpenter do you know what program this was exported from? When I import the file to 3DS max and then re-export it automatically triangulates these faces, even when I disable the "triangulate" option.
We have two options here: support higher order polygons, or log a warning saying that polygons with more than 4 sides are not supported.
or log a warning saying that polygons with more than 4 sides are not supported.
We can start with that.
Maybe this has already been considered but it seems like the Earcut.triangulage function would enable the triangulation of these polygons in the loader fairly easily if someone wants to tackle this.
Was that function always there? 😅
It could probably be used in the LWOLoader too
https://github.com/mrdoob/three.js/blob/dev/examples/jsm/loaders/LWOLoader.js#L818
I think it's been around for a bit but it seems relatively hidden / unknown 😁