For the file reading, I will be using https://github.com/javagl/JglTF java library. It looks pretty complicated, but let's see if I can first extract at least the positions of vertices (points) of the underlying mesh (3/N)
Comments
Log in with your Bluesky account to leave a comment
Next step is to render the surface as a collection of triangles.
The first attempt relies on my naive assumption that in an array of vertices the triangles are encoded sequentially: vertices (0,1,2) triangle 1, vertices (3,4,5) triangle 2, etc
Clearly, it is not the case (6/N)
In practice, triangles are often encoded by "vertex indices", to reduce the amount of data. So two triangles with the same edge will have vertex indices (0,1,2) and (1,2,3). So vertices are "reused", just 4 vertices (not 6) for 2 triangles.
Now I need to see where to get those indices. (7/N)
All right, almost there. The indices are loaded, but the normales (vectors specifying surface orientation) are wrong. So now basically it is kind of inside out, the outside is dark, but inside reflects light. Just need to change the order of indices in triangles (8/N)
Comments
The final result looks correct, pretty much like a teddy bear.
I must say that in this rendering mode (without surface/depth), the tail somehow looks unintentionally ambiguous (5/N)
The first attempt relies on my naive assumption that in an array of vertices the triangles are encoded sequentially: vertices (0,1,2) triangle 1, vertices (3,4,5) triangle 2, etc
Clearly, it is not the case (6/N)
Are you ok, buddy?
We had some minor interference during teleportation.
Now I need to see where to get those indices. (7/N)
Now I am going to try to extract a texture: a "skin" image that should be rendered on top of the mesh.
(9/N)