# Documentation for \`UVGenerator\`

**URL:** <https://discourse.threejs.org/t/documentation-for-uvgenerator/80357>\
**Category:** Site Feedback\
**Tags:** uv, uv-mapping, geometry\
**Created:** [March 29, 2025, 8:18pm UTC](https://discourse.threejs.org/t/documentation-for-uvgenerator/80357 "2025-03-29T20:18:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![trusktr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/trusktr/32/13726_2.png) [@trusktr](https://discourse.threejs.org/u/trusktr)\
**Post date:** [March 29, 2025, 8:18pm UTC](https://discourse.threejs.org/t/documentation-for-uvgenerator/80357/1 "2025-03-29T20:18:15Z")

</div>

The docs currently say this:

> object that provides UV generator functions

which is vague, especially for someone new to UVs and trying to learn how to calculate UVs.

Also, with added documentation perhaps AIs can derive better information.

In particular, we can see in the source code that a `UVGenerator` must have two methods: `generateTopUV` and `generateSideWallUV`.

What exactly are the descriptions for the methods?

My guess is this:

- `generateTopUV` - Generate UVs for the end caps of the extrusion (the shape being extruded). Receives the geometry, list of all vertices, and three indices representing a triangle. It gets called once per triangle for every triangle on both the start shape and the closing shape (for example for each triangle in two star shapes if the extruded shape is a star). It should return a tuple of three `Vector2` instances representing the UVs for the three vertices represented by the indices.
- `generateSideWallUV` - Generate UVs for the faces along the extrusion path. Each surface along the extrusion is a rectangle. Receives the geometry, list of all vertices, and four indices representing a face. It gets called once per rectangle face (for example for each rectangle around the “tube” created by the extrusion). It should return a tuple of four `Vector2` instances representing the UVs for the four vertices represented by the indices.

Is this accurate?

---

<div class="post-metadata">

**Author:** ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)\
**Post date:** [March 30, 2025, 5:58am UTC](https://discourse.threejs.org/t/documentation-for-uvgenerator/80357/2 "2025-03-30T05:58:34Z")

</div>

I think its good info, but I don’t think the language should include extrusion since it applied to all BufferGeometries, yeah?  
Do you have a link to the class itself.. I haven’t seen it…

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [March 30, 2025, 6:58am UTC](https://discourse.threejs.org/t/documentation-for-uvgenerator/80357/3 "2025-03-30T06:58:18Z")

</div>

> [@manthrax](#):
>
> since it applied to all BufferGeometries, yeah?

From what I see - no, this is specific for ExtrudeGeometry:

- [three.js/src/geometries/ExtrudeGeometry.js at f230fe9147bfbf9c689a8d62b72d757395a513c9 · mrdoob/three.js · GitHub](https://github.com/mrdoob/three.js/blob/f230fe9147bfbf9c689a8d62b72d757395a513c9/src/geometries/ExtrudeGeometry.js#L97)
- [three.js/src/geometries/ExtrudeGeometry.js at f230fe9147bfbf9c689a8d62b72d757395a513c9 · mrdoob/three.js · GitHub](https://github.com/mrdoob/three.js/blob/f230fe9147bfbf9c689a8d62b72d757395a513c9/src/geometries/ExtrudeGeometry.js#L796)

---

<div class="post-metadata">

**Author:** ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)\
**Post date:** [March 30, 2025, 7:02am UTC](https://discourse.threejs.org/t/documentation-for-uvgenerator/80357/4 "2025-03-30T07:02:35Z")

</div>

Oh i see. it’s an internal class that you can override. nvm 😃 lgtm!

---

<div class="post-metadata">

**Author:** ![trusktr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/trusktr/32/13726_2.png) [@trusktr](https://discourse.threejs.org/u/trusktr)\
**Post date:** [March 30, 2025, 7:13pm UTC](https://discourse.threejs.org/t/documentation-for-uvgenerator/80357/5 "2025-03-30T19:13:58Z")

</div>

Also what about the order? We need to describe in which order the vertices are handled. This way a UV algorithm can depend on strictly ordering and portions of width/height of an image, without using the vertex positions.
