How to appoint different size with InstancedBufferGeometry

I’m new to Threejs and Shader. Is there any way that can set different sizes for every sphere in merged mesh with InstancedBufferGeometry? Here is an example derived from Threejs example:

I guess the key is multiplying the position vector of each vertex. When I did in my own code, the sphere did have different size, but they also deviated from their original position.

I’m so confused. So can vertex shader actually change size for mesh? If it can, then how to achieve? Your help is highly appreciated!

Instead of this:

vec3 transformed =;
transformed += aPosition;
transformed = transformed * 2.0;

try this:

vec3 transformed = * 2.0;
transformed += aPosition;
1 Like

Thank you very much! :+1:You always immediately solve my problem :smiling_face_with_three_hearts: