-
Notifications
You must be signed in to change notification settings - Fork 317
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
Option for Interleaved Vertex Attributes #1358
Comments
So far we've mostly avoided providing low-level technical options in this Blender exporter. Generally speaking, it is much easier to leave advanced optimizations to dedicated tools (glTF-Pipeline, gltfpack, glTF-Transform) and to focus on supporting Blender's features the best that we can. I'll leave to others whether this optimization falls into that category, or should be supported. In any case, a quick workaround would be to interleave the vertices after exporting. This is pretty easy in the CLI: https://gltf-transform.donmccurdy.com/cli.html
The default for any command in that tool is actually interleaved, but I've heard complaints that some viewers do not support interleaved vertices (that would be a bug in the viewer, but is out of my control) and so added the global option |
Interleaving vertex attributes is outdated advice. There's little benefit these days - you'd be hard pressed to measure a difference. If you're doing stuff like a depth prepass when you only use a few of the attributes, you will instead win a lot by keeping them separated instead of interleaved. |
There are some indirect benefits of interleaved vertex attributes, like minimizing the total number of WebGL buffers used for the scene (see this thread). But I don't have real numbers on this, and would be very interested in a real comparison on modern graphics APIs. But I think I'm inclined to agree that this is out of the scope that Blender's exporter should need to deal with, and should be left to tools focused on glTF optimization (e.g. glTF-Pipeline, gltfpack, glTF-Transform, RapidCompact, ...). Correct import/export in Blender is a big enough project. |
@hrydgard Any references for your claim? Would really be interested in understanding this deeper. Thanks! |
Your original link is from 2013. Since then GPUs have gained more general caching systems that work more like on CPU, and with that, it's pretty obvious that if you sometimes need to access one of the vertex streams separately, as with Z-prepass or shadow map rendering where you only use position, it'll be better to have them separate, otherwise when doing so the GPU will load lots of irrelevant data into the cache. Depending on attribute usage patterns, the optimum can even be to have positions separate and everything else interleaved, but the wins either way are very small. This is all kind of received knowledge in the graphics community, not so easy to find good references, but there's this from 2016: https://anteru.net/blog/2016/storing-vertex-data-to-interleave-or-not-to-interleave/ ARM actually recommends mixed deinterleave: https://developer.arm.com/solutions/graphics-and-gaming/developer-guides/learn-the-basics/the-bifrost-shader-core/index-driven-geometry-pipeline Anyway, again, it's generally not what's gonna be your bottleneck these days. |
Having interleaved vertex attributes is supported by glTF format. However, the exported doesn't expose interleaving of attributes; it would be more performant to have attributes intersparsed. It'd be great to get an option to enable it if needed.
This would mean
byteStride
for each attributeThe text was updated successfully, but these errors were encountered: