Blender Tutorial

Blender UV Mapper Tutorial
 
 
Skill Level:          Beginner (Tutorial assumes user knows the basic functions of Blender and has read the 'Introduction' and 'Application 2' sections of the TexMesh Tutorial. The TexMesh Tutorial ).

Blender Version: 2.37a

Tutorial Version: August 30, 2005

Resources: N/A





Introduction.

This tutorial is designed to illustrate an alternative technique to achieve similiar results to those obtained using the Blender TexMesh feature.



Advantages of UV Mapping (as compared to using the Texmesh function):

Disdvantages of UV Mapping (as compared to using the Texmesh function):


We will begin with the "winding river" example from the TexMesh tutorial.

Assuming that we have already created our mesh, added another lamp, and positioned the Camera 12 units above the origin, you should have something like the following:



Figure 1. Mesh.


Split the 3DWindow into two side-by-side windows and make the right window an UV/Image Editor Window by either pressing Shift_F10 (with your mouse cursor in the the right side window), or by selecting 'UV/Image Editor' from the window type selection icon located in the lower left corner of the right hand side window.

With the Plane object selected, [Tab] into Edit mode and ensure that all vertices are selected and press Ctrl_n to ensure that all the normals are pointing outwards. [Tab] out again to Object mode. Press [f] to enter UV Face select mode. With your mouse cursor located in the 3DWindow, press [U] and select 'From Window' from the popup menu.


Figure 2. Selecting Mesh Unwrap Method.



From the UV Image Editor's UV menu, select 'Layout Clipped to Image Size'. This restricts the UV Mapped points from going outside the 'image' applied.


Figure 3. Setting UV Clipping Property.



Select all of the points in the UV/Image Editor and scale them up to the maximum possible, such that it fills the entire gray square.


Figure 4. Scaling UV Co-ordinates.



Now that we've defined the UV co-ordinates, we can set 'UV' in the 'Map Input' panel located in the Material Buttons window.


Figure 5. Setting UV.



Apply the Dots2.dll texture to the Plane as explained in the TexMesh tutorial.

Tip: You can get an idea of the applied Dots2 plugin texture location and scale by switching to Shaded view mode.


Figure 6. Dots2 Texture Preview.



Adjust the SizeX and SizeY parameters for the texture so that the dots are properly scaled.


Figure 7. Adjusting the Texture Scale.



Render.


Figure 8. Rendered Result.



Switch to edit mode for the plane and using the Proportional Edit mode (Smooth falloff) as before, pull the center of the plane up 2 grid units. Render once again and you should get the following result.


Figure 9. Modified Mesh Result.



All that remains to do is add an OfsX Material IPO curve and render out the final animation (Be sure to adjust the File Format to save to, End Frame, etc before rendering).
Done.






Now to replicate Application 2 described in the TexMesh tutorial using UV mapping.

Though, we will do things slightly different in order to reduce the amount of work unwrapping the spring/coil shaped mesh.

To quickly recap creating the spring/coil mesh from before:



You should end up with a one rotation mesh tube loop that looks like:

Figure 2_1. Result.



To make it possible to unwrap the tube into a 'grid like' layout, we need to create a seam running along the length of the tube.

The best place to place the seam would be on the bottom, so place your mouse cursor over an edge on the bottom line of vertices running the length of the tube and while pressing Alt, RMB click on the edge. Then press Ctrl_e and select 'Mark Seam' from the popup menu.

Figure 2_2. Result.



Now that we have the seam marked, we're ready to unwrap the mesh.
Add an UV/Image Editor window as before. Select all the vertices of the mesh and then [Tab] to Object mode.
Next, press [f] to enter UV Face select mode. With your mouse cursor located in the 3DWindow, press [U] and select 'LSCM' from the popup menu.


Figure 2_3. Selecting Mesh Unwrap Method.


You should get a result similiar to that shown below in Figure 2_4. Though we need the layout to be more grid-like with evenly spaced divisions so that, when we animate the texture it will move at a uniform speed.


