# UV mapping over extruded Mesh

**URL:** <https://forum.babylonjs.com/t/uv-mapping-over-extruded-mesh/19484>\
**Category:** Questions\
**Created:** [March 26, 2021, 3:56pm UTC](https://forum.babylonjs.com/t/uv-mapping-over-extruded-mesh/19484 "2021-03-26T15:56:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mercurio](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mercurio/32/23383_2.png) [@Mercurio](https://forum.babylonjs.com/u/Mercurio)\
**Post date:** [March 26, 2021, 3:56pm UTC](https://forum.babylonjs.com/t/uv-mapping-over-extruded-mesh/19484/1 "2021-03-26T15:56:57Z")

</div>

Hi there,  
i’ve an extruded mesh builded from a bizier curve. I want to remapping the UV becouse i need to apply textures only at one face. Working with a cube texture is pretty simple, but with a custom mesh i didn’t understand how to do it.  
This is my PG: [https://playground.babylonjs.com/#RG2S1J#3](https://playground.babylonjs.com/#RG2S1J#3)

I’ve tried using also `getIndices()` but i didn’t figured out how to manege the results.  
Any idea? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [March 26, 2021, 4:34pm UTC](https://forum.babylonjs.com/t/uv-mapping-over-extruded-mesh/19484/2 "2021-03-26T16:34:05Z")

</div>

If there are no rotations or scaling along the extrusion then an extruded polygon method might suffice [Irregular Polygon Extrusion | Babylon.js Documentation](https://doc.babylonjs.com/divingDeeper/mesh/creation/param/extrude_polygon)

---

<div class="post-metadata">

**Author:** ![Mercurio](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mercurio/32/23383_2.png) [@Mercurio](https://forum.babylonjs.com/u/Mercurio)\
**Post date:** [March 26, 2021, 4:46pm UTC](https://forum.babylonjs.com/t/uv-mapping-over-extruded-mesh/19484/3 "2021-03-26T16:46:32Z")

</div>

Thank you, it works!

---

<div class="post-metadata">

**Author:** ![Mercurio](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mercurio/32/23383_2.png) [@Mercurio](https://forum.babylonjs.com/u/Mercurio)\
**Post date:** [March 29, 2021, 8:50am UTC](https://forum.babylonjs.com/t/uv-mapping-over-extruded-mesh/19484/4 "2021-03-29T08:50:21Z")

</div>

> [@JohnK](#):
>
> f there are no rotations or scaling along the extrusion then an extruded polygon method might suffice [Irregular Polygon Extrusion | Babylon.js Documentation](https://doc.babylonjs.com/divingDeeper/mesh/creation/param/extrude_polygon)

In this way a can easily place the texture on my extruded shape but i can’t map the texture only on one face. In this PG [https://playground.babylonjs.com/#RG2S1J#12](https://playground.babylonjs.com/#RG2S1J#12) i want the texture to be mapped only on the flat face of the mesh, but it seems that `faceUV[1] = new BABYLON.Vector4(0, 0, -1, 1);` (line 57) takes also all the the others faces (except the bottom e top which are correctly mapped on face 0 and 2).  
Is there a way to manage that?

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [March 29, 2021, 2:47pm UTC](https://forum.babylonjs.com/t/uv-mapping-over-extruded-mesh/19484/5 "2021-03-29T14:47:04Z")

</div>

I think I understand. By the flat face you mean one of the extruded sides rather than the top and bottom faces. You would need to have your texture extended with blank areas on its left and/or right sides and set the wrap option to true. The alternative is to create a plane of the correct size and parent it to the flat side and apply the texture to the plane.

---

<div class="post-metadata">

**Author:** ![Mercurio](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mercurio/32/23383_2.png) [@Mercurio](https://forum.babylonjs.com/u/Mercurio)\
**Post date:** [March 29, 2021, 3:07pm UTC](https://forum.babylonjs.com/t/uv-mapping-over-extruded-mesh/19484/6 "2021-03-29T15:07:08Z")

</div>

Ok understood. But the idea was to map another portion of texture on the other extruded side (the curved one), so i suppose i must refactor the texture and then try to fit all the mesh faces i need. Is it right?

EDIT: where do i set the wrap option, on the texture object?

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [March 29, 2021, 5:32pm UTC](https://forum.babylonjs.com/t/uv-mapping-over-extruded-mesh/19484/7 "2021-03-29T17:32:35Z")

</div>

> [@Mercurio](#):
>
> i must refactor the texture and then try to fit all the mesh faces i need. Is it right?

Yes and fit the size of each image to match the ratios of the flat side and curved side heights and widths.

> [@Mercurio](#):
>
> EDIT: where do i set the wrap option, on the texture object?

One of the options for extrudePolygon.
