1
$\begingroup$

I have a glb file that should already have the UV mapped correctly and appears to be the case when I load it into Google's Model-viewer. However when imported into Blender, or even Adobe Dimension, it comes in distorted at about 10% in the y-axis and 50% in the x-axis scales.
e.g the Scale values are:
X: 0.5
Y: 0.1
Z: 1.0
but looks correct at
X: 0.25
Y: 1
Z: 1.0

Is there something stupidly obvious that I'm missing?

I can upload the glb file if required.

Thanks in advance.

Object in https://modelviewer.dev/editor/

Object in Blender

Object in Adobe Dimension

Nodes

GLB file

$\endgroup$
5
  • 1
    $\begingroup$ Would you mind not only showing the Mapping node? Those values alone don't say very much without knowing what is plugged in there and maybe a screenshot of the UV layout might help as well, since it "should already have the UV mapped correctly", but just because it should that doesn't necessarily mean it really has. $\endgroup$ Commented Jan 12, 2023 at 7:09
  • $\begingroup$ "I can upload the glb file if required." Please do. $\endgroup$
    – scurest
    Commented Jan 12, 2023 at 13:51
  • $\begingroup$ @GordonBrinkmann, there was nothing else in the nodes that was different from normal, so didn't think it was relevant. I have attached the glb. Note that I didn't create this original file, I'm just trying to add materials that I've already created to it and re-export as glb files. $\endgroup$
    – Ben
    Commented Jan 12, 2023 at 21:35
  • $\begingroup$ @Ben Yeah, sorry for asking about more details, but I was trying to find out what might be wrong on the Blender side - and as long as I don't see what is done there I can assume nothing is "different from normal" but I do not know for sure. And not everything working in Blender is familiar with glTF and knows about the issues which are explained in the given answer here... $\endgroup$ Commented Jan 12, 2023 at 21:45
  • $\begingroup$ No, that's alright, I understand. I clearly do not know about the issues with glTFs and Blender but am definitely trying to learn. $\endgroup$
    – Ben
    Commented Jan 12, 2023 at 21:56

1 Answer 1

0
$\begingroup$

There's a long-standing issue with UV transformations in glTF, that stems from rotated non-uniform scaling as shown in your node above.

As always, "order of operations" matters, and UVs have an extra wrinkle with the ordering of rotation vs. scaling. If one comes before the other, the 2D plot of UV coordinates will not be sheared, but the texture image in the final render may appear sheared. Using the opposite ordering, the final texture image will not shear, but the 2D plot of UV space will appear sheared.

In glTF, for historical reasons, the KHR_texture_transform extension specifies the former. But some client implementations, including ThreeJS and model-viewer, insist on the latter, contradicting the glTF spec for compatibility with their own historical texture transform implementations.

So although your model "looks right" in model-viewer, technically it's not following the KHR_texture_transform spec exactly. Blender and Adobe Dimension are showing you the truth of what's been specified. The only way to get it working "everywhere" is to avoid using both rotation and non-uniform scaling in the same texture.

For further reading, see this issue: https://github.com/KhronosGroup/glTF/issues/1563

and this PR: https://github.com/KhronosGroup/glTF/pull/1624

$\endgroup$
2
  • $\begingroup$ I have other materials I'd already created and want to reapply them to this model (and 100+ others), but due to the import scale error, it's looks off when applied. So am I understanding that the only thing I can do is for everything to realign is to remove the rotation and adjust the UV scale? $\endgroup$
    – Ben
    Commented Jan 12, 2023 at 21:18
  • $\begingroup$ If the issue is model-viewer is using SRT instead of TRS order (and it does appear to be), then the problem isn't just rotation + non-uniform scale. You also cannot (1) use a location and rotation together, or (2) use either a location or a rotation with a non-uniform scale. $\endgroup$
    – scurest
    Commented Jan 12, 2023 at 23:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .