Face objects to camera in instanced mesh

Is there any property for instanced mesh to make all instances face the camera? Or it will only be possible via vertex shader? Camera will be moving so I don’t know if rotating each instance from JS will be good idea.

https://jsfiddle.net/x0Lzkoj1/

Hi!
Something like this maybe: Edit fiddle - JSFiddle - Code Playground

2 Likes

Thanks, while that works, using that on more than 50 particles starts dropping frames. I am trying to do via shader now but I think it’s going to be too complex.

I do this with thousands of instances per drawCall with no performance dips. I do copy the camera quaternion also but I compose the matrix instead of decompose it. Not sure that is that the issue here though. I also have my instances built as InstancedBuffferGeometry up front. I really can’t tell you what the difference is here other than it looks like camera.quaternion.copy is an unusually high process for some reason in this example. But I can confirm that this process is not as expensive as advertised here. I do this task successfully on iOS and Android in ThreeJS r132+. I do it while fog, moving lights, and bloom postprocessing are all running simultaneously.

ThreeJS is capable of high performance here just FYI.