GLTF Loader, error computevertexnormal

Hi, What is wrong in here?? why isn’t it working?

If i am using stl file format, it is working fine. but when i am trying to use glb there is an error with computevertexnormal.

const threeGlasses = new THREE.Object3D();
const loader = new THREE.GLTFLoader();
   loader.load( 'models3D/glasses.glb', function (glassesFramesGeometry) {
		glassesFramesGeometry.computeVertexNormals();
		const glassesFramesMesh = new THREE.Mesh(glassesFramesGeometry);
		threeGlasses.add(glassesFramesMesh.scene)		
   });

could you guys please suggest, how can i use computevertexnormal function with gltf. or if ithere is any other method. please suggest

The result of GLTFLoader is not a geometry object, it is a Group. There is no need to create a new Mesh for it.

Is there some reason you need to compute vertex normals manually? Most models have them already, if they need them. See the docs here or refer to this example. Instead:

   loader.load( 'models3D/glasses.glb', function (gltf) {
		threeGlasses.add(gltf.scene)		
   });

thank you…

Hi i am trying to load this modelout1.glb (412.6 KB) but when it loads, there are no textures, model is completely black in color. how do i add base color

Please see the troubleshooting documentation, and particularly the guidance on testing your model in a viewer. In this case the model works in a viewer, so the problem is in your code. You will need to share your code for us to help. Perhaps you don’t have lights in the scene?

2 Likes

thank you… there was issue with light… :grinning: :grinning: :grinning: