So I’m dealing with InstancedMesh and trying to UV map per instance, but the only thing I get is instances with filled solid colors, each instance has different solid color so seems it works somehow! btw I don’t use a RawShaderMaterial, using threeJs standard material.
any help will be appreciated
this’s my code :
const _material = new THREE.MeshBasicMaterial({ map : _texture });
const _InstancesRef = [
{ uv:[0,0.5, 1,0.5, 0,0, 1,0] },
{ uv:[0,1, 1,1, 0,0.5, 1,0.5] }
];
const _totalInstances = _InstancesRef.length;
const _geometry = new THREE.InstancedBufferGeometry().copy( new THREE.PlaneBufferGeometry( 4, 2, 1 ) );
let uv = new Float32Array( _totalInstances * 8 );
for(let i=0,l=_totalInstances; i<l; i++){
const UV = _InstancesRef[i].uv,
idx = i*8;
for(let j=0; j<8; j++){ uv[idx+j]=UV[j]; }
}
_geometry.setAttribute( 'uv', new THREE.InstancedBufferAttribute( uv, 2 ) );
const _InstancedMesh = new THREE.InstancedMesh( _geometry, _material, _totalInstances );