How can I make the instanced boxes lookat sphere position

I used a pen by @prisoner849 and changed spheres to boxes. Now I want all the instanced boxes lookat sphere´s position - can somenone tell me how:

Quick search for lookAt in glsl gave some links to resources, I used one of them :thinking:

Picture:

Demo: https://codepen.io/prisoner849/full/PoMVaYa

Ace!

Can I add a “per box scale factor” to this as well? So that each box has a different z-size/height?

Yes, add another one instanced buffer attribute, for example.
I modified the codepen from my post above.

This is awesome!

Is there a way to update colors of the instancedmeshes in the renderloop?

Nothing can stop you from changing and updating of buffer attributes, including the one with colors :thinking:

1 Like

Or you can do funny things in shaders.

Picture:

Demo: https://codepen.io/prisoner849/full/abeXRrE

1 Like