The 3D model renders black at first and later their texture/png image loads on the model. I need to render the 3d with full texture without black image shown first. If I use loadasync, it waits just for the object to render and not the texture.
Here’s the code snippet:
const loader = new FBXLoader()
const [obj1, obj2]= await Promise.all([
loader.loadAsync(‘/beanbag.fbx’),
loader.loadAsync(‘/model.fbx’)
]).catch(error => {console.error(error)});
obj1.position.y = 6
obj2.position.y = 6
obj1.scale.set(0.01, 0.01, 0.01)
obj2.scale.set(0.01, 0.01, 0.01)
scene.add(obj1, obj2);
const canvas = document.querySelector(‘.webgl’)
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true
})
renderer.setSize(sizes.width, sizes.height)
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2))
renderer.setClearColor(0xf8a5c2)
renderer.outputEncoding = THREE.sRGBEncoding
renderer.shadowMap.enabled = true