I went ahead and updated a glTF exported from the current version with COLOR_0 instead of _COLOR_0, fixed a couple attribute issues in three.js, and can now load color blendshapes in three:
However, it seems that (in line with what you explained before regarding the alpha channel / absolute vs. relative colors) colors exported from Nomad are supposed to be used with absolute values, that is, color blend shapes replace the original color, by a factor of COLOR_0.a.
I think for better compatibility to the spec (relative application of morph targets), it would be interesting to have a way to store colors more spec-conform on export, so that additively blending color values ends up being the correct layer result (e.g. a layer might have to store negative values to get the right result). I understand that is not always desired (especially not when someone has control over the shader being used and wants to mix these differently).
My test case here was that the color layers can be additively used, that is, the colors of the chamaeleon would nicely blend into each other. Happy to provide a video of how it’s supposed to look, and open for guidance I fully agree that this doesn’t seem to be thought through in the spec though.
Would love to learn more about how this is supposed to work - I think the main reason vertex color morph targets aren’t used is that nobody knows this is possible it’s a pretty cool workflow with Nomad.
Nomad uses gltf for the internal project, so I need the glb export to fully support Nomad’s features.
I thought about using relative values but not for compatibility but rather size optimisation.
With relatives values, I can use a sparse accessor if the layer is partially painted (and since you can use ton of layers in Nomad, it’s a very good candidate).
However with signed difference I’d need to use 16 bit instead of 8 bit, so if the sparse version is bigger than my absolute, then the file will be much bigger if I want to use 16 bit in my absolute accessor.
I was thinking on using COLOR_0 16 bit for signed difference (if sparse smaller) and using _COLOR_0 8 bit for absolute.
I could add a checkbox force relative layer color but I’m not sure yet if it’s worth it.
To be honest I’m constantly struggling with glTF because it’s a Transmission format instead of being an exchange format (no quad, very annoying padding alignement).
For my understanding, currently “Export glTF” then just dumps the existing internal glTF representation into a new file?
At least from a user perspective the expectation would kind of be that while “Save” and “Save As” use the internal representation, on “Export glTF” the goal is to have wider compatiblity to external tools and solutions, so that wouldn’t need to be 1:1 the same as the internal file (e.g. the export could always use sparse accessors and relative mode).
TLDR; the only issue is memory, I need to ensure the export are using low amount of memory (glb, obj, stl).
I don’t know yet what I’ll do but there’ll be a checkbox in case I don’t export relative morph by default.
Internal save vs External save
Nomad internal representation has nothing to do with glTF. But I need glTF export to fully supports Nomad’s stuffs (at least default settings).
People use glb export as a way to store their file somewhere, and then reimport it in Nomad.
Save/SaveAs only saves internally, you cannot choose where to export.
I can have differences between internal and external glb, but if I do so I use the extras glTF key to make sure things can be read back in Nomad.
Color Morph is different in that I decided to use the glTF accessors, but I could have dumped them in extras as well.
In case it’s not clear, I already use sparse accessor in glTF and I couldn’t care less about how things are represented in glTF (I already adjust my base position and most paint channel for example,).
You could argue I need an export internal button, but right now the default glb checkboxes plays that role.
Note that I don’t loose data when using relative Color Morph in glTF, my only issue is the potential higher memory usage.
I can guarantee 100% that I’ll receive “bug report” if either the internal or external save use more memory, because some users use tons of layers (+40), I’ll get stuff like:
Hey, I cannot save/export my project anymore , please help
That’s why export Normal is off by default because it requires tons of memory (the fact that glTF doesn’t support 16bit normal is a bummer as well).