Tuesday, June 8, 2010

Simple model viewer with automatic UV unwrapping

   Years ago while I was struggling with Maya, having to do UV mapping myself, which I hated to, I was thinking perhaps there would be a less dumb approach to tackling this problem. Then years later when I took a geometric modeling course at NYU, one of the assigned readings happened to be addressing this specific topic, namely, 3D/2D parametrization. Simply put, if we have a 3D mesh, we want to find a way to explain where a particular vertex's 2D position is(texturing) by only looking at the 3D data itself. 
Enough talk, let's look at a simple case:

And its corresponding 2D parametrization(UV mapping), which is done quite well:

The goal here is to preserve the shapes of the triangles as much as possible(regardless of the sizes). 
So you could expect a situation when it doesn't work quite as well:


And its UV map, which doesn't look quite good:


Now you can get a sense that although the shapes are well-preserved, the sizes could go crazy. So it's really a problem of striking the balance between the size and shape of each triangle, and the subjective view of the artists who have to paint it. I would say that if the future hardware supports per-polygon texturing, people won't need to find a good explanation for 3D to 2D anymore(there will never be one).

No comments: