dispose uv1 ? #610
-
Hi Don et.al., Is it possible to remove TEXCOORD_1 from glTF models using glTF-Transform? I suppose it would be similar to disposing of vertex colors? #309 The reasoning is to strip out the unused 2nd uv to solve unwanted three.js behavior with our models, see mrdoob/three.js#24325 Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This could be done a bit more simply if you know exactly which textures and extensions are (or are not) used by the models you're processing, but here's a conservative solution to:
import { TextureInfo } from '@gltf-transform/core';
for (const graphEdge of document.getGraph().listEdges()) {
const graphChild = graphEdge.getChild();
if (graphChild instanceof TextureInfo) {
graphChild.setTexCoord(0);
}
}
for (const mesh of document.getRoot().listMeshes()) {
for (const prim of mesh.listPrimitives()) {
for (let i = 1; !!prim.getAttribute(`TEXCOORD_${i}`); i++) {
prim.getAttribute(`TEXCOORD_${i}`).dispose();
}
}
} This could be used in a script with node.js, or run in the script tab at https://gltf.report/ — |
Beta Was this translation helpful? Give feedback.
This could be done a bit more simply if you know exactly which textures and extensions are (or are not) used by the models you're processing, but here's a conservative solution to:
TEXCOORD_N
vertex attributes for N ≥ 1