Hi,
I’m trying to realize is it possible to change attributes of InstancedMesh and update it ? I’m trying to change custom attribute (uv offset that used in shader) in render() by getting this attribute and change its values and set instanceMatrix.needsUpdate = true; but nothing happened… what I’m doing wrong?
The code in render():
... let uvOffsets = instancedMesh.geometry.getAttribute( 'instanceUV'); for(let k=0; k<uvOffsets.count;k++) { uvOffsets.setY(k,0);//reset all inited uv values } instancedMesh.instanceMatrix.needsUpdate = true; ...
Also would like to know is it possible to hide some of the instance instead of move it off screen somewhere ? And if it moved somewhere off screen/camera will it be also rendered and be a performance issue?
UPD Forgot notice that all shader modification is inside of onBeforeCompile of a material. I hope it executes not once?