Why can I see through gltf?

Why can I see through my *.gltf file? (see my dev screenshot). Can anybody tell me what they think is going on here? I don’t believe it is related to normals. I’ve found the texture object of the model, and nothing is jumping out at me. I am new to working with gltf and three.js though.

When I view the same file on glTF Viewer, it appears as intended (see following screenshot)

I have tried searching this forum, stack overflow, etc for this issue but have not been able to find an answer. Apologies if this is a duplicate or I’m being foolish haha.

Many thanks; much appreciated!

If the model works in a viewer built in three.js, but not in your own code, then there’s likely something about your code that is causing issues. Can you share any of that code to help reproduce the issue? If your camera’s near and far parameters are very far apart that may cause similar issues, because the depth buffer doesn’t have enough resolution.



I checked my code and you are 100% correct!! The issue was that at some point while tinkering with my camera settings, I had set the ‘far’ distance to ‘0’. Stupid of me!! But solved with your help!! Assigning a value of ‘1000’ (or even ‘500’) to the ‘far’ parameter did the job!!!

{code}camera = new THREE.PerspectiveCamera(fov, window.innerWidth / window.innerHeight, near, far); {code}

Many thanks for your assistance!

1 Like