I have a set of seamless tiling textures. I want to be able to take an arbitrary model and create a UV map with these properties:

  • No stretching (all textures tile appropriately so there is no stretching and sheering of the texture)
  • The textures display on the correct axis relative to the model it's mapping to (if you look at the example, you can see some of the letters on the front are tilted, the y axis of the texture should be matching up with the y axis of the object. Some other faces have upside down letters too)
  • the texture is as continuous as possible on the surface of the model (if two faces are adjacent, the texture continues on the adjacent face where it left off)
  • the model is closed (all faces are completely enclosed by other faces)

A few notes. This mapping will occur before triangulation. I realize there are ways to do this by hand and it's probably a hard problem to automatically map textures in general, but since these textures are seamless and I just need uniform coverage it seems like an easier problem. I'm looking for an algorithmic approach to this that I can apply in general, not a tool that does it.

What approach would work for this, is there an existing one? (I assume so)

enter image description here

  • \$\begingroup\$ I don't have anything productive to add other than maybe look up sources for how games generate lightmap UVs. \$\endgroup\$
    – Tetrad
    Apr 6, 2012 at 6:20
  • \$\begingroup\$ I think what you are asking for (what you specified as bullet points) is basically impossible. Just considering your first requirement: "No stretching", that's not even something that you'll get when an artists unwraps your model manually. \$\endgroup\$
    – bummzack
    Apr 6, 2012 at 14:03
  • \$\begingroup\$ No stretching can be implemented by most unwrapping methods. All you have to do to avoid that is have each uv polygon to scale on the texture map. Planar, spherical, cube, and cylindrical mapping will cause stretching, but unfolding methods dont. My problem is I need unfolding, optimal continuation of edges, and axis alignment between the 3d model and the texture \$\endgroup\$
    – brandon
    Apr 6, 2012 at 14:26
  • \$\begingroup\$ How would you, for instance, propose to 'correctly' unwrap the surface of a cube in a fashion that as closely as possible meets your constraints? Your bullet points are mutually incompatible; in particular, the notions of texture orientation matching object orientation are mostly meaningless since there is no consistently definable orientation on the surface of a 3d object (take a tiny sphere with an arrow pointing up on the middle of a cube's front face, then smoothly 'transport' that pointer from the front face to the top, top to right, and right to front again). \$\endgroup\$ Jul 12, 2013 at 21:12
  • \$\begingroup\$ (Also, regarding unwrapping: it's known that there are non-convex objects with no possible edge-connected unwrappings onto a flat surface - imagine a cube with polyhedral 'spikes' in the middle of each face - and it's not known whether a flat unwrapping exists for all convex objects or not.) \$\endgroup\$ Jul 12, 2013 at 21:17

2 Answers 2


Texture mapping is a hard problem. For some primitives there is a mathematically sound way of finding the UV coordinates. This is only possible if we can think of a function F(u,v)->(x,y,z). An example of a figure where this is possible is the a cube. Here we can easily cut out a square for each of the surfaces.

For a sphere this is also possible, here we can use the UV coordinates as latitude and longitude.

The function for the cube is perfectly linear, however the sphere is already more of a problem and for even more complex models there doesn't exist such an easy function.

Luckily in texture mapping we can use an easy primitive, like the cube or sphere. To map their easy function onto the harder to describe surface of the model: UV before

Of course this will not give a perfect effect: UV after

There are multiple techniques for mapping the simple texture coordinates onto a harder model:

  • You can use the normal of the complex model to map to the texture coordinate on the primitive. But this can lead to radical behavior for complex models.

normal to primitive

  • You can spread out from the center to the primitive, this gives a more linear distribution of texture coordinates.

center to primitive

  • Or you can cast rays spread out from the viewport/camera to the model and try to map the texture from the intersection point on the primitive to the intersection point of the complex model.

viewport to primitive

I can't think of one perfect way to do what you want, simply because there is no way to come up with a function that describes every surface perfectly. The best bet for you is to find a primitive that matches your complex model as close as possible or to create a complex model yourself, do manual UV mapping and then use that with the techniques described above as a primitive source for texture coordinates that you can map on other complex models.

  • \$\begingroup\$ lol thanks! Not my image. (But I did make last three images, in paint :P) \$\endgroup\$
    – Roy T.
    Apr 6, 2012 at 9:56
  • \$\begingroup\$ I'm pretty sure I'm understanding, I think I've seen something similar for an environment map on an irregular surface (where these are usually cast onto a sphere). The problem with this approach is it seems expensive. I need to be able to have 1000 of these objects on the screen at once. My application is texture mapping before the object is loaded into the pipeline. These objects are procedurally generated. I may be misunderstanding though. I'm not great at shaders, assuming a shader is what you mean. \$\endgroup\$
    – brandon
    Apr 6, 2012 at 13:43
  • \$\begingroup\$ From your question I wasn't sure how far into texture mapping you are so I gave you the full story. Also I'm not talking about shaders and the above techniques can all be done beforehand (In the 3rd one you can specify an arbitrary point for the viewport) :). About the approach for environment mapping, do you have a link? Maybe we can distill it into something that is useful for you now. \$\endgroup\$
    – Roy T.
    Apr 6, 2012 at 14:20
  • \$\begingroup\$ The "I'm pretty sure I'm understanding" was to your approach, I just skipped over the intro to uv mapping, It'll be useful to others that have similar questions for sure, wasn't being condescending :). I couldn't find the link to the environment map. My issues: #1 as you said will be too irregular. #2 will have upside down parts of the texture, #3 still looks like a shader approach since it relies on the camera in real time. I am fairly sure I'm looking for an unwrapping method (tinyurl.com/7u7muqw). The problem is most of the break my requirements. \$\endgroup\$
    – brandon
    Apr 6, 2012 at 14:37
  • \$\begingroup\$ Ah IC. Maybe it would be helpful to know how you procedurally generate your objects, that could give us a clue. \$\endgroup\$
    – Roy T.
    Apr 6, 2012 at 15:17

This doesn't answer the question but why do you use texture mapping and not Procedural materials?

Procedural materials do have these advantages

  • the object looks as if it were carved out of real material (stone, wood, ...)
  • details can be calculated without the need for more memory
  • no UV map calculation necesary

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .