Metal API supported files for models?

Hello everyone! I have a small concern about one little thing when it comes to programming in metal. There are some models that I wish to use along with animations and skins on them, the file extension for them is called gltf. glTF has been used in a number of projects such as unity and unreal engine and godot and blender. I was wondering if metal supports this file extension or not. Anyone here knows the answer?

Answered by in 763910022

Hi CuriousAsking123,

Metal is a lower level graphics API on top of which other engines (such as Unreal and Blender) are built. As such, Metal doesn't directly handle 3D model formats, instead, it deals in terms of buffers and textures.

In order to bring a model in any specific format directly into Metal without help from the rest of an engine, you would first need to implement a loader for this file format (or use a third party library), which places the vertex and animation data into buffers. Next, you would bind these buffers to your render pipelines and implement the logic necessary to draw them on the screen.

Accepted Answer

Hi CuriousAsking123,

Metal is a lower level graphics API on top of which other engines (such as Unreal and Blender) are built. As such, Metal doesn't directly handle 3D model formats, instead, it deals in terms of buffers and textures.

In order to bring a model in any specific format directly into Metal without help from the rest of an engine, you would first need to implement a loader for this file format (or use a third party library), which places the vertex and animation data into buffers. Next, you would bind these buffers to your render pipelines and implement the logic necessary to draw them on the screen.

Warren Moore wrote a library called GLTFKit for importing glTF files and rendering them in Metal. I've used it successfully in projects. You can find it at:

https://github.com/warrenm/GLTFKit

I seem to recall someone saying something about a newer version, so you might want to look around for that.

You might be able convert gltf to usd using some Apple content tools AFAIK. ModelIO is what you want to use for loading or creating models. But ModelIO removed fbx support, so now you have to use tools to convert fbx to usd which is quite lossy (f.e. losing all textures, etc). Or there are open-source fbx processors.

Metal API supported files for models?
 
 
Q