190 likes | 214 Views
Computer Graphics Imaging. Lecture 13 and 14 UV Mapping. Why UV mapping. The procedural texture mapping is good for simple shaped objects The image-object mapping is automatically calculated Simple, but users have very limited control over which vertex is mapped to which point on the image
E N D
Computer Graphics Imaging Lecture 13 and 14 UV Mapping
Why UV mapping • The procedural texture mapping is good for simple shaped objects • The image-object mapping is automatically calculated • Simple, but users have very limited control over which vertex is mapped to which point on the image • UV mapping is do-it-yourself texture mapping • Users can specify which vertex is mapping to which point on the image • Most characters in 3D games and movies are UV mapped
UV mapping • The basic idea is to cut the 3D mesh model and “flatten it” • The flattened mesh is called a “UV map”, “UV texture”, or “UV layout” • You can superimpose the UV layout on an image and adjust the UV layout so that each vertex is mapped to the appropriate point on the image • Then you use the UV layout to guide the texture mapping
New in Blender 2.46+ • The user’s manual and some old UV mapping tutorials refer to a “UV Face Select” mode • Since Blender version 2.46, the “UV Face Select” mode is merged into the “Edit” mode • When reading these documents, replace “UV Face Select” mode with “Edit” mode, and the rest should still apply
UV mapping process • Step 1: create UV layout • Split the window into two • Left: 3D view • Right: UV/Image editor • In the 3D view window, enter “Edit” mode • Select the faces you want to unwrap • Press U, and select “unwrap” (or other unwrapping methods) • You will see the flattened mesh appear in the UV/Image editor window
UV mapping process • Step 2: adjust UV layout • In the “UV/Image” window, select “Image” and open an image • You may replace this image later • Adjust the UV layout to match the image • Can move individual vertex or face • Can rotate or scale the faces in UV layout • In the 3D view, change Draw Type to “Textured” • You can preview how the image is mapped to the object • But you are not able to render it yet. • To render the result, you need to add material
UV mapping process • Go to “Editing” (F9) panel • Under “Mesh”, take a note of the name of the UV Texture • By default, it’s “UVTex”
UV mapping process • Step 3: apply the UV layout in texture mapping • In 3D view, switch to Object mode • Select the object, and create a new material for it • Create a new texture channel • Add a texture image • Load the texture image you used for adjusting the UV layout
UV mapping process • Under “Map Input”, press “UV” button and type in the name of the UV layout (e.g. UVTex) • Render the scene and now you can see the result of UV mapping
UV unwrapping method • Press U to open the “UV Calculation” menu • You can unwrap the mesh in different ways • (Standard) unwrap • Cube • Cylinder from view • Sphere from view • And some other unwrapping methods • For “Cylinder from view” and “Sphere from view”, the object’s axis should be perpendicular to the current line of sight • Usually you want to switch to the front view
Mark seam • You may mark seams on the 3D mesh model to tell Blender where to cut the mesh open • So the mesh is unwrapped the way you want • In Edit mode, select edges, press Ctrl + E, and select “Mark seam” • When you unwrap this mesh, Blender will cut along the seams
Different UV mapping for different faces • You may want to UV map different images to different faces (or face groups) • First, select and unwrap different faces independently • And adjust the UV layout for different faces independently • To apply the UV map, you need to assign different materials to different faces • See http://wiki.blender.org/index.php/Doc:Manual/Materials/Multiple_Materials
Different UV mapping for different faces • Suppose you want UV map image A to a group of faces (group 1), and map image B to another group of faces (group 2) • In Edit mode, select face group 1, in Editing (F9) panel, under “Link and Materials”, create a new material and press “Assign” button to assign the material to group 1 • In “Material Buttons” panel, you may give the new material a more meaningful name • Don’t forget to assign the new material to the faces
Different UV mapping for different faces • Create a new texture channel for the new material • Load image A as a texture • In “Map Input”, press “UV” button and type in the name of the UV layout
Different UV mapping for different faces • In Edit mode, select face group 2, in Editing (F9) panel, under “Link and Materials”, create a new material and press “Assign” button to assign the material to group 2 • Create a new texture channel for the new material • Load image B as a texture • In “Map Input”, press “UV” button and type in the name of the UV layout
Export UV layout • You can export your UV layout to an image file • In “UV/Image editor” window, select “UV” Scripts “Save UV Face Layout”. • You can open this UV layout image in Photoshop or GIMP to guide the creation or painting of your texture image • E.g. use the UV layout as a layer in Photoshop or GIMP to guide • Then you can use that image for texture mapping
Texture painting • You can paint directly on the image in “UV/Image Editor” window • You need to open an image first • Select Image “Texture painting” • Press C to bring out the “Paint Tool” window • See http://wiki.blender.org/index.php/Doc:Manual/Textures/UV/Painting_the_Texture for details
Pin • Sometimes you may want to keep part of the UV layout and “re-unwrap” the rest • You can pin certain vertices (or faces) in the UV layout so that they won’t be changed if you unwrap the mesh again • A useful feature if you want to progressively refine the UV layout
Pack image • In “UV/Image editor” window, select Image “Pack image” • The current image is packed into the Blender file. • The next time you open the “UV/Image editor” window, the image will be automatically loaded. • This is useful if you need to share the Blender file with someone else.