The back side of the model does not reflect light
Tried: side: THREE.DoubleSide, but did not work
loader.load(
'assets/Untitled.glb',
function (gltf) {
main_story.add(gltf.scene);
gltf.scene.traverse((child) => {
if (child.isMesh) {
child.geometry.computeVertexNormals();
child.material = new THREE.MeshPhysicalMaterial({
color: 0xffffff,
metalness: 0.4,
roughness: 0.1,
clearcoat: 1.0,
clearcoatRoughness: 1,
// thickness: -1,
// envMapIntensity: 1.0,
// normalScale: new THREE.Vector2(1, 1),
});
child.geometry.attributes.normal.needsUpdate = true;
child.geometry.attributes.position.needsUpdate = true;
child.material.needsUpdate = true;
child.receiveShadow = true;
}
});
camera.position.set(0, 0, 2);
camera.lookAt(0, 0, 0);
// After loading your geometry
gltf.scene.traverse((child) => {
if (child.isMesh) {
// Flip the model by scaling it negatively on one axis
child.scale.x *= -1; // This will flip the model horizontally
child.geometry.attributes.position.needsUpdate = true;
child.geometry.attributes.normal.needsUpdate = true;
}
});
},
undefined,
function (error) {
console.error('An error happened loading the GLTF model:', error);
}
);