Sunday 4 August 2013

UV Mapping

This update has been delayed by a lazy weekend and a busy last typewriter week; nevertheless, here it is. I have lots of posts to write, and still need to cover linear vs non-linear workflow, more detail on rendering to match a background, and texturing.  So far this blog has followed the weeks of the course in some order but I think as we progress that may breakdown somewhat.

However, I intended to only glance at UV mapping but have ended up with quite a long post about it.  Though tedious, UV mapping is an extremely important part of 3D modelling - it's also almost unique as being universally despised by artists.  It isn't complicated but can seem it.  I'll try to make it clear.

UV mapping is the process of flattening a model out, in the same way you may unfold an empty cereal box.  This is done so that text and images can be easily applied to the model's surface without distortion.  This is a fairly simple but laborious process, and the results are never perfect.

3D models are defined by the position of their vertices.  The position of vertices is recorded using cartesian co-ordinates on three axes. You will probably be familiar with the two axes version from basic X, Y graphs such as:



A familiar graph with vertical and horizontal axes.  Using the above graph any of us could quickly and easily find the location of X = -4, Y = 3.  3D modelling uses exactly the same system but includes one further axis: Z.




Hopefully the above image is relatively clear, we have the same height and width axes but have included one further axis for depth.  To find the location of X = -4, Y = 3 and Z = 5 would be no more difficult than finding X = -4, Y = 3 on a two-dimensional graph.  Vertices on a 3D model are positioned and recorded in just such a way.

UV map·ping 
1. the 3D modelling processing of making a 2D representation of a 3D model.

An example of UV mapping a cube: the faces are unfolded and the
3D co-ordinates of the vertices (X, Y, Z) are translated into 2D co-ordinates (U, V).
The term UV mapping refers to the translation of the X, Y, Z co-ordinates of vertices into U, V co-ordinates.  The co-ordinates are labelled differently to signify their existence in different spaces.  When a model has been UV mapped completely it has been 'unwrapped' and is ready for texturing.


A UV map and a UV checker. (Also visible is the UV Texture Editor, on the left.)

The UV checker, above, is applied to a model to ensure it has been accurately unwrapped.  It is made up of regular squares subdivided with further regular squares, and numbers.  The squares help to ensure a UV map is even while the numbers help ensure the orientation is correct.  

The UV map above is the flattened out version of the front casing of my typewriter:

The 3D  mapped model, as above.
Of note:

- The 2D UV map looks misshapen - it looks as if the UV checker will look a mess on the 3D model.

- The checker applied to the 3D model is in fact  extremely even.  The orientation of the numbers isn't quite right but that is not a practical problem.

The problem arrives when trying to unwrap more complicated objects.  It is usually impossible to lay a complex object out completely flat.  As you lie certain faces flat, other faces will crease and buckle, because they are no longer flat.  You are trying to translate 3D faces into 2D, keeping the same relative size for them all while reducing distortion.  Inevitably there will be distortion which must be kept to a minimum.

To reduce distortion you must cut the model into sections to have everything lie flat: this is the compromise of UV mapping: seams.  The culmination of translating 3D co-ordinates to 2D is seams - it is an imperfect system.  Seams do not match up neatly and so will show up on the texture.  The trick is to hide the seams, whether inside the model or behind it.

I have a lot more topics to post about but the gap between posts may be larger than normal because of the increased pace. I'll keep trying. The typewriter is going excellently! A big post about that at the end of this week, hopefully.

No comments:

Post a Comment