|
Simple Uvmapping and Texture creation Tutorial By RobG
In this tutorial I am going to go through the basic procedures of applying UV mapping to a simple mesh, using that layout as a framework to create a texture and adjust the final positioning.
There are two main methods you can use to UV map a model;
The first way; this involves breaking up the model into chunks, by selecting polys and detaching them as elements. Then you copy the model, you can now move and rotate the elements of the copy into a flat square, next apply a planner UVW Map to it and finally use a morph modifier with the original model as a target to get the copy back to the same shape as the original model.
This is the method I started UV mapping, it's easy to do if you know your way around Max but it is very long winded.
The second way; is to apply the UVW Map then using an Unwrap UVW modifier to flatten and position the UV map. This method is how I UV map models now, It may seem more confusing and complex to do at first but with practise I find it far quicker and simpler. It is this second method that I will be covering
Tools Used:
3DStudio Max 4.2
* UVW Map
* UVW Unwrap
* Textporter
Photoshop 5.5
The model we are going to make is a simple 6 sided dice or d6 (the reason I've said 6 sided it that any rpg'ers reading this will know that there are many different dice
)
To make the mesh for our d6 we are going to use a box, ok it is a very basic shape and we could make it look better if we used a chamfer box (a box with rounded edges). However to keep it simple we will use a box.
Instead of creating it by dragging I have used the Keyboard Entry so I can get an exact size and position.

Next apply a UVW Mapping modifier to your box, first change the Mapping to Box then enter a size into the Length Width and Height boxes. Then change the Mapping back to Planar.
Note: Although this does not matter so much for our box as it is already an exact cube so it's Length Width and Height are already the same, however when using a mesh that is not equal sized or an odd shape it is important to do this step. If you do not then the UVW map will distort when you try to lay it out flat.

