-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Clarify descriptions of rotation direction in KHR_texture_transform #1624
base: main
Are you sure you want to change the base?
Conversation
My hope is that this brings the spec un-ambiguously into alignment with the existing implementations and sample model. |
I cannot come up with a better explanation of 'counter-clockwise' in U-right V-down space which stays concise. But I fear that saying 'counterclockwise' when it actually looks like 'clockwise' when you look at a drawing may generate confusion also. |
It does look 'counter-clockwise' when viewed as a UV map, as opposed to being viewed on a 3D model. I don't think the spec needs to explain why the two rotational directions are different, just acknowledge that they are and identify which one is counter-clockwise (the UV one). Because the UV map defines what parts of an image a given polygon may sample, it ends up acting a little bit like a camera. If a 3D camera is looking at only one model, and the camera moves or rotates in a direction, a viewer watching the rendered movie may think they're seeing the model move or rotate in the opposite direction. That's actually not why the rotation matrix is non-standard. The non-standard matrix comes from the vertical axis starting at the top of the image and flowing down, instead of starting at the bottom of the image and flowing up. Similar to flipping the handed-ness of a coordinate system, this causes the rotation math to flip. But if you had a glTF-enabled UV editor, showing the UV map lines on a right-side-up image the normal way, it would appear as a counter-clockwise rotation on the UV map editor.
We can just tell existing implementations that they don't need any change. If the sample model works, it's good. |
Yeah, it does look counterclockwise on a drawing with x-right, y-down. You are right, the spec. is not the place to explain how the final image on the model is rotated. To me, the simplest, non-ambiguous way is just to specify the transform matrix calculation as m = T x R(-angle) x S, and omit implementation details. |
Lgtm. I think it's fine as is, but if you want to further clarify you can always include a picture. |
Thanks @scurest and @andreasplesch. @lexaknyazev I know your plate is full, but do you have time to look at this too? No rush. |
+1 on including a picture.
What's the intent of this note? Should all new implementations also support only uniform scaling? |
Perhaps this needs rewording. The problem is that this extension can't express both rotation and non-uniform scaling at the same time without shearing the texture image on the final 3D model. Frustratingly, the extension spec is worded as if to prevent shearing via an affine transformation, but this only protects lines on the UV map itself from shearing. The actual image on the 3D model will become sheared if the UV math is followed as specified here, which is why ThreeJS has declined to bring their implementation into alignment with this spec. (see thread) |
Ping. |
This is a fairly important correction to the KHR_texture_transform extension I think, it would be great to get this merged! |
…cation # Conflicts: # extensions/2.0/Khronos/KHR_texture_transform/README.md
I've fixed the merge conflicts and cleaned this up a bit. I do not have time to design and create a full diagram to add to this spec, and I don't think it's required here. I think this is ready to go now. At least one approval (other than me) is required. |
We might want to wait until the merge of the PR on the KHR_texture_transform side. I still have low confidence about the wording KhronosGroup/glTF#1624
The rotation direction is in which rotates UV coordinates counter-clockwise (in U-right, V-down space) Ref: KhronosGroup/glTF#1624
I think that this should correct about |
@TokageItLab It's tricky to communicate because moving the texture coordinates is the opposite of moving the texture. For example, if all of the UV coordinates slide towards the right side of an image, a user watching the render output will see the texture image on the polygon sliding to the left. Likewise for clockwise vs. counter-clockwise rotations. We do have test models to get everyone on the same page, and those have not changed since this extension was first introduced (and will not change as a result of this PR's clarifications).
|
I prefer this sentence.
So for more clarification, I would like this sentence to apply to the entire KHR_texture_transform, not just the rotation only. |
I've added a note that these transformations are applied to the texture coordinates as supplied by glTF, not to device-local coordinates. |
@emackey How is going with this change? My coworker recommends that showing a matrix on the specification is very useful to understand the spec correctly. |
I'm not planning to make additional changes to this branch. Maintainers, please either merge this or close this. If there are additional concerns, they can be opened as a new issue, to be addressed in a new PR. |
I've tried to clarify the wording about what "counter-clockwise" means in a space where the vertical axis points down instead of up.
Fixes #1563, see detailed discussions there and in linked issues.
/cc @andreasplesch @scurest