GLTF model inside out glitch

I’ve tried everything, frustrum, material side, redo-normals, remade-model…
I dont think it’s related to the model. Something in the code.
I’ve never encountered this before, does anyone know what code error would cause this inside-out behavior for a loaded GLTF?

One common cause for this would be if the model has enabled alpha blending transparency (.transparent = true) on materials that should be opaque.

Try loading the model in https://gltf.report/ and then running the script below in the script tab, to see if that fixes it?

for (const material of document.getRoot().listMaterials()) {
	material.setAlphaMode('OPAQUE');
}

Wow that was difficult to debug. I thought it was a model issues as well. Of course, a dumb typo:

I did this:
this.camera = new THREE.PerspectiveCamera( this.scene_settings.fov, window.innerWidth,window.innerHeight, 0.1,20 );

When it shuold be this:
this.camera = new THREE.PerspectiveCamera( this.scene_settings.fov, window.innerWidth/window.innerHeight, 0.1,20 );

Which led to the camera just doing the wildest things.

Ahhhhhhhh

1 Like