C
C#6mo ago
Legion

✅ Is there a library for processing FBX or GLTF files?

I essentially need to do 2 things: 1. Generate an orthographic image of a 3D model 2. Generate the normals for the same.. I'm trying to find a way to automate the generation of these images for a 2D game so that we only need to use blender for modelling, rather than rendering. A couple of things i've noticed currently are, MixedReality, and GLTF loader, but i don't know if these are relevant to my needs. What I hope to build is a simple commandline tool that loads a directory of model files and dumps the images. The library I need would let me adjust the angle, resolution etc.
6 Replies
bakamono
bakamono6mo ago
I don't think there's a library in C# that would do so much for you, you'll most likely need to implement those things yourself If I were you, I'd definitely pick GLTF over FBX for this task, GLTF is much simpler to deal with and there are plenty of libraries for loading models in GLTF, FBX on the other hand... it's way more complex and the only reliable library is proprietary and written in C++ About the mentioned FbxSharp:
The bindings were built to support the Fbx Exporter package (com.unity.formats.fbx).

The bindings are a subset of the FBX SDK, and in particular they do not support all that you would need for a general-purpose importer.
The bindings were built to support the Fbx Exporter package (com.unity.formats.fbx).

The bindings are a subset of the FBX SDK, and in particular they do not support all that you would need for a general-purpose importer.
You'd most likely need to write a wrapper for the C++ code in C and then make bindings for this wrapper, I don't think it'd be worth the time in the slightest Adjusting the angle, resolution, etc is very simple, it's basic linear algebra and there are plenty of libraries that will make correct view and projection matrices for you For rendering just pick any graphics API and write a very simple renderer
Дядя Женя
much easier to make blender plugin instead of all of that. You will need to create / find rendering engine, shaders etc. All of which are already embedded in blender If you need that for Unity, however, unity can also act as rendering engine, and in case you're ok with the result quality just load all of the models to unity, bump it on the scene and render to texture via script, no need in 3rd party plugins for that
Legion
Legion6mo ago
i was hoping to bypass blender for rendering because it seems rather difficult to systemise the process, on top of learning python lol. But i might have to agree once i've exhausted all other options. im using Godot :P It does seem like it might not be worth it yes. I just wish I had an on hand method of going from 3D to 2D at the simple run of a script lol
bakamono
bakamono6mo ago
Writing plugins for blender is... a bit painful Well, you could use Godot to automate this process like, have a script that loads models one by one, renders them to textures and saves to a file on disk
Legion
Legion6mo ago
i've been looking for ways for godot to do that im not currently sure there is a way to render a 3d model in godot to a png might actually work, in 2D i've captured the viewport with a transparent background, in 3D assuming im using an orthographic camera, i should be able to create a separate program to loop through a collection of models. assuming that works, i just need a way to do the same with the normal maps thanks :)
bakamono
bakamono6mo ago
glad I was able to help :^)