Documentation for `UVGenerator`

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?

1 Like

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…

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

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

1 Like

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.