How can i set opacity for each instancedMesh?
Defining opacity values per instance is not supported. The reason for this is explained here:
@Mugen87 Thank you for replay. I understand the reason. Also that mean that no way to take opacity for instanced-mesh.
Add opacity to instancedBufferGeometry with custom shader. If have skill in it.
It has nothing to do with the shader, it’s a order related “issue” as instances unlike the regular scene graph objects are not sorted, InstancedMesh is as static as it can be without updating all the instances matrices every frame.
I release a plugin about end of the week that will cover this sorting issue with a sort option for instances, the API is on top of InstancedMesh but a bit different as you have regular Mesh objects in your scene. It’s the sister component of the SkinnedInstancer that enables optional LOD and culling features also for non-skinned meshes.
The purpose is drawcall batching, InstancedMesh is static and therefore won’t require any further per frame / per object updating or buffer updates which can be a benefit or a huge number- at a bit lower polycount as there also is no culling and everything drawn.
However there are also further ways to archive “order independent” transparency but they are much more complicated and i suppose overkill for your needs.
You can also enable it by slightly modifying the library code.