How to change texture per instance in InstancedMesh?

Hello, I’m new to three.js. How does that possible if my mouse moves to the ball, it changes the texture instead of changing the color?

Because I saw the document, the methods only setColorAt and setMatrixAt can control the ball, how do I change the texture? Thanks.

if you check how those methods work, you’ll see that they just alter the values in attributes, while textures end up being set via uniforms. however, you could have an attribute of indices into a texture atlas, for example. in simpler terms, it not quite possible but you can fake it.


Thanks, is there any sample code I can reference?

related How to set different textures on each InstancedMesh?



1 Like