You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, wasn't sure if this is something that should be proposed in a PR, so I thought I'd float the idea around here first.
Raylib currently supports loading models in various formats (OBJ, GLTF, and a few others). However, exporting only supports OBJ through ExportMesh(), and while said function is made to be able to be extended with other formats, it is restricted in a number of ways:
It cannot save material data (seemingly not skeleton data either, though I haven't looked well at how animations work with Raylib yet, so I won't assume).
It doesn't allow for passing any export options.
For OBJ, this means we can't pair exported meshes with an MTL file, which would also need to be generated separately. When implementing GLTF/GLB, it not only means we won't be able to include images in them, but even if we did, we also couldn't let the user choose the way data is to be included (embedded buffers or stored separately as .bin and .png/jpg). I don't know how it is for .m3d, .iqm and .vox, but I'd bet at least one of those will also be affected by these restrictions one way or another once they are implemented.
I think the way to get over these restrictions would be to...
Separate each format export process into their own function (currently just OBJ, so ExportOBJ(), but in the future also others like ExportGLTF(), etc. ), each with their potential options passed as arguments.
Change ExportMesh() to call these functions, with default options.
Create a new function ExportModel() to also call these functions with default options, but with access to variables from Model so it could also include material data.
Below's a rough idea of what this would look like (please excuse my tragic mockery of UML):
I personally need to implement more export functionality for the program I am working on, so I thought I might as well offer to build it directly in Raylib. This would however require adding new functions and restructuring an existing one, so I thought it'd probably be best to share my idea and get feedback before starting work on it. Obviously @raysan5 but I also want to see what other people think about it all. I understand model exporting is not a commonly used feature, but I feel that given the use of Raylib not just for videogame development but also for the creation of other kinds of graphical applications, it could greatly help those making programs in any way related to 3D model editing.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there, wasn't sure if this is something that should be proposed in a PR, so I thought I'd float the idea around here first.
Raylib currently supports loading models in various formats (OBJ, GLTF, and a few others). However, exporting only supports OBJ through ExportMesh(), and while said function is made to be able to be extended with other formats, it is restricted in a number of ways:
For OBJ, this means we can't pair exported meshes with an MTL file, which would also need to be generated separately. When implementing GLTF/GLB, it not only means we won't be able to include images in them, but even if we did, we also couldn't let the user choose the way data is to be included (embedded buffers or stored separately as .bin and .png/jpg). I don't know how it is for .m3d, .iqm and .vox, but I'd bet at least one of those will also be affected by these restrictions one way or another once they are implemented.
I think the way to get over these restrictions would be to...
Below's a rough idea of what this would look like (please excuse my tragic mockery of UML):
I personally need to implement more export functionality for the program I am working on, so I thought I might as well offer to build it directly in Raylib. This would however require adding new functions and restructuring an existing one, so I thought it'd probably be best to share my idea and get feedback before starting work on it. Obviously @raysan5 but I also want to see what other people think about it all. I understand model exporting is not a commonly used feature, but I feel that given the use of Raylib not just for videogame development but also for the creation of other kinds of graphical applications, it could greatly help those making programs in any way related to 3D model editing.
Anyway thanks for reading, have a great day!
Beta Was this translation helpful? Give feedback.
All reactions