Figure 2_4. LSCM Unwrap Result.


As we did in the previous section, we will limit the points to the UV co-ordinate texture space by setting 'Layout Clipped to Image Size' from the UVs menu. The UV/Image Editor defaults to a mode where you can move each face's vertices independently from the neighboring face. Instead, we want the vertices of all the faces to remain connected, like in the 3Dwindow when you move one vertex it will remain inter-connected to its neighbors. To set this option, we select 'Stick Local UVs to Mesh Vertex' from the 'Select' menu. Note that the UV/Image Editor window indicates that this mode is set by placing a large single yellow dot in the lower left hand corner.

Select all the points and move them vertically to about the center of the image window. Scale the points vertically as much as possible.
You scale vertically as in the rest of the Blender User Interface by pressing 'S', 'Y'; or by using the 'drag in the direction to scale/mouse MMB click/LMB click or press [Enter] to accept' operation.


Figure 2_5. Setting UV/Image Editor Properties.



Now comes the arduous part of this technique - laying out the points in a nice equally spaced grid. First you should know that the default extent of the UV/Image Editor window (ie. with no image opened) goes from a X/Y co-ordinate of 0,0 in the lower left hand corner to a maximum of 256,256 in the upper right hand corner. Since our mesh loop is a 16 vertice mesh circle which forms one rotation/loop in 16 steps, this means that each line of vertices neeeds to be spaced 16 units apart: 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256.

To achieve this we can either select the points in the UV/Image Editor using the standard selection tools (Border select, circular select), or we can select the vertices in the 3DWindow. If you choose the second method, you will need to select a row of faces using Alt_RMB, plus Alt_Shift_RMB to select the next 'row', since the UV Editor requires the entire face to be selected to display anything. Either way it's alot of work and it is a good idea to maximize the UV/Image Editor window to make it somewhat easier to select the points.

Tip: The Proportional Edit Tool also works in the UV/Image Editor (HotKey: o, and Shift_o to change the FallOff mode), in case you would like to spread the points apart vertically on the left side of the UV/Image Editor to make them easier to select.

Note: You can find what features are available for the UV/Image Editor, including what the associated hotkeys are, by simply browsing the menus in the Window header.

So let's begin by selecting the bottom row of points. Then press 'w' :: 'Align Y' to flatten out the points along the Y Axis.


Figure 2_6. Aligning Points.



To move the points to the bottom of the UV/Image Editor, we will bring up the numeric Properties panel by pressing [n].
In the 'Median Y' numeric button field, enter a value of 0.

Note: For the points along the outside border, you can just simply grab/move them to the edge.

Tips:



Figure 2_7. Moving the Points to Zero.



From here it becomes very repetitive, repeat the Align and setting the Median value operation for each row and column of points until you end up with an evenly spaced grid like:


Figure 2_8. Unwrapped Result.



Now the hard part is over.
Set 'UV' in the 'Map Input' panel located in the Material Buttons window.

To obtain more than one loop for the mesh, first scale the UV layout in the UV/Image Editor by 0.5 horizontally and move it all the way to the left. Make sure the 'Clip' option in the UVs menu is still set to avoid dragging it beyond the limits. Next duplicate the mesh loop object in the 3DWindow and move it vertically until it lines up with the first loop. Join (Ctrl_J) the two loop objects. Tab into edit mode and connect them together by removing duplicate vertices. (You may need to increase the 'Remove Doubles' limit slightly).


Figure 2_9. Adding a second Loop.


Now you should have two sets of UVs in the UV/Image Editor (One set of points is lying directly on top of the other). Click on a point and press Ctrl_L to select one group (FYI: In Blender, the term 'island(s)' is used to refer to an isolated group of points) and move it all the way to the right. Select a face in the mesh tube to ensure that you moved the right group of points (ie. compare the location of the face you selected to its placement in the UV/Image Editor); if you selected a face from the lowest mesh loop, you should see a face hi-lited in the UV/Image Editor in the left most group of points. If it isn't, you will need to switch the groups in the UV/Image Editor. Also ensure that the start of the second mesh loop is the same as the first loop in it's horizontal placement in the point layout in the UV/Image Editor. If it isn't, you will need to mirror either one or perhaps both of the group of points about the X axis by pressing [m] :: 'X Axis'.


