Thanks!
Successfully added vertex color to each of the geometry
https://jsfiddle.net/orion_prime/xqLskny5/6/
output test on updated gltfViewer !
snippet
const color = new THREE.Color();
for (const mesh of allMeshes) {
const count = mesh.geometry.attributes.position.count;
const geometry = mesh.geometry.clone();
geometry.setAttribute( 'color', new THREE.BufferAttribute( new Float32Array( count * 3 ), 3 ) );
const colorAttr = geometry.attributes.color;
color.copy(mesh.material.color)
for ( let i = 0; i < count; i ++ ) {
colorAttr.setXYZ( i, color.r, color.g, color.b );
}
geometry.applyMatrix4(mesh.matrix)
geometries.push(geometry);
}
const mesh = new THREE.Mesh(THREE.BufferGeometryUtils.mergeBufferGeometries( geometries ), mergedMaterial)
mesh.position.z= 2
scene.add(mesh)
Now how do i do the UV method ? each geomtery’s uv points needs to be offset to a certain color of the atlas image