-
Notifications
You must be signed in to change notification settings - Fork 63
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
Feature request: GLB to GLTF preserving bitmap file names? #201
Comments
I've thought about this on occasion. One concern is security, if you "import" a GLB to glTF, it could end up overwriting a lot of images in the same folder. With the current system, all of the images written are known to fit a certain pattern of names starting with the user's selected base name. But with this suggestion, all sorts of names in the same folder could potentially be overwritten. I can see the potential usefulness, but I'm hesitant because of the implications. And for my cases, the final shipped product is usually the GLB, so the filenames aren't needed there. |
I think when we update the GLB format someday (perhaps due to this), we should ensure that glTF to GLB and back will always round trip perfectly, including the file names and should take any external reference (even from extensions) into account. The file names can be stripped from a GLB if necessary for optimal size. If we did that, then this will be a non-issue. |
When I don't want to overwrite existing files, I direct the VSCode to a new folder. It would be nice to add a warning message asking if we want to overwrite or cancel. |
If you stripped names, that makes sense from an efficiency standpoint. However it makes editing much more difficult, if textures are just named as numbers. For example if I'm editing a glTF with variants, and I discover a roughness texture is rendering incorrectly, I need to edit find the rough texture for that material so I can edit the pixels. But the extracted textures are named with integers, not descriptive names. I can't go back to the source model in my DCC, since it doesn't support variants. Re-exporting would overwrite the variants editing I did in the glTF file. So instead, now the glTF and its textures are my source files that I need to edit. Perhaps when you extract the GLB into glTF + BIN + textures, you could name the textures using a pattern: materialname_texturename.ext For example if we look at AlphaBlendModeTest sample model, an extracted texture could be named Then just strip those back down into incremental integers when you write out the GLB? |
This isn't as simple as it sounds. Multiple materials can point to the same texture and then the naming is hard to determine. I ran into this in my tool. |
How about just naming based on the first instance you encounter then? Art teams rely heavily on asset naming conventions. Ditching them for compression makes sense, but they're still really important for authoring. |
It's certainly possible, though it is probably more complicated since it would require traversal of the glTF scene graph. This is non-trivial especially with extensions. If the images had a name associated with it in the glTF, I suppose it is possible to use that? Perhaps people should be using loose glTFs instead of GLBs if it's not the final form? |
Usually glTFs are distributed in binary form, it's just easier. I keep telling people it's meant to be a compressed display format, not a source format, you shouldn't treat it like a source file. Even if they're compressed/lossy, people will still want to use them as a translation format, and thus want to edit GLBs. Anyhow, if it's too difficult, it's not really a big problem. Just an annoyance when editing to have the names go a bit "anonymous". |
GLBs aren't compressed by itself. It's a way to contain the loose files into a binary form. It doesn't even have to be one file. GLBs can also point to external files but almost no one does this. That said, yeah, people use GLB to distribute since it's almost always one file and it's easier. |
Could the GLB to GLTF converter preserve original bitmap file names?
When I convert a GLB into GLTF, the embedded bitmaps are renamed as glb-filename_img#.ext. The original bitmap filenames are preserved in the "textures": "name": strings, just not in the actual image filenames.
It would be helpful to retain the original names, as they're often easier to debug with since they're often descriptive names.
(BTW, this extension is amazing! Thanks Ed and everyone working on this!!)
For example, a snippet of the generated GLTF:
The text was updated successfully, but these errors were encountered: