Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the option to interleave vertex data #1504

Open
gabdube opened this issue Dec 16, 2021 · 3 comments
Open

Add the option to interleave vertex data #1504

gabdube opened this issue Dec 16, 2021 · 3 comments
Labels
enhancement New feature or request exporter This involves or affects the export process Mesh_&_Object

Comments

@gabdube
Copy link

gabdube commented Dec 16, 2021

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.

temp

@scurest
Copy link
Contributor

scurest commented Dec 16, 2021

Related #1358.

@julienduroure julienduroure added enhancement New feature or request exporter This involves or affects the export process Mesh_&_Object labels Dec 16, 2021
@bartteunis
Copy link

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.

@donmccurdy
Copy link
Contributor

The new gltfpack post-processing option added in #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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request exporter This involves or affects the export process Mesh_&_Object
Projects
None yet
Development

No branches or pull requests

5 participants