To make things easier to see I've applied a texture to the box, do this by opening the material editor and applying a bitmap to the Diffuse colour.
Note: Make sure the texture you use is SQUARE if not you will get distortion when laying out the UVW map flat.
Next apply an Unwrap UVW modifier to the box.
Click on the Edit button and a new window opens.
This is what your box's UVW mapping currently looks like.
Before I go any further I'm going to make a quick side trip into the basics of what UVW actually means.
Basically UVW is just a set of coordinates in three dimensional space just like XYZ are. So why are they not just called XYZ? The reason is that they are relevant to the Mapping, which is independent of the mesh or world XYZ coordinates.
The other thing you have to think about is that they are three dimensional but a bitmap texture is only two dimensional image.
Although 3DS Max can cope with 3D mapping coordinates most computer games do not, this is why we have to lay the map out flat reducing it to UV coordinates so we can then map an image onto the skin of our 3D model.
Note: In 3DS Max a Planar map is a UV map where as a Box map is a UVW map.
So the UVW refers to the Length Width and Height of the mapping the same way XYZ refers to the Length Width and Height of the mesh.
In this tutorial when I applied the UVW map it was aligned so that U=X=Width V=Y=Length and W=Z=Height. However if I rotated the UVW map the alignment would change.
Now back to the Tutorial ... The Edit UVWs window is like looking at the left or top or front view in Max if the viewport was set to wire frame + show all edges + show all vertices.
Currently we are in the UV view, which in this example is the same as the Top View in Max and as you can see the top of the mesh looks correctly textured.
But why are the sides all wrong? Hang on a minute and I'll show you.
If you look at the view it looks as though we can only see 2 faces (the box has 12 faces, 6 sides 2 per side) However all the faces are there it's just that the vertices and lines overlap exactly.
To see what I mean and why the side texture is wrong Click on the black box next to Unwrap UVW in the modifier stack to open the sub-selections.
Click on Select Face and now select a side face in the User view.
Note: I find working in User view is easier than Perspective view.
In the Edit UVWs window turn on Filter SelectedFaces (the button with a red triangle on it)
Now all the faces except the ones selected are hidden, it looks like we have 2 vertices (small square boxes) joined by 1 edge. However what we are actually looking at is 4 Vertices and 5 edges but because they are at 90 degrees to the view they are over lapping exactly. (Look at your Top View to see what I mean)
Because the faces of the sides in the UVW map are covering a single line of pixels on the bitmap image we get that strange barcode looking effect. (it's like making an image that is just 1 pixel wide)
Note: although the faces currently look smaller than 1 pixel the smallest amount on the bitmap image is 1 pixel.
Currently all the Vertices of the UVW map are welded together like are mesh, so if we try to move one we would effect all the faces connected to it, even though they are hidden we would still move them as well.
So the first thing we will need to do is break up all the faces in the UVW map into separate parts. The advantage of this is that we are just changing the UVW Map while the mesh remains intact.
Make sure all the faces are unhidden, then drag a selection box around all the Vertices and click on Break Selected Vertices (looks like a black line with a red cross on it)
We can now safely move vertices without disrupting the rest of them. However we still have a problem in that all the vertices are overlapping each other so it's nearly impossible to select the one we want without selecting an incorrect one.
What I mean is this; currently we need to reposition the sides so they are aligned along the same axis as the top but we cannot drag a selection box around the vertices and move/rotate them as we would also select the vertices from the top, bottom and two other sides as well. So what we are going to have to do is use subtractive selection to isolate the vertices we need.
There are 2 basic methods of doing this.
The first we have already seen, by using Select Faces and Filter SelectedFaces we can hide all bar the required faces so there is then no problem in dragging a selection box.
Let's give it a go; (if you have deselected the side of your box in your User view then reselect one of them.)
First deselect all the vertices in the Edit UVWs window, (remember that just because a face/vertex is hidden does not alter the fact that it could still be selected.) Turn on Filter SelectedFaces so now all we have is the left side in the view, drag a selection box around the vertices and move them to the side.
Note: I like to constrain the movement direction to the direction I am going to move the face in just to keep every thing lined up neatly.
Don't worry about the fact that the face is off the texture, for now we are just breaking up the Mapping so we can flatten it. Once it's flat then we will align all the parts to the Texture.
Now turn off Filter SelectedFaces and you will see that the left side is separated from the rest of the mapping.
The Second way is in the Edit UVWs window select the rest of the vertices you don't want and use Expand Selection, then move them to separate the side that's left.
Sounds a bit confusing? Well it's hard to describe so I'll take you through this method to show you.
Lets detach the right faces, with every thing unhidden drag select all the vertices of the left side of the mapping (I've also selected the vertices of the detached left faces because they are a bit too close to the rest of it). Now we click on the Expand Selection button (the red cross), now some of the vertices on the right have also been selected. However it has only selected the vertices that are connected by edges to the ones we have already selected. You can see this on the bottom right vertex, the white square shows a vertex that has not been selected.
Now move the selected vertices to the left, this will leave the right faces where they where and thus separate them from the rest of it.
Remember that at this point it does not matter that we've moved the mapping off the texture as we are just breaking up the Mapping so we can flatten it. Once it's flat then we will align all the parts to the Texture. Now use these methods to detach the front and back faces.
Note: I've used the zoom controls and moved the sides a good distance away from the top so that when I rotate them they are not going to overlap in one big mess of lines 
Now we could select individual vertices and move them to lay the sides flat however as this is a simple box and the sides are all at 90 degrees to the UV plane it is far easier to rotate the sides. (with more complex meshes you will need to move individual vertices to get things flat but it is almost always better to rotate as this will cause less distortion)
The Edit UVWs window is currently set to UV view (which is the top view in this example) this means that rotation is done around the W axis. To rotate the left and right sides flat we need to rotate them around the V axis and to rotate the front and back sides flat we need to rotate them around the U axis. Click and hold down on the UV button to select the UW or VW view.
Which view is which? Umm…Err… I must be honest here, "I can never remember", most of the time I change view and if it's not the view I wanted I select the other one.
The main thing to remember is that in both UW and VW views is that the UV view is looking down from above, this will help you figure out what needs to be rotated in which direction. I've done a quick check on this example and UW is front view and VW is right view.
To make it easier to figure out which view you need drag select the vertices of the left detached side, now change view to UW or VW, if your selected vertices still look like a straight line then you got the correct view to rotate them in, if they form a square with a diagonal dividing line then you have the wrong view.
Once you have the correct view selected then you will need to rotate the selected vertices so as to align the faces facing up wards. Remember that you want the side of the faces that faces away from the box to point upwards. If you rotate the facing in the wrong direction then the texture will be flipped (ok not a problem on this model/texture at the moment but if for example we had writing on it, then it would come out backwards)
Hope this makes it a bit clearer for you, rotating the vertices on the left clockwise so if faces upwards. As you can also probably guess from the image we can also drag select the right detached face and rotate that into position in the same view.
Note: to help in the rotation turn on the Rotation Snap in Max as it also applies in the Edit UVWs window.
Now you can select the other view (UW) and rotate the front and back faces the same way (the front face will be on the left and the back face on the right)
Notice that I've also rotated the bottom face through 180 degrees and moved it to the side. The reason I've moved the Left&Right sides up slightly is so that each set is on a different level, so even if I later overlap the vertices in the VU view I can still easily select the vertices of 1 face by going back to the VW or UW view.
Return back to the UV view and it should look like this.
You have now laid out the mapping flat, now all that is left to do in this stage is to make it all fit on to the UV map (which is represented by the image in the Edit UVWs window.)
What am I on about? Well it's simple really. In Max the default setting for a bitmap texture is tilling. So although you only see 1 copy of the texture in the Edit UVWs window Max actually treats the texture as though it tiles so even though your faces are off the texture they are still textured in your user view.
However if your going to use a non tiling texture then you are going to have to make all the faces fit within that UV map. As we are going to make this box into a dice then we are going to need a different number on each side. Now we could align all the textures on top of each other so each side fills the UVmap exactly, then use 6 separate textures (1 for each side) and apply them to each side with a Multi/Sub-object material. But that's not the point of this Tutorial and not much help when you're dealing with complex non-square meshes.
So what we are going to have to do now is scale all the faces down and fit them onto the UV map as well as we can, without distorting the proportions of the faces. The sharp among you will of already realised that it's impossible to exactly fit 6 small squares into 1 big square without overlapping them or leaving gaps, quite correct, now we could of made the planar UV map a 3 to 2 ratio so it would all fit on neatly however that can often lead to distortions and other headaches when trying to sort out the UVW unwrapping.
This is because of the way that the UVW Unwrap modifier works, try changing the texture on your box to a non square one. You will notice that in the User View the texture has been squashed on the box to make it square, however in the Edit UVWs window (click on update map) the texture is correctly proportioned and the UV map has been stretched to fit it. To further illustrate the problems try drag selecting 1 of the sides and rotate it, you will notice that it does not just rotate but also deforms at the same time. (Don't worry you can click on undo button in Max to undo changes in the Edit UVWs window and just change the texture back to a square one to un-stretch it)
Another factor to remember is that very dew models are square and so have even less chance of fitting on to a square UV map exactly without being totally distorted, so you are going to have to get used to the fact that you will always have empty areas on a UV map.
Note: I often find empty areas on a UV map useful when making the texture, as I can do things like putting my name and the texture version number onto the image and although it's there you wonÂ’t see it on the model when it's applied.
Here is how I laid out mine, notice that I tend to leave at least a gap around all the edges as I find this helps when creating the texture image.
Now we have the UV map done we can now Export it as an image to use as a template to create the texture.
Under the Utilities tab select More and then select Texporter from the list.
Make the image square, select Edges > All Lines and Colorize by > Constant.
Note: I have added Texporter to the default list of utilities because I use it so much.
General tips for Texporter;
- Keep all the proportions the same, as we have been using square UV maps make a square texture.
- When making textures for games it is best to keep the size to powers of 2 for the most efficient use of memory. e.g. 2,4,8,16,32,64,128,256,512,etc
- Make the size larger than the final texture size, it's easier to work large and scale down than scale up.
- Unless you have carefully gone over your models Edge visibilities then I find it's best to select Edges > All Lines.
- I generally find it's best to use a non-smoothed Constant colour for creating texture templates as it becomes easier to select blocks of colour in Photoshop.
- The edge lines will be the inverse of the constant colour so play around with the Constant colour until you can easily tell the difference between Edge, face and background.
- Use a high quality non-compressed image format, you'll want as much detail as possible. Once you've made the final texture then you can use a compressed format to save space. (Targa .TGA is a good one to use)
Now we can open up Photoshop and start creating the texture. If your computer cannot cope with both Max and Photoshop open then REMEMBER to save your work before closing Max, do it any way just to be safe
(shouldn't be a problem with this simple model but might occur with more complex ones)
General PhotoShop tips;
- Layers are your friends, by keeping your image broken up into layers you can often make changes without impacting on the rest of the image.
- Use the .psd format to save your texture with all the layers intact, only flatten the image when you want to save the final texture/format. That way if you decide something needs to be changed you still have the layered copy to work on. (see above)
- If you cannot draw with your mouse get a Graphics Tablet. Many people find a Graphics Tablet far more initiative to use, the Graphite make is considered best but can be pricey, cheaper makes can still give excellent results. (I use an old Aiptek one which cost ÂŁ15)

- Don't be afraid to experiment and see what something looks like on your model. Sometimes something that looks good on the texture dose not work on the model and visa versa.
- Read up & learn some basic colour theory, it will be a big help when picking a colour palette.
To start with open the texture, you did remember to save it in a place you know with a name you can remember didn't you? Having 17 images called uvmaptemplate can get very annoying. 
This is what mine looks like
Black=Background (not part of the UV Map)
Dark olive=Faces
Light blue grey=Edges
This Image is going to be my template, I will never draw directly on it, just use it to select areas of the texture. (Remember my first Photoshop tip?)
To start with I rename the Background layer to template, then create a new layer and call it colour, this is because I'm going to use it to create simple blocks of pure base colour and all my shading and details will be created on other layers.
Why? Because then if I decide that I don't like the basic colour of it I can change it while all the rest of the detail is still there.
Because this is a simple dice and it will only be 1 base colour with little additional detail here is an example from one of my other models.
This is the texture image from my Bone sword model.
Left to right;
* Basic face layout (I didn't use constant colour here),
* base colour layer added,
* All layers (face layout, base colour, texture, shading, detail and highlight),
* All layers (but I just used the fill tool to change the blade's base colour from brown to blue)
* Final textured model render.
By keeping it all in separate layers you have a great deal of control over the image. (I'm not a school teacher, I'm not interested in your working out just the finished product
)
Back to our dice texture, on the template layer I use the magic wand selection tool to select the black (turn off anti-aliased), I then invert the selection so now I am left with all 6 sides selected. Without deselecting I change to the Colour layer and use the paint bucket tool to fill all the selected areas with colour (a nice red)
Note: sometimes Texporter does not fill the faces in correctly and you get black between the edges and faces on your export or you just need to select 1 face surrounded by others. This is where constant colour comes in useful, use the magic wand to select the faces you want to colour then expand your selection by 1 pixel to include the edges.
Next use the magic wand to select 1 of the sides and create a new layer called spots, on the spots layer use the top menu Edit > Stroke to create a 1 pixel width line around the side. There is a good reason for this.
Now hide the colour layer (click on the eye symbol in the layers menu (Top menu Windows > show layers)) so you can see the face edges on the template layer.
With the paintbrush tool draw a pattern of 7 dots. To get the positions correct draw 1 dot, the select it and the white border, while still on the selection tool hold down the left Alt button to create a clone, now rotate the clone by 90 degrees and use the white border to align it exactly over the top of the original. Now you have a second spot in the correct position, see I told you there was a reason for that white border 
Once you have all 7 spots in place it should look something like this.
Unhide the colour layer, select the spot pattern and border, then use the Left Alt again to place a clone over every face, again using the border to align it to each side. See it's still being useful.
Now you can delete the unwanted spots from each side (on a 6 sided dice every pair of opposite faces adds up to 7, so if the top side is 6 then the bottom side is 1)
Remember the way I laid out the UV map in paired faces?
Don't delete the white border yet because I have a further use for it 
Now we could just flatten the image and use it but I think it's a little too plane, so lets have some fun with filters and layer effects to make it a bit more interesting.
While the spot layer is still selected apply a Blur More. (top menu Filter > Blur > Blur More) That's smoothed off the spots and borders a bit (if we had flatten the image then edges of the sides would of also been blurred)
Now apply an Emboss layer effect to make the spots look less like flat and more like dimples. You'll also notice that the white border also causes a slight rounding effect to the sides (it's still being useful)
Note: Emboss is a rather “quick and dirty” effect, often it will not work correctly as faces should often be shaded in opposite directions, it also has the habit of overlapping other faces. It's best to do this sort of thing buy hand.
Note: However for a quick effect it works well and you don't need much artistic skill to use it 
It's still a little plane and flat so I'll add a simple texture layer to break up the red a bit.
Create a new layer called Texture then move it between the colour and spot layers, now use the paint bucket to fill it with a flat 50% grey colour. Yes you've now got spots over flat grey but don't panic, just read on.
Now we've done this because Photoshop will not let you apply a filter to an empty area, so first apply an Add Noise filter to the layer. (I've used 25, Gaussian, monochromatic) The dots are a bit small so next add a Pixelate > Facet filter. Better but let us just soften it a little with a Blur More filter. That's good. But everything is still grey? Not for much longer.
Change the layer blending mode from Normal to Hard Light and all the colours are back but now the red is no longer flat but has a texture to it. Still a bit strong so change the layer Opacity to 50% Now that looks far better.
Save off your image in .psd format so all the layers are preserved, then ever flatten the image and SAVE AS (if you just save you'll go right over the top of the layered one) and save it as the format you want to use OR use Save a Copy, select a different format and it will be automatically flatten for you.
Go back into Max and apply your new texture to the box and there you have it a Six sided dice.
Hurm… see what I mean about the emboss being "quick and dirty", also that useful white border is now a problem. But because it's part of the emboss that creates the shading effect around the sides we cannot delete it from the layer without impacting on the emboss.
But never fear because we can get rid of it with the UVW Unwrap modifier. Select the box and open the Edit UVWs window again, your texture image should now be showing. Go over all the vertices and move them inwards slightly until they are no longer on any of the white borders.
Note: turning on the pixel snap and zooming right in on each vertex will make it far easier.
And now we're finally finished.
Note: I've also rotated the faces in the Edit UVWs window to align the emboss effect and changed to perspective view for a better shot.
Now you know the basics have another go and make something more complex.
|