Skip to content

dispose uv1 ? #610

Discussion options

You must be logged in to vote

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:

  1. reassign all material texture slots to use texCoord=0
  2. remove all TEXCOORD_N vertex attributes for N ≥ 1
  3. dispose of associated accessors
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

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by echadwick-artist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants