# renderOverlay vs customMaterial

**URL:** <https://forum.babylonjs.com/t/renderoverlay-vs-custommaterial/14507>\
**Category:** Questions\
**Created:** [September 29, 2020, 1:41am UTC](https://forum.babylonjs.com/t/renderoverlay-vs-custommaterial/14507 "2020-09-29T01:41:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phaselock](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@phaselock](https://forum.babylonjs.com/u/phaselock)\
**Post date:** [September 29, 2020, 1:41am UTC](https://forum.babylonjs.com/t/renderoverlay-vs-custommaterial/14507/1 "2020-09-29T01:41:58Z")

</div>

Repro: [https://www.babylonjs-playground.com/#UXCB15#120](https://www.babylonjs-playground.com/#UXCB15#120)

How can I get renderOverlay to work on custom vertex displaced material ?

---

<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:** [September 29, 2020, 8:56am UTC](https://forum.babylonjs.com/t/renderoverlay-vs-custommaterial/14507/2 "2020-09-29T08:56:11Z")

</div>

You can fix somehow the overlay having some “holes” by raising the zOffset of the material by using `scene.getOutlineRenderer().zOffset = 10` (but you will still get some artifacts depending on the view angle). However, you won’t be able to have the overlay follow the deformations because the overlay renderer can’t use a custom vertex shader for its rendering.

---

<div class="post-metadata">

**Author:** ![phaselock](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@phaselock](https://forum.babylonjs.com/u/phaselock)\
**Post date:** [September 29, 2020, 11:24am UTC](https://forum.babylonjs.com/t/renderoverlay-vs-custommaterial/14507/3 "2020-09-29T11:24:09Z")

</div>

> [@Evgeni\_Popov](#):
>
> However, you won’t be able to have the overlay follow the deformations because the overlay renderer can’t use a custom vertex shader for its rendering.

I see. ok, gotcha, thanks !!
