Manual/PartIV/UV Mapping
Wikipedia,自由的百科全书
The most flexible way of mapping a 2D texture over a 3D object is UV mapping 一个2维纹理映射到一个3维物体上最灵活的方式是UV映射
Contents |
Introduction
For more complex 3D models, regular Cubic, Cylindral or Sphereical mapping, is usually not sufficient. For even and accurate projection, UV mapping can help. This can be used to apply textures to arbitrary and complex shapes, like human heads or animals. Often these textures are painted images, created in applications like The Gimp, Photoshop, or your favorite painting application.
对于更加复杂的3维模型,常规的立方体,圆柱体或者球体映射通常是不够的。UV映射有助于平滑而精确的投影,可被应用于任意的复杂形状,例如人头或动物。通常这些纹理是在类似Gimp,Photoshop或者你喜欢的绘图程序中创建好的图片。
While procedural textures (described in the previous chapters) are useful - they never repeat themselves and always 'fit' 3D objects - they are not sufficient for more complex or natural pictures. For instance, the skin on a human head will never look quite right when procedurally generated. Wrinkles on a human head, or scratches on car do not occur in random places, but depend on the shape of the model and its usage. Manually painted images, or images captured from the real world gives more control over the final result. Instead of playing with numerical sliders, artists will be able to control every pixel on the surface.
然而程序化纹理(在前一章描述)很有用,它们不重复自己并且总是适合三维物体-它们不足以应用于更复杂的或自然的图片。比如,当使用程序化生成的纹理时,人头上的皮肤将看起来不那么正确。人头上的皱纹,或者车上的刮痕没有出现在随机位置,但取决于模型的形状和它的使用。手工绘制的图像,或者从现实世界获取的图像提供对最终效果更多的控制。取代把玩数字滑块的是艺术家将能够控制物体表面的每一个像素。
A UV map describes what part of the texture should be attatched to each polygon in the model. Each polygon's vertex gets assigned to 2D coordinates that define which part of the image gets mapped. These 2D coordinates are called UVs (compare this to the XYZ coordinates in 3D). The operation of generating these UV maps is also called "unwrap", since it is as if the mesh were unfolded onto a 2D plane.
UV映射描述了纹理的哪部分应该被贴在模型的每个多边形上。每个多边形的顶点得到一个二维坐标,该坐标定义了图片的哪个部分被映射。这些二维坐标称为UV坐标(与三维坐标XYZ区分开)。因为映射过程似乎将mesh展开到一个二维平面上,这个生成UV映射的操作也被称为UV展开。
| A Tip: UV mapping is also essential in the Blender game engine, or any other game. It is the de facto standard for applying textures to models; almost any model you find in a game is UV mapped. |
| 一个要点: UV 映射也是Blender游戏引擎,或者任何其他游戏中的基础。它是应用纹理到模型上的标准方法;你在一个游戏中发现的模型几乎都是UV映射。 |
The UV Editor UV 编辑器
UV Mapping is done in Blender within the UV Editor window and a special mode in the 3D Window called UV Face Select Mode. The UV-Editor allows you to map textures directly onto the faces of meshes. Each face can have individual texture coordinates and an individual image assigned to it, and can be combined with vertex colors to make the texture brighter or darker or to give it a color. By using the UV-Editor each face of the Mesh is assigned two extra features: 在Blender中UV映射在UV编辑器窗口和3D窗口中称为UV面选择的特殊模式下完成的。UV编辑器允许你直接映射纹理在mesh的面上。每个面可以有单独的纹理坐标以及单独的图片,并且可以结合顶点颜色来使得纹理变亮或变暗或者给它一个颜色。通过使用UV编辑器,Mesh的每个面被赋予两个额外的特征:
- four UV coordinates These coordinates define the way an image or a texture is mapped onto the face. These are 2D coordinates, which is why they're called UV, to distinguish them from XYZ coordinates. These coordinates can be used for rendering or for realtime OpenGL display.
- 四个UV坐标 这些坐标定义了一幅图片或一个纹理怎样映射到面上。这些是二维坐标,为了区别于XYZ坐标,因而被称为UV。这些坐标可以用于渲染或者实时OpenGL显示。
- a link to an Image Every face in Blender can have a link to a different image. The UV coordinates define how this image is mapped onto the face. This image then can be rendered or displayed in realtime. A 3D window has to be in "Face Select" mode to be able to assign Images or change UV coordinates of the active Mesh Object.
- 一个图像的链接 Blender中每个面都可以有不同的图像链接。UV坐标定义了这幅图像如何映射到面上。这幅图像可以被渲染或在实时环境下显示。必须在3D窗口中激活“面选择”模式才能赋予图片或者改变当前Mesh物体的UV坐标。
First add a Mesh Object to your Scene, then enter the FaceSelect choosing the UV face select entry in the Mode menu. Your Mesh will now be drawn Z-buffered. If you enter the Textured draw mode (ALT-Z, also called "potato mode") you will see your Mesh drawn in white, which indicates that there is currently no Image assigned to these faces. You can control the way the faces are drawn using the Draw Edges and Draw Faces buttons in the UV Calculation Panel. If Draw Edges is activated all faces will be drawn outlined. With Draw Faces activated, all selected faces will be shown in a light pink tone (or the theme colour). 首先添加一个Mesh物体到你的场景中,然后选择模式菜单中UV面选择项进入面选择模式。你的Mesh现在Z-缓冲绘制了。如果你进入纹理绘制模式(ALT-Z, 也称为 "马铃薯模式") 你就会看到你的Mesh绘制成白色,这表示当前没有图像赋给这些面。你可以通过使用UV计算面板上的绘制边和绘制面按钮来控制面的绘制方法。如果绘制边被激活那么所有的面将绘制轮廓。如果绘制面被激活了,所有选中的面会用浅粉红色调显示(或者使用主题色)。
Press AKEY and all faces of the Mesh will be selected and highlighted by dotted lines. You can select faces with RMB, or BorderSelect (BKEY) in the 3D window. If you have problems with selecting the desired faces, you can also enter EditMode and select the vertices you want. After leaving EditMode the faces defined by the selected vertices should be selected as well. 按AKEY网格所有的面都被选中并且虚线高亮。你可以使用RMB选择面,或者在三位窗口中进行边界选择(BKEY)。如果你选择想要的面时遇上了麻烦,你也可以进入编辑模式选择相应的顶点。离开编辑模式之后,选中顶点定义的面也将被选中 Only one face is active. Or in other words: the Image Window only displays the image of the active face. As usual within Blender, only the last selected face is active and selection is done with RMB. 只有一个面是活动的。或者换句话说:图像窗口仅仅显示活动面的图像。通常在Blender中,之后最后被选中的面是活动的,并且选中是通过RMB完成的 Change one window into the UV Editor/Image Window with SHIFT-F10. Here you can load or browse an image with the Load button. 使用SHIFT-F10改变窗口为UV编辑器/图像窗口。这里你可以使用加载按钮加载和浏览一幅图像 If you are texturing an item for a game, be sure to use image sizes that are powers of two (4, 8, 16, 32, 64, 128 ...) for both width and height, so they can be drawn properly in realtime using OpenGL. (note: most 3D cards don't support images larger than 2048x2048 pixels). For rendered artwork, textures can be any size. 如果你正在为一个游戏创建纹理,那么应该确认使用图像的尺寸是2的幂(长和宽都是),这样它们才能被绘制
Opening an image in the UV/Image Editor while in UV Face Select mode automatically assigns the image to the selected faces. You can immediately see the effect in the 3D window in Textured View mode. UV面选择模式下,在UV/图像编辑器中打开一幅图像会自动将该图像应用到被选中的面上。你可以立刻在纹理视图模式下的三维窗口中看到效果
Unwrapping tools 解包工具
In the 3D window, you can press UKEY in FaceSelect mode to get a menu to calculate UV coordinates for the selected faces. You can also perform an unwrapping using the UV Calculation Panel in Edit Buttons. This panel also provides better control over the unwrapping process. 在三维窗口,你可以在面选择模式下按UKEY来获取一个菜单以计算选择面的UV坐标。你也能够在编辑按钮组中使用UV计算面板进行解包操作。该面板对解包过程提供更好的支持
The available UV unwrapping algorithms are: 可用的UV解包算法有:
- Cube This determines cubical mapping.
- 立方体 决定立方体映射
- Cylinder, Sphere Cylindrical/spherical mapping, calculated from the center of the selected faces.
- 圆柱体、球体 圆柱体/球体映射,从选中面的中心开始计算
- Bounds to 1/8, 1/4, 1/2, 1/1 UV Coordinates are calculated using the projection as displayed in the 3D window, then scaled to the given fraction of the image texture.
- 1/8、1/4、1/2、1/1边界 UV坐标使用在三维窗口中显示的投影进行计算,然后缩放到图像纹理的给定部分
- Standard 1/8, 1/4, 1/2, 1/1 Each face gets a set of default square UV coordinates which are then scaled to the requested fraction of the image texture.
- 1/8、1/4、1/2、1/1标准 每个面都有一系列缺省的平方UV坐标,它们被缩放到指定的图像纹理部分
- From Window UV coordinates are calculated using the projection as displayed in the 3D window.
- 从窗口 UV坐标使用三维窗口中显示的投影进行计算
- LSCM UV coordinates are calculated using the Least Squares Conforming Maps algorithm. Use it together with the marked seams.
- LSCM UV坐标使用最小平方相似映射算法进行计算。将其和标记缝一起使用
In the UV mapping panel, you can tweak the way the mapping is done and how it is shown in the 3D window when the model is in Face Select Mode. With View Aligns Face enabled, Cylindrical and Spherical unwrapping is affected by the view. The view is supposed to be in front of the Cylinder/Sphere, with the caps at the top and bottom of the view. The Cylinder/Sphere is cut at the opposite side of the view. 在UV映射面板中,你可以微调映射实现的方式,以及在面选择模式下时它如何在三维窗口中显示。有效视图对齐面,柱面和球面解包会被视图影响。视图被认为应位于圆柱体/球体之前,帽子在视图的顶部和底部。圆柱体/球体在视图的反方向被切除 Size and Radius define the scaling of the map when using Cube or Spherical/Cylindrical mapping respectively. 当分别使用立方体或者圆柱体/球体映射时,尺寸和半径定义映射的缩放 With VA Top (View Aligns Top) enabled, the view must look through the Cylinder / Sphere. It is cut at the top of the view. With this activated you can also define how the view is rotated in respect to the poles using Polar ZX and Polar ZY options. 有效VA顶(顶部对齐视图),视图必须通过圆柱体/球体观察。它在视图顶部被切除。有效该设置,你也可以定义使用ZX极点和ZY极点时,视图如何相对极点进行旋转 If Al Obj is enabled, the Cylinder/Sphere is rotated based on the Object's rotation. 如果所有对象都有效,圆柱体/球体的旋转就基于对象的旋转 Draw Edges and Draw Faces in the panel activate visualization of edges and faces in the 3D Window while in Face Select Mode. Selected faces in this mode will be drawn in a transparent purple (or the theme color), similar to Edit Mode. Drawing of Seams in Edit Mode and Face Select Mode can be toggled with Draw Seams. The colors of seams can also be changed in the Themes options. 面板中的绘制边界和绘制面在面选择模式下,在三维窗口中激活边界和面的可视化。处于该模式的选中面使用一种透明的紫色被绘制(或是主题颜色),类似于编辑模式。在编辑模式下和面选择模式下,画缝可以通过画缝来控制动作与否。缝的颜色也可以在主题选项中被修改
Editing UV coordinates 编辑UV坐标
In the UV Editor you will see a representation of your selected faces as yellow or purple vertices connected with dotted lines. You can use the same techniques here as in the Mesh EditMode to select, move, rotate, scale, and so on. With the Lock button pressed you will also see realtime feedback in 3D of what you are doing. Scaling and Translating of vertices can be done in the local X or Y axis of the map if needed. Just press XKEY or YKEY after entering the scale command (SKEY). Proportional editing tool is also available and it works the same way that in Edit Mode for meshes. Vertices in the UV Editor can be hidden or shown using the HKEY and ALT-H respectively, the same way as in Edit Mode. 在UV编辑器中,你将会看到一个代表选中面的黄色或者虚线连接的紫色顶点。这里你可以使用与网格编辑模式中相同的技巧进行选择、移动、旋转、缩放等等。按下锁定按钮,你也将看见三维的操作实时反馈。如果需要的话,在本地的映射X或者Y轴完成顶点的缩放和平移。只需在输完缩放命令(SKEY)之后按下XKEY或者YKEY。比例编辑工具也可以使用,工作方式同编辑模式下的网格相同。UV编辑器中的顶点可以象在编辑模式中一样,分别使用HKEY和ALT-H来隐藏或者显示
There are several selection modes available in the UV Editor. Since a vertex is drawn in the Editor for each face it belongs, sometimes is hard to tell if we are selecting the same vertex or not. UV编辑器中有几种选择模式。既然在编辑器中顶点为其每个所属的面都绘制一遍,有时很难判断是否选中了相同的顶点 With Stick UVs to Mesh Vertex enabled, a RMB click will not only select one UV vertex, but also all the UV vertices that belong to the same mesh vertex. You can use this mode even if it is not activated in the menu, by keeping CTRL pressed when selecting a vertex. 有效将UV附着到网格顶点,单击RMB不仅将选择一个UV顶点,而且会将指向该网格顶点的所有UV顶点都选中。即使该模式没有在菜单中被选中,你还可以通过在选择顶点时按住CTRL来实现该功能 Stick Local UVs to Mesh Vertex works in the same way, but only select the UVs that are 'connected', meaning they are within a 5 pixel range of the first selected UV. You can also use this mode even if it is not set as default, by keeping SHIFT pressed when selecting a vertex. 将本地UV附着到网格顶点工作方式相同,但是只选中相连的UV,这意味着它们在第一个选中UV的5像素范围内。即使缺省无效,你也可以通过在选择顶点时按住SHIFT来实现该功能 These options are toggled on/off by respectively pressing CTRL-C and SHIFT-C. 这些选先分别通过按下CTRL-C和SHIFT-C来开关 With Active Face Select enabled, a RMB click will select a face, and make it the active face. This can be toggled on/off by pressing CKEY. 活动面选择有效时,单击RMB将选择一个面,并且使其为活动面。还可以通过CKEY控制其开关 For all three of these options a special icon is displayed in the bottom left of the UV Editor. Note that Active Face Select and Stick UVs to Mesh Vertex can also be combined. 这三个选项在UV编辑器的左下部显示为一个特殊的图标。注意活动面选择和Template:将UV附着到网格顶点可以组合使用 Unlink Selection will based on the current selection, only leave those UVs selected, of which the faces are fully selected. As the name implies, this is particularly useful to unlink faces and move them elsewhere. The hotkey is ALT-L. 解链选择将基于当前选中,仅仅保留那些面被完全选中的选中UV。就像名字暗示的那样,解链面并且将其移动是特别有用的。热键是ALT-L Select Linked UVs works similar to Select Linked in the 3D View. It will select all UVs that are 'connected' to currently selected UVs. The difference with the 3D view is that in the UV Editor, UVs are connected 'implicitly'. Two UVs are considered selected if the distance between them is no longer than 5 pixels. The hotkey is LKEY. 在三维视图中,选择链接UV工作方式类似与选择链接。它将选择所有相连的UV到当前选中的UV。三维视图的不同在于:在UV编辑中,UV是隐含连接的。如果间距不大于5个像素,就认为两个UV是被选中的。热键LKEY Different parts of a UV map can be stitched if the border UV vertices correspond to the same mesh vertices by using the Stitch command (VKEY). The Stitch command works joining irregular outlines, just select the vertices at the border line using the "Stick UVs to Mesh Vertex". 如果边界UV顶点对应相同的网格顶点,那么UV映射中不同部分可以使用缝合命令(VKEY)缝合。缝合命令使用不规则轮廓,仅在边界线上使用“将UV附着到网格顶点”选择相应的顶点 Limit Stitch works in the same way. The difference is that it only snaps together UVs within a given range. The default limit is 20 pixels. Its advantage over 'Stitch' is that it prevents UVs, that are supposed to stay separate, from being stitched together. You can see on the screenshots how Limit Stitch prevents wraparounds when stitching together two parts of a Cylinder. 限制缝合工作方式相同。不同之处在于它仅仅用一个给定的范围吸附住UV。缺省限制为20像素。它比简单缝合的改进之处在于它可以防止那些希望相对独立的UV不被缝合。你可以在屏幕截图中看到缝合圆柱面的两部分时,限制缝合是如何工作的
You can merge UVs that do not correspond to the same mesh vertex by using the Weld command (WKEY). You can also use the Weld command to align in X or Y several vertices. After pressing WKEY press XKEY or YKEY to choose which axis you to align to 通过使用组合命令(WKEY)你可以合并不对应相同网格顶点的UV。你也可以使用组合命令将多个顶点延X轴或是Y轴进行对齐。按WKEY之后,按XKEY或是YKEY来选择你希望延哪根轴对齐 Some tips: 一些小技巧:
- Press RKEY in the 3D
window to get a menu that allows rotation of the UV coordinates.
- 在三维窗口中按RKEY可以得到一个菜单,允许旋转UV坐标
- Sometimes it is necessary to move image
files to a new location on your hard disk. Press NKEY in the ImageWindow to get a Replace Image name menu. You can fill in the old directory name, and the new one. Pressing OK changes the paths of all images used in Blender using the old directory. (Note: use as new directory the code "//" to indicate the directory where the Blender file is).
- 有事将一幅图片文件移动到新的硬盘位置是很必要的。在图像窗口中按NKEY来获取替换图像名称菜单。你可以输入原始目录名称和目标目录名称。按OK改变所有Blender使用的原始目录中图像的路径。(注意:“//”表示Blender文件所在目录)
- You can also use FaceSelect and
VertexPaint (VKEY) simultaneously. Vertex painting then only works on the selected faces. This feature is especially useful to paint faces as if they don't share vertices. Note that the vertex colors are used to modulate the brightness or color of the applied image texture.
- 你也可以同时使用面选择和顶点绘图(VKEY)。则顶点绘图仅在选中面上工作。这个特性在绘制没有共享顶点的面时特别有用。注意顶点颜色用于调制被应用的图像纹理的明亮度或是颜色
LSCM Unwrap LSCM解包
LSCM means Least Squares Conforming Map. This is an advanced mathematical method to automatically create a UV-mapping while keeping texture stretch and deformation to a minimum. It works by preserving local angles. Just as any other existing UV unwrapping mode, it will unwrap the selected faces in UV Face Select Mode. It is available by either pressing the UKEY key, and then choosing LSCM, or by choosing LSCM Unwrap from the UV Calculation panel. LSCM是指最小平方一致性映射。在需要保持纹理的延展和缩小时,这是一种高级的自动创建UV映射的数学方法。它是通过保持一个本地角度来实现的。就像其它的UV解包模式一样,它也在UV面选择模式下解包选中面。激活方法是按住UKEY键的同时选择LSCM;或者直接从UV计算面板中选择LSCM Unwrap To be able to correctly unwrap a mesh with LSCM, you must make sure your mesh can be flattened without too much deformations (in mathematical term, it should be equivalent to a disc). This is done by defining seams, i.e. places where the mesh will be cut. You don't need to add seam if the mesh can be unwrapped directly in a plane. 为了能够正确地使用LSCM解包一个网格,你必须确保你的网格可以在没有很多变形的情况下被放大(用数学术语说就是equivalent to a disc)。这是通过定义缝来实现的,也就是网格将被切开的地方。如果网格可以在一个平面上被直接解包的话,你就不需要添加缝了 In Edit Mode, selected edges can be marked or cleared as seams, using CTRL-E. 在编辑模式下,使用CTRL-E可以将选中的边界标记为缝或是取消标记 Here you can see a cube with seams, and the resulting UV map after applying LSCM. 这里你可以看到一个有缝的立方体,和应用了LSCM之后的UV映射
Often a mesh cannot be unwrapped as only one group of faces, but must be cut up into multiple groups. If seams divide the selected faces into multiple face groups, then LSCM unwrapping will unwrap them separately, and position them in the UV Editor so the face groups don't overlap. To ease selection of face groups, Select Linked in UV Face Select Mode (press LKEY) will select all linked faces, if no seam divides them. This way, you can select a face group by selecting one face of the group, and executing Select Linked. 通常一个网格在进行解包时不能被仅仅看作是一组面的集合,而是应该被切分成多个组。如果缝将选中的面分隔为多面组,那么LSCM解包将分别将它们解包,别且在UV编辑器中为它们定位成不会相互覆盖。如果要释放面组的选中状态,UV面选择模式下如果没有缝分隔开它们,那么“选择链接”将会选中所有链接的面。这样,你就能通过选择一个组中的一个面而选中整个面组,并且执行“选择链接” To further tweak the result, UVs in the UV Editor can be pinned to a fixed position. If LSCM is executed, these UVs will stay in place, and the resulting UV map will adapt to the pinned UVs. In the UV Editor, selected UVs will be pinned or unpinned by pressing PKEY or ALT-P. Pressing EKEY in the UV Editor will launch LSCM unwrapping on the faces visible in the UV Editor. Pinned UVs are marked in red. 为了进一步调整结果,UV编辑模式在的UV可以被指定到一个固定位置。如果应用了LSCM,这些UV将保持不动,UV映射结果将会向这些钉住的UV调整。在UV编辑模式下,按PKEY键或是ALT-P,选中的UV将会被钉住或是起钉。在UV编辑模式下按EKEY将会出发UV编辑器中可见的面的LSCM解包。被钉住的显示为红色
Texture Paint 纹理绘图
Once you have loaded an image into the UV Editor, you can modify it using the Texture Paint mode. Use the Paint Tool option in the View menu, to modify paintbrush Size, Opacity, and Colour. Currently there is only a default brush to paint, but work is being done to provide more brushes. 一旦你将一幅图像加载入UV编辑器,你就能使用纹理绘图模式来修改它。使用视图菜单的绘图工具选项来修改画刷尺寸、透明度和颜色。当前只有一个缺省画刷,但是实际可以提供更多的画刷 All changes you make will be instantly reflected in the 3D View if the model is in potato mode. However the modified texture will not be saved until you explicitly do so. Use the Save Image option in the Image menu to save your work with a different name or overwriting the original image. 如果处于马铃薯模式,你做的所有修改将会立刻在三维视图中反映出来。然而修改后的纹理直到你明确指令之前是不会保存的。使用图像菜单的保存图像选项将你之前的工作用另外的名字保存,或者直接覆盖原有图像
Notice that the Draw Shadow Mesh option becomes very helpful to keep a reference of the UV map while texture painting. 注意在纹理绘制期间,为了保持UV映射引用,绘制阴影网格模式是很有用的
Rendering and UV coordinates 渲染和UV坐标
Even without an Image assigned to faces, you can render textures utilizing the UV coordinates. For this, use the green UV button in the MaterialButtons (F5) menu. 即使面上没有应用一幅图像,你也能够使用UV坐标渲染纹理。为此请使用材料按钮组(F5)中的绿色UV按钮 If you want to render the assigned Image texture as well, you will have to press the TexFace button in the MaterialButtons. Combine this with the VertexCol option to use vertex colors as well. 如果你还想渲染被应用的图像纹理,你必须按下材料按钮组中的纹理面按钮。将其和顶点颜色选项组合还可以使用顶点颜色
|










