# Change in vertices UV not respected by material shader

**URL:** <https://forum.babylonjs.com/t/change-in-vertices-uv-not-respected-by-material-shader/20152>\
**Category:** Questions\
**Created:** [April 20, 2021, 3:10pm UTC](https://forum.babylonjs.com/t/change-in-vertices-uv-not-respected-by-material-shader/20152 "2021-04-20T15:10:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ajp/32/9504_2.png) [@ajp](https://forum.babylonjs.com/u/ajp)\
**Post date:** [April 20, 2021, 3:10pm UTC](https://forum.babylonjs.com/t/change-in-vertices-uv-not-respected-by-material-shader/20152/1 "2021-04-20T15:10:19Z")

</div>

I’ve tried to follow the [docs](https://doc.babylonjs.com/divingDeeper/mesh/creation/custom/updatingVertices) to set the UV of a meshes vertices. I suspect it is a problem with [the material / shader I have constructed](https://nme.babylonjs.com/#T6IMD0) but I can’t see the problem at the moment. I’d be very grateful if anyone could take a quick look. Thank you!

The plane should appear as all red as I have attempted to set the UV values to 0 but it appears as blue-white-red

[https://playground.babylonjs.com/#ZKPX1P#9](https://playground.babylonjs.com/#ZKPX1P#9)

\*\* edit \*\*

1. I have experimented with manually connecting the shader to a inputBlock of value 0 in NME and in the code and it works as expected (i.e. the plane is all red).
2. I have logged out all the uv values of the mesh and they are all 0.

So for some reason the material is receiving the original uv values of the mesh instead of the updated values…

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 20, 2021, 3:41pm UTC](https://forum.babylonjs.com/t/change-in-vertices-uv-not-respected-by-material-shader/20152/2 "2021-04-20T15:41:39Z")

</div>

Hey

here is your fix: [Data on height map | Babylon.js Playground](https://playground.babylonjs.com/#ZKPX1P#10)

🙂

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ajp/32/9504_2.png) [@ajp](https://forum.babylonjs.com/u/ajp)\
**Post date:** [April 20, 2021, 3:49pm UTC](https://forum.babylonjs.com/t/change-in-vertices-uv-not-respected-by-material-shader/20152/3 "2021-04-20T15:49:54Z")

</div>

Amazing! Thank you so much @Deltakosh . I missed the crucial ` / 3` in [the example](https://doc.babylonjs.com/divingDeeper/mesh/creation/custom/updatingVertices) and thought it was returning a list of position vectors instead of single numbers.

I doubt I’ll ever get to contribute this but would a PR for a warning if you assign too much / too little data be useful? Though perhaps there are legitimate use cases for this kind-of-shadowing-the-data approach? i.e. the data is there in javascript/typescript but is silently ignored by the shader / material.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 20, 2021, 4:59pm UTC](https://forum.babylonjs.com/t/change-in-vertices-uv-not-respected-by-material-shader/20152/4 "2021-04-20T16:59:38Z")

</div>

There is actually a warning in the console 🙂

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ajp/32/9504_2.png) [@ajp](https://forum.babylonjs.com/u/ajp)\
**Post date:** [April 26, 2021, 4:41pm UTC](https://forum.babylonjs.com/t/change-in-vertices-uv-not-respected-by-material-shader/20152/5 "2021-04-26T16:41:23Z")

</div>

Ahh the `WebGL: INVALID_VALUE: bufferSubData: buffer overflow`… nice! I’d seen the other warnings about `DevTools failed to load SourceMap` and I guess I must have tuned out the rest. My bad.

I noticed there is not a similar warning for underflows which also result in a no-op. Is that intentional / hard / undesirable to warn about or would a PR be welcomed there? Thanks.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 26, 2021, 5:38pm UTC](https://forum.babylonjs.com/t/change-in-vertices-uv-not-respected-by-material-shader/20152/6 "2021-04-26T17:38:51Z")

</div>

it is “expected” 🙂  
We avoid any check on the main rendering loop (for perf reasons)
