# Realtime update of Vertex\_Before\_PositionUpdated

**URL:** <https://forum.babylonjs.com/t/realtime-update-of-vertex-before-positionupdated/57039>\
**Category:** Questions\
**Tags:** material\
**Created:** [March 11, 2025, 11:29am UTC](https://forum.babylonjs.com/t/realtime-update-of-vertex-before-positionupdated/57039 "2025-03-11T11:29:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lecornflake](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@Lecornflake](https://forum.babylonjs.com/u/Lecornflake)\
**Post date:** [March 11, 2025, 11:29am UTC](https://forum.babylonjs.com/t/realtime-update-of-vertex-before-positionupdated/57039/1 "2025-03-11T11:29:01Z")

</div>

Hello there,

I am looking for a way to update a PBRCustomMaterial in real time using Vertex\_Before\_PositionUpdated.  
If you take a look at the playground below and switch the if statement to true, you’ll notice nothing seems to happen to the material after the 1 second delay.

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

I suspect the vertex shader needs recompiling but I didn’t succeed in finding a solution. Hence why I am requesting your help to better understand my issue and hopefully solve this problem.

Thanks for your help and time !

---

<div class="post-metadata">

**Author:** ![morteza\_norabadi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/morteza_norabadi/32/38721_2.png) [@morteza\_norabadi](https://forum.babylonjs.com/u/morteza_norabadi)\
**Post date:** [March 11, 2025, 1:34pm UTC](https://forum.babylonjs.com/t/realtime-update-of-vertex-before-positionupdated/57039/2 "2025-03-11T13:34:50Z")

</div>

im not sure why you are updating UV from materials  
you can scale your texture “uScale” to get what you want

updated [PG](https://playground.babylonjs.com/#F973CS#11)

but if you want to do it with material  
i think PBRCustomMaterial is not recompiled ( I do not found any thing to do so)

but i think you can do that with material plugins

---

<div class="post-metadata">

**Author:** ![morteza\_norabadi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/morteza_norabadi/32/38721_2.png) [@morteza\_norabadi](https://forum.babylonjs.com/u/morteza_norabadi)\
**Post date:** [March 11, 2025, 1:58pm UTC](https://forum.babylonjs.com/t/realtime-update-of-vertex-before-positionupdated/57039/3 "2025-03-11T13:58:29Z")

</div>

here is material plugin version

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

---

<div class="post-metadata">

**Author:** ![Lecornflake](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@Lecornflake](https://forum.babylonjs.com/u/Lecornflake)\
**Post date:** [March 11, 2025, 2:31pm UTC](https://forum.babylonjs.com/t/realtime-update-of-vertex-before-positionupdated/57039/4 "2025-03-11T14:31:35Z")

</div>

Hi @morteza_norabadi,  
I need to manage the UVs on a per instance basis. Using uScale on a texture is therefore not an option. Sadly, it looks like material plugins won’t cater to my needs for the same reason.

if PBRCustomMaterials don’t recompile, i’ll have to investigate recreating the material from scratch or maybe handling things differently on my side.

Thank you very much for your input.

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [March 11, 2025, 4:05pm UTC](https://forum.babylonjs.com/t/realtime-update-of-vertex-before-positionupdated/57039/5 "2025-03-11T16:05:54Z")

</div>

Hello @Lecornflake

Instead of editing the shader code, you could set it from the beginning, and only change the `ground.instancedBuffers` :

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

Is it what you are looking for ?

---

<div class="post-metadata">

**Author:** ![Lecornflake](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@Lecornflake](https://forum.babylonjs.com/u/Lecornflake)\
**Post date:** [March 20, 2025, 11:10am UTC](https://forum.babylonjs.com/t/realtime-update-of-vertex-before-positionupdated/57039/6 "2025-03-20T11:10:36Z")

</div>

Hi ! I forgot to respond but I found another solution to my issue, which is too specific to my project to share here.  
I didn’t know this trick, though. Thanks for sharing it !
