# Is there any way to initialize the uv edited texture?

**URL:** <https://forum.babylonjs.com/t/is-there-any-way-to-initialize-the-uv-edited-texture/34856>\
**Category:** Questions\
**Tags:** mesh, uv, textures\
**Created:** [October 17, 2022, 4:19am UTC](https://forum.babylonjs.com/t/is-there-any-way-to-initialize-the-uv-edited-texture/34856 "2022-10-17T04:19:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![UNIT](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/unit/32/24065_2.png) [@UNIT](https://forum.babylonjs.com/u/UNIT)\
**Post date:** [October 17, 2022, 4:19am UTC](https://forum.babylonjs.com/t/is-there-any-way-to-initialize-the-uv-edited-texture/34856/1 "2022-10-17T04:19:33Z")

</div>

Hi everyone 🙂

I’d like to change the texture of the mesh (like a laptop/phone screen)

However, the uv of the mesh is edited (Downloaded or related to draw call issue)

In this case, how can I initialize uv with JS code?

When I upload the image to the texture, the UV setting should be initialized and the image should be applied to the mesh.

(The mesh shape that I want to change the texture can be any shape, not a plane, but first, I’d like to get an idea of a plane shape)

 ![pic](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/c/c/cc7af26e10f1572d807b82f8eef60902d3460d33.jpeg)

This is what I want below.

 ![whatiwant](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/a/7a02b2324ac09f1568f583275a72d0a33371cc71.jpeg)

Here’s the playground link.  
[edited UV initializing test](https://playground.babylonjs.com/#R7KRZE)

Thanks in advance!

* * *

- The modeling asset in playground  
“CyberPunk Laptop Concept Design” ([CyberPunk Laptop Concept Design - Download Free 3D model by Berk Gedik (@berkgedik) [fddc4e6] - Sketchfab](https://skfb.ly/6VuvD)) by Berk Gedik is licensed under Creative Commons Attribution ([Creative Commons — Attribution 4.0 International — CC BY 4.0](http://creativecommons.org/licenses/by/4.0/)).

---

<div class="post-metadata">

**Author:** ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)\
**Post date:** [October 17, 2022, 4:57am UTC](https://forum.babylonjs.com/t/is-there-any-way-to-initialize-the-uv-edited-texture/34856/2 "2022-10-17T04:57:54Z")

</div>

Heya, so I set/mapped the UVs to use the full texture (and also just rotated the UV’s directly instead of using wAng). I think that’s what you’re after? 🙂

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

---

<div class="post-metadata">

**Author:** ![UNIT](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/unit/32/24065_2.png) [@UNIT](https://forum.babylonjs.com/u/UNIT)\
**Post date:** [October 17, 2022, 5:21am UTC](https://forum.babylonjs.com/t/is-there-any-way-to-initialize-the-uv-edited-texture/34856/3 "2022-10-17T05:21:11Z")

</div>

That’s exactly what I wanted!

BTW, if there’s a more complicated shape mesh like a curved monitor or something else,  
how do I set the uv array?

Thanks for your help 😁

---

<div class="post-metadata">

**Author:** ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)\
**Post date:** [October 17, 2022, 5:42am UTC](https://forum.babylonjs.com/t/is-there-any-way-to-initialize-the-uv-edited-texture/34856/4 "2022-10-17T05:42:04Z")

</div>

Hmm, for the more complicated meshes it could be easier to map the UVs in a DCC tool with a UV editor. In theory you could do it in code too, but I like to stick to simple meshes for that… 🙂

---

<div class="post-metadata">

**Author:** ![UNIT](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/unit/32/24065_2.png) [@UNIT](https://forum.babylonjs.com/u/UNIT)\
**Post date:** [October 17, 2022, 6:20am UTC](https://forum.babylonjs.com/t/is-there-any-way-to-initialize-the-uv-edited-texture/34856/5 "2022-10-17T06:20:53Z")

</div>

Thanks for the advice.

I’ll give it a try!
