Texture positioning - UV mapping

From TOI-Pedia
(Redirected from Texturing using UV mapping)


For an overview of texturing methods visit Texture positioning - Overview.

Introduction

Texturemapping1.jpg

With UV Mapping you manually choose a projection type of the texture on your object. It is kind of a combination of normal mapping and projection mapping. You use projections to determine how the texture will be placed on your object, but in contrast to projection mapping this methode is more a per object mapping.

The computer doesn't automatically know where a texture has to be projected on an object and how large the texture has to be projected on the object. Texture mapping is comparable with the projection of an image by a beamer on a wall. The image is the texture, the wall is the object and the beamer is in this case the projector. The projector defines the location and size of the texture on an object and the computer will automatically tile the texture to completely cover the surface.

When an object gets assigned a shader that has one or more textures attached to it, the size and location of the projection has to be defined. The size of the projection depends on the size which the texture represents.

Texturemapping2.jpg

For instance: If we have a photograph of a brick wall with 10 by 10 bricks we can calculate the actual size. Depending on the type of brick the texture represents 2.1 x 0.65 meters as the size of one brick is about 210 x 65 mm.

Keep in mind that the right size of texture is crucial for the correct perception of size of the object.

For more information on using textures for your shaders, refer to Shading networks.

Once you've created the material with the texture we have to assign it to the geometry and adjust it so the texture will have the right scale and placement. We can do this through a mapping.


UV Mapping

Image UVMappings.jpg

UV mapping works as follows: When you have an object you want to texture, lets say for example a cylinder, you can Map the UV's of this cylinder with projection mappings. There are 4 different mapping methods. These are Planar, Cylindrical, Spherical and Automatic mapping. These mapping methods unfold the UV's of your object in a particular way characteristic to each mapping methode.

Image Manipulator tool.jpg
  • When you Apply your planar mapping, a mapping will be made of your objects UV's from one direction. A "manipulator tool" will be displayed which shows the boundries of your mapping. This manipultor tool can be used to place your texture on your object. You can scale the tool by dragging the colored red, green and blue boxes on its corners. By pressing the red(or yellow) orthogonal lines (situated in one of the corners) you can access the move and rotate options for your texture manipultor. The rotate option can be accessed by pressing on the blue circle around the move manipulator tool. The Manipulator tool looks different for the various mapping methods. in the image the manipultor tools for the planar and spherical mappings are shown.
  • The cylindrical mapping has the option to wrap the manipultor tool around an object in a cylindrical manner.
  • The spherical mapping has the option to do this in a spherical manner.
  • The automatic mapping can be usefull sometimes. As its name already reveals, this mapping methode mapps the UV's of your object automatically. In its option box you can select the amount of directions you want the mapping to map from. By default it projects form 6 directions. For a cube you could use 6 projection directions which will perfectly project on all the sides of the cube. For other types of objects other then cubes, or for more or less projection directions then 6, the tool can become quite tedious to acquire useful UV mappings.

When you have mapped your objects UV's you can view them in the UV texture editor, Windows » UV Editor or UV » UV Editor. In this editor you can make a snapshot of this UV layout by going to Polygons » UV Snapshot... in the UV texture editor window. This makes an image of your layout that you can color or texture in Photoshop.

Note! Mappings can also be done per face. This way you could combine it with normal mapping, if you only want to UV map some of the faces of an object and texture the rest with normal mapping. However this workflow can become quite intensive!

Loading the player...



Workflow

You normally undertake the following steps when using UV Mapping to texture an object.

  1. You create a new mia_material_x shader in the Hypershade.
  2. You assign a texture to one of the attributes of the material. Lets take the Color attribute from the Diffuse section for this example. You click the checkerbox behind the Color attribute.
  3. The Create Render Node window will open.
  4. Choose either a procedural 2D texture or a file texture node from the Create Render Node window. In this workflow we choose an image file texture.
  5. Assign an Image to your liking to the material.
  6. In your viewport select the object(s) you want to assign the texture to.
  7. RMB-hold on your shader in the Hypershade (do not deselect the objects) and move the mouse over to the Assign Material To Selection marking menu and release the mouse button. The material is now assigned to the object(s).
  8. Depending on how you want to map, choose either the object or the faces you want to map manually.
  9. Choose the mapping method you want to apply: Planar, Cylindrical, Spherical or Automatic. These can be found in the Modeling menu set under UV.
  10. Use the manipulator tool to position your texture in the right manner on your object.
Workflow with a lambert


Properties of UV Mappings

UV1.jpg
  • Primarily used for polygons
  • Projection cannot be shared with other objects
  • The polygon object can contain more than one projection by assigning projections to specific faces.
  • Good visual feedback in viewport, making it easy to lineup the textures on multiple objects
  • Limited forms of projections

The UV represents the XY size of the texture on the object. If this option is used a projector/projectors are assigned to a single object which has a material with a texture. The fact that the projector cannot be shared with other objects can make texturing of a lot of objects with the same material quite tedious.

For example: if a complete building, made of multiple objects, has to be texture mapped, every object has to contain its own UV texture coordinate system. This means that in the case of a brick building every object has to have a separate UV texture coordinate system which has to be aligned and scaled to make sure the sizes of the bricks are the same and that they align up correctly. However the viewport feedback of the texture is of high quality and can support the alignment and scaling of the UV texture coordinates.

The Polygon UV projection option supports different forms of projection.

UV2.jpg
Uv3.jpg
Planar projection
the projection is similar to a projection of a beamer, the image is projected as a square image on to the object. Works well for planar objects or slightly curved objects. If the object is to irregular, stretching will occur.
Cylindrical projection
The projection is wrapped in a cylindrical shape. Suitable for cylindrical shapes like columns.
Spherical projection
The projection is wrapped in a spherical shape. Suitable for more irregular spherical shapes.
Automatic mapping
Option for the more irregularly shaped objects. This option will assign a projection to each face depending on the angle of the face. Control is limited however. This option is often used in conjunction with the Texturing using the UV Texture Editor.


Modifying a UV mapping

If you've just created a mapping, you'll see the special mapping manipulator, which we use to move, scale and rotate the projection.

When you want to change a specific mapping later: select the object and click the mapping node (poly…Proj#) in the INPUTS section of the Channel Box. Select Show Manipulator Tool from the Toolbox or from the menu Modify » Manipulator Tools » Show Manipulator Tool.

We'll start with the scale.

Scale

Textures planar mapped scaled.jpg
Textures planar mapped projection size.jpg

You can grab any of the cubes at the edges of the manipulator to scale the projection. The result after a bit of scaling:

This allows manual scaling of the texture by eye. If you happen to know the size of the area of the original image, you can use that to get some precise scaling. In this example, the area covered by the image used for this texture is roughly 800 x 800 millimetres, so 0.8 x 0.8 units. We can enter these values in the Channel Box for the Projection width and height.

Rotation

Projection manipulator rotate1PR.jpg
Textures planar mapped rotated.jpg

If you need to rotate the texture projection, click the small axis in the corner of the Manipulator Tool:

  • Then click the blue circle:
  • The rotate gimbals appear:
  • You can now rotate your projection around every axis.

As this is not really what we want for this example, we'll undo it.

Position

Textures planar mapped alignedpr.jpg

Next you might need to align the projection. Especially near corners this can be very important. You can move the projection by clicking the center cube of the manipulator.If you add a projection for another face, once bot projections have been configured and aligned, the result may look something like this:

Personal tools
Actions
Navigation
Tools