How to get the texture offset and repeat values? #1094
Answered
by
donmccurdy
CITIZENDOT
asked this question in
Q&A
-
|
three.js has Texture.offset and Texture.repeat. I know this is not included in GLTF spec, I just want to know if there is a way to access these properties. |
Beta Was this translation helpful? Give feedback.
Answered by
donmccurdy
Sep 14, 2023
Replies: 1 comment 1 reply
-
|
In glTF this is handled by the
To get the offset and scale of the base color texture, for example, you'd write: const textureInfo = material.getBaseColorTextureInfo();
const transform = textureInfo.getExtension('KHR_texture_transform');
if (transform) {
const offset = transform.getOffset();
const rotation = transform.getRotation();
const scale = transform.getScale(); // equivalent to THREE.Texture's .repeat property
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
CITIZENDOT
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In glTF this is handled by the
KHR_texture_transformextension. You can see glTF Transform's implementation here:To get the offset and scale of the base color texture, for example, you'd write: