Skip to content

glb model is not visible #2876

Closed Answered by donmccurdy
bortomar-intellmaps asked this question in Q&A
Discussion options

You must be logged in to vote

As Felix suggests above, the cause of the issue is the large transform on the model. I processed the model to remove that transform by opening it in https://gltf.report/ and applying the script below:

import { center, flatten, transformMesh } from '@gltf-transform/functions';

await document.transform(center(), flatten());

const scene = document.getRoot().getDefaultScene();

scene.traverse((node) => {
	const mesh = node.getMesh();
	if (!mesh) return;

	transformMesh(mesh, node.getMatrix(), true)

	node.setMatrix([
		1, 0, 0, 0,
		0, 1, 0, 0,
		0, 0, 1, 0,
		0, 0, 0, 1,
	]);
});

With that the transforms are removed and the model is centered in a box near the origin, with bounds <10 meters…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@donmccurdy
Comment options

@bortomar-intellmaps
Comment options

@felixpalmer
Comment options

@donmccurdy
Comment options

Answer selected by bortomar-intellmaps
Comment options

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