How to map a texture to a curved path

immagni mappatura uv che segue il percorso della geometria

When you are dealing with architectural visualization projects it often happens that you have to texture objects that have curved shapes. In most cases they are roads, sidewalks or other pathways.

Edit: in Maya 2016 and up this workflow has been greatly simplified thanks to the UV > Contour Stretch command. The resulting UVs are very good even with default settings. I suggest to run an additional unfold command too, in order to get an even more regular distribution, as I explain in this section of the article.

It is expected that the textures follow the direction of the path, like we can se in these photos.

example of a road example of a road

Example of how the texture should follow the path

Usually though, the textures have straight lines if they haven't been drawn and adapted for the specific geometry.

stone faces

Example of a linear texture

A simple planar projection won't work because at a certain point the texture will go straight, ignoring the path's curves.

immagine della texture applicata su percorso curvo con semplice proiezione planare

Example of planar projection on curved path

The best thing to do would be to draw or adapt manually the texture to the projection in photoshop, but in visualization we usually rely on UV projections.

You can, in a few steps lay the UV coordinates of the object in a way that they will adapt to the texture.

Here is how to proceed:

  • apply a planar projection along the Y axis of the object;
  • image of the planar projection in the UV editor

    The UVs should appear like this after the planar projection

  • in the UV editor, select the UVs that are on both ends of the object, pull them away and align them vertically;
  • image of the movement of the UVs to the extremities

    Pulling the UVs on the ends

  • Select all the UVs except those that we have just moved and press Unfold & Relax
  • image of the unfold & relax tool

    The Unfold & Relax tool

  • pull the manipulator that appears on relax and then the one that appears on unfold until the distribution of the UVs is regular and the shape becomes a stretched rectangle;
  • image of the effect of relax

    The effect of 'Relax' on the UVs

    image of the effect of unfold

    The effect of 'Unfold' on the UVs

  • select the upper UVs and align them to the top with the specific button;
  • alignment of the upper UVs

    Alignment of the upper UVs

  • repeat for the lower UVs, aligning them to the bottom;
  • alignment of the lower UVs

    Alignment of the lower UVs

At this point the coordinates should be quite regular, but to have the correct ratio between the faces based on their effective size in world space another unfold is necessary.

  • select all the UVs and execute polygons > unfold > options;
  • in the following window, select legacy (only in versions 2015+), deselect pin UV border and set unfold constraint to horizontal;
  • image of the options of the Unfold UV command

    Window of the Unfold UV command with the options to set

This way the distribution of the UVs will be as regular as possible and there will not be deformations in the visualization of the texture.

esempio uv finali 1 esempio uv finali 2 esempio uv finali 3

The texture now follows perfectly the path of the geometry

I hope this little trick will help you out with some of your projects.

See you next time.

Paolo Mazzoccato, fondatore Fisheye Studio

Paolo Mazzoccato

Founder of Fisheye Studio and computer graphics addicted since 1996. When tecnology let's me down I find comfort in my cats' purrs.


comments powered by Disqus