Open gabdube opened 2 years ago
Related #1358.
The issue on my custom Blender exporter seems to be listed in the discussion here after I linked to it. I might as well elaborate on this a bit as I would also find this a very interesting addition looking from my perspective.
As a user of GameMaker:Studio I tend to use it for 3D games. I have a custom exporter that exports arbitrary vertex formats to a file format that turns out to be quite similar to glTF (binary+json). Ideally I'd like to start adopting glTF for all of this.
From my experience with it I can say that the built-in glTF exporter is clearly already the one that comes closest to a quick and easy import in GameMaker: The JSON can be loaded using a couple of lines of code and the buffers as well. It is from there on that the need for quite a bit of boilerplate code arises since GameMaker currently only supports interleaved data in vertex buffers.\ This means a lot of buffer copying, reading, writing, ... simply to get the data in an interleaved format that can be submitted to the GPU and processed by a shader.
It would therefore be very interesting if Blender's glTF exporter could export interleaved vertex data that can immediately be used in GameMaker:Studio. It would open up a very easy, straightforward way for users of GM to export binary model data from Blender, properly formatted in a buffer and ready for use.
The new gltfpack post-processing option added in https://github.com/KhronosGroup/glTF-Blender-IO/pull/1945 provides interleaved glTF output from Blender. Note that gltfpack applies additional optimizations too. If you're interested only in interleaved vertex streams, then post-processing with glTF Transform would be another option:
npm install --global @gltf-transform/cli
gltf-transform cp input.glb output.glb --vertex-layout interleaved
Is your feature request related to a problem? Please describe.
Interleaving vertex data can be useful for ease of use and optimization (see https://github.com/zeux/meshoptimizer , most of the steps require interleaved geometry), but blender can't export those right now
Describe the solution you'd like Adding an option to interleave vertex attribute while exporting
Describe alternatives you've considered Edit: As mentioned in the related issue, I could use an external tool.
Additional context
I went ahead and tried to implement the feature myself, but this is the first time I ever worked on a blender addon, so the result so far is pretty hacky. You can see my work here: https://github.com/KhronosGroup/glTF-Blender-IO/compare/master...gabdube:gab/interleaving_vertex_data?expand=1
It works for my specific use case, but it is definitely not ready for production. Anyway, if anybody else think this would be a good addition, feel free to ask for changes.