# Highlight instanceMesh

**URL:** <https://forum.babylonjs.com/t/highlight-instancemesh/42345>\
**Category:** Questions\
**Created:** [July 12, 2023, 4:03am UTC](https://forum.babylonjs.com/t/highlight-instancemesh/42345 "2023-07-12T04:03:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lxq100](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lxq100/32/43689_2.png) [@lxq100](https://forum.babylonjs.com/u/lxq100)\
**Post date:** [July 12, 2023, 4:03am UTC](https://forum.babylonjs.com/t/highlight-instancemesh/42345/1 "2023-07-12T04:03:29Z")

</div>

When highlighting objects, Mesh A can be highlighted, B = A.createInstance(), B cannot be highlighted, is there a solution?  
PG: [https://playground.babylonjs.com/#D6GB23#8](https://playground.babylonjs.com/#D6GB23#8)  
line 143 report error

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [July 12, 2023, 7:56am UTC](https://forum.babylonjs.com/t/highlight-instancemesh/42345/2 "2023-07-12T07:56:17Z")

</div>

Your PG does not work for me:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/f/af891c6101300071bb69eb79829ff957624d9c9e.png)

But these post should help you:

- [How to Highlight a Mesh Instance?](https://forum.babylonjs.com/t/how-to-highlight-a-mesh-instance/27203)
- [Why can't I add an InstancedMesh to HighlightLayer - #13 by Lazarus\_Rainhard](https://forum.babylonjs.com/t/why-cant-i-add-an-instancedmesh-to-highlightlayer/6183/13)

---

<div class="post-metadata">

**Author:** ![lxq100](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lxq100/32/43689_2.png) [@lxq100](https://forum.babylonjs.com/u/lxq100)\
**Post date:** [July 12, 2023, 10:34am UTC](https://forum.babylonjs.com/t/highlight-instancemesh/42345/3 "2023-07-12T10:34:12Z")

</div>

> **[Babylon.js Playground](https://playground.babylonjs.com/#D6GB23%239)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

look this!

//141 line

show 143 line

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [July 12, 2023, 10:37am UTC](https://forum.babylonjs.com/t/highlight-instancemesh/42345/4 "2023-07-12T10:37:52Z")

</div>

The PG does work for me now.

See the links I pasted above, the problem is that you can’t highlight mesh instances. The links I provided give some ways to overcome this problem.

---

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [July 13, 2023, 12:45am UTC](https://forum.babylonjs.com/t/highlight-instancemesh/42345/5 "2023-07-13T00:45:45Z")

</div>

Acturally there is a very hack way to do this. You can modify the object before draw stencil buffer and change it back after the draw.
