Load glTF into WPF 3D with a simple viewer

I have started on a project that involves loading resources in the new glTF format, namely the planets 3D model created by NASA.

I just needed a very basic, simple glTF loader, so I just used the glTFLoader code.

Most of the information in the downloaded glf files seems straight forward to load, but I’m having some issues with the order in which the different items are loaded in the Accessor, and I can’t really see this covered in the documentation. So I have the Vec3 format, but I don’t know if this is the points or the normalized vectors. They seem to be the same in my case, and I can’t find any information on the items themselves.

I have also assumed that Vec2 is the texture format, but again, I don’t really find this documented anywhere.

I am able to load the shape by setting the material to a fixed color, or by manually loading some simple texture coordinates, but the image is not placed correctly with the Vec2 coordinates.

I would like to share the C# code, which is less than 200 lines, but it seems I can’t do that here.

You cannot tell from the accessor alone. The attributes of a mesh tell you what the semantic is, e.g. positions, normals, tex coords - see glTF spec - Meshes section.

I believe this is a restriction for new forum users to limit the amount of spam from bots, AFAIK it gets lifted automatically after a while.

Thank you.

I was rescaling the points to change the size of the objects and accidentally rescaled the normalized vectors.

The problem with the code is that it thinks it contains web links and refuses to let me post it.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.