Figure 2_10. Adding a second Loop.


The rest is identical to the TexMesh tutorial - add a material, a Material ofsX IPO curve and render.
You may also want to set SubSurf for the mesh to obtain a better result.

If you want to use another texture(s), simply add them to the texture channels, ensuring that you have selected 'UV' mapping for each.


Figure 2_11. Render Result.





Now to Application 2B.

Though this time, we will be using straight NURBs Surfaces.

One of the interesting details of NURBs, is that they are generated with the UV information already built-in.
This is why, when you have a control point selected in a NURBs object, you can press Shift_r to alternately select the row/column of control points (ie. Press Shift_r once to select the row of control points in the 'U' direction, press Shift_r a second time to select the contol points in the 'V' direction).

This means no need to unwrap a mesh or use the UV/Image Editor. Which is a good thing, because I don't know about you, but I have better things to do with my time than unwrap 4,000 lines of vertices ;) .


Yikes.



We will start from the point in the TexMesh tutorial where we have just finished creating the NURBs Surface tube using the DupliFrames method. Here is the blend file with the material already asigned to the Nurbs Surface: nurbs_02.blend


If you make a test render now at the current frame 125, you will notice that the left side of the tube is transparent (more or less). To fix this, select 'UV Orco' from the Edit Buttons window [F9] - 'Curve and Surface' panel.


Figure 2b_1. Frame 125 Render.




Figure 2b_2. Set UV Orco.



After another render:


Figure 2b_3. Frame 125 Render #2.


Due to the manner in which we created this NURBs Surface tube (using the DupliFrames method), you will notice that instead of the texture being offset in the X direction, it appears to be offset in the Y direction. Hence, the lower part of the tube is transparent. To fix this, we need to switch the X and Y coordinates in the co-ordinate mapping matrix buttons located in the Material Buttons window :: 'Map Input' panel as shown below in Figure 2b_4.


Figure 2b_4. Adjust Co-ordinate Mapping Matrix Buttons.


We're getting there. If you try a few test renders near the start, middle and end of the animation, it looks good except for the fact that the tube is disappearing from the right to left, instead of from left to right. To correct this, we need to make a couple of changes: invert the texture effect ( Figure 2b_5 ) and scale the Material OfsX IPO curve vertically by -1 (Press 'S', 'Y' and then LMB click or press 'Enter'
Tip: If you accidentally move your mouse a bit during the scaling operation, you can press 'Ctrl' to snap the scaling factor back to -1).


Figure 2b_5. Inverting the Texture Effect.


Figures 2b_6a and b. Inverting the OfsX IPO Curve.

All that remains now to do is supply a proper path and file name to save the animation to, set the file format to save to, and render out the animation.


Figure 2b_7. Final Render.







Summary


Well, as we've seen Blender gives us lots of different ways to achieve our goals. Which technique you choose is, of course dependant on what specific task you are working on, and the result that you're trying to achieve.

For more complex shapes, NURBs would probably be your best bet, for their ease of setting up and application of animated textures (Despite the slight additional work to correct the final result when the NURBs Surface is created using DupliFrames).

Mesh/UV Mapping could be a better alternative if you intend to animate the final result with armatures or would like to have access to the more advanced tool options available in Blender when working with meshes. Unfortunately, I haven't been able to figure out a way yet to translate the NURBs UV mapping data when converting a NURBs object to a Mesh object.

TexMesh would be best suited to instances where you wanted to recreate the active object from scratch or where you are dealing with a complex mesh object which might be too time-consuming or cumbersome to use the UV/Image Editor.

and that's a wrap...

.