# Face objects to camera in instanced mesh

**URL:** <https://discourse.threejs.org/t/face-objects-to-camera-in-instanced-mesh/32469>\
**Category:** Questions\
**Tags:** instanced-mesh\
**Created:** [December 7, 2021, 8:34pm UTC](https://discourse.threejs.org/t/face-objects-to-camera-in-instanced-mesh/32469 "2021-12-07T20:34:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chadedgar](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@chadedgar](https://discourse.threejs.org/u/chadedgar)\
**Post date:** [December 7, 2021, 8:34pm UTC](https://discourse.threejs.org/t/face-objects-to-camera-in-instanced-mesh/32469/1 "2021-12-07T20:34:30Z")

</div>

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/](https://jsfiddle.net/x0Lzkoj1/)

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [December 7, 2021, 9:27pm UTC](https://discourse.threejs.org/t/face-objects-to-camera-in-instanced-mesh/32469/2 "2021-12-07T21:27:29Z")

</div>

Hi!  
Something like this maybe: [Edit fiddle - JSFiddle - Code Playground](https://jsfiddle.net/prisoner849/5wkerq2g/)

---

<div class="post-metadata">

**Author:** ![chadedgar](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@chadedgar](https://discourse.threejs.org/u/chadedgar)\
**Post date:** [December 9, 2021, 12:50pm UTC](https://discourse.threejs.org/t/face-objects-to-camera-in-instanced-mesh/32469/3 "2021-12-09T12:50:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![D13](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@D13](https://discourse.threejs.org/u/D13)\
**Post date:** [December 24, 2021, 5:10pm UTC](https://discourse.threejs.org/t/face-objects-to-camera-in-instanced-mesh/32469/4 "2021-12-24T17:10:54Z")

</div>

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.
