Hey,

I’m having trouble to generate UVs for my street mesh that is generated during runtime using a Catmullrom curve.

The user specifies >= 2 points and from that a cutmullrom curve is generated. I extract a reasonable amount of points along the curve to iterate over and generate a mesh out of it as shown below.

For every point a perpendicular direction is calculated and thus two vertices generated, one for every side. The triangulation happens as shown above.

How would I calculate the UVs for a mesh with more than 2 control points ( 2 points would just be a straight line) ? Note that the mesh is always flat. The normals are oriented in the Up-direction.

I’ve found the solution shortly after posting this.

I’ts actually quite simple. I tried to explain it in the image.

It works for curves too.