Materials and Mapping Tutorials > Spline Mapping >
Fine-Tune the Mapping

With the introduction of the spline as a guide, now the brick material can properly follow the contours of the arch object. However, in the present state of mapping, the bricks are too large and they are mapped vertically up the arch columns instead of horizontally across them. In this lesson, you use the Edit UVWs dialog to adjust the mapping visually so that the bricks map properly.

Set up the lesson:

1. Continue from the previous lesson or open splinemap_unwrapuvw.max.
2. If you open the new file, select the Arch-Door object, go to the Modify panel, and on the modifier stack, go to the Unwrap UVW modifier Face sub-object level. Make sure all faces of the arch are selected except for the two faces at the bottom of the arch.

Set up the Edit UVWs dialog, and inspect the brick map:

1. On the Edit UVs rollout, click Open UV Editor.

   3ds Max Design opens the Edit UVWs dialog.

   Arch object displayed as grid of UVW faces and vertices

   The window in the Edit UVWs dialog shows a flattened representation of the arch object. There are four red vertical panels made up of UVW faces and vertices. The panels represent the inner, outer, left, and right face of the arch.

2. Click (Maximize Viewport Toggle) (or press Alt+W) to see all four viewports.
3. Move the Edit UVWs window so you can see the arch object in the Orthographic and Perspective viewports. If you need to, adjust the size of the Edit UVWs dialog so you can see all of the arch faces. Use the Edit UVWs window zoom tool to zoom out slightly.

   The surface of the arch object is currently mapped to a single tile of the brick-soldier material.

   The square occupied by the flattened arch object corresponds to the dark square in the next diagram, which shows the coordinate system of the Edit UVWs window.

   The texture you apply to the arch object will be mapped to this area, whose coordinate system ranges from 0, 0 to 1, 1.

4. On the main menu, choose Rendering View Image File, and on the View File dialog, navigate to the folder \sceneassets\images\, click to highlight brick_soldier-diff.jpg and click Open.

   3ds Max Design opens an image file viewer, showing that brick-soldier-diff.jpg is a square image. At present, it is mapped on a one-to-one basis using UVW coordinates that range from 0 to 1.

5. Close the image file viewer.
6. In the Edit UVWs window, open the texture drop-down list at the right of the main toolbar, and choose the entry for “Map #11 (Brick_soldier-diff.jpg)” to display the map itself in the window. (The map number might vary.)

Correct the vertical distortion:

1. On the second lower toolbar, click (Display Only Selected Faces) to turn it on.
2. On the first lower toolbar, the Sub-Object Selection toolbar, click (Vertex) to make the Vertex sub-object mode active.

   By switching to the Vertex sub-object mode, you can see how the Unwrap UVW modifier has slightly warped the contours of the arch object. You need to straighten out these contours.

   NoteThe contours in your unwrapped arch object might be slightly different to the one shown in the next illustration, depending on how you resized the cage gizmo in the previous lesson.

   Warped contours of the unwrapped arch object

3. On the Unwrap UVWs dialog main toolbar, click (Move Selected Subobject), then region-select all the vertices of the left outside edge.

   UVW vertices of left outside edge selected

   For these vertices to be properly aligned with the image map, they must all have the same U value of zero.

4. On the second lower toolbar, the Transform/Display toolbar, right-click the U coordinate spinner arrows.

   This sets the the horizontal map coordinate for each selected vertex a U value of 0, aligning all the vertices vertically at their origin (0), as shown in the next diagram.

5. Region-select all the vertices at the right outside edge of the arch object.
6. In the U coordinate field, type 1.0, then press Enter.

   This aligns each selected vertex vertically at a horizontal value of 1.

7. Select in turn, from left to right, the remaining columns of vertices for each inside edge. Give each inner edge a U value of 0.25, 0.5, and 0.75 respectively.

   UVW vertices after alignment

   The UVW map now covers the surface of the arch object much better. But as you can see in the window, there remains an obvious problem. The bricks are mapped vertically, whereas they need to be mapped horizontally. You need to rotate the mapping by 90 degrees.

Correct the orientation of the bricks:

1. Press Ctrl+A to select all the vertices.
2. On the Edit UVWs dialog main toolbar, click (Freeform Mode) to activate it.
3. Position your cursor over a vertex at the midpoint of any side, and rotate the whole UVW grid counterclockwise until the rotation indicator displays 90.

   UVW grid after rotation

   Now the bricks on the arch are oriented horizontally. Notice, however, that the bricks are still too large for the area they cover.

   Arch object with bricks oriented horizontally

   You need to resize the UVW grid over the map so that the bricks are better distributed.

Align the edges of the bricks and the arch:

Specifically, the current vertical scaling of the bricks means that the edges of bricks are not aligned with the edges of the arch: The UVW grid spans five bricks, when it should span only four.

Edges of bricks not aligned with the vertical edges of the arch

1. Hold down the Shift key to constrain scaling to a single axis, then click on the left or right corner of the UVW grid and drag down until the grid is resized vertically (along the V axis) to fit over four rows of bricks.

   UVW grid resized vertically to cover four rows of bricks, one row per face

   Now the edges of the bricks and the edges of the arch line up.

   Along the U axis, the bricks are still too large.

Increase the number of bricks along the length of the arch:

1. On the Edit UVWs dialog main toolbar, click the options button toward the right of the toolbar.
2. In the Unwrap Options dialog Display Preferences group, change the value of Tiles to 2, then click to turn on Tile Bitmap.

   Click OK to close the Options dialog.

   Now the brick-soldier-diff.jpg is tiled twice in each direction.

   NoteThe Tiling value affects the display of the map in the Edit UVWs window. It does not affect the mapping of the object, which is managed by the Bitmap controls. When Tiling=0, the map appears only in the unit square; when Tiling=1 (the default), the map is tiled 3 times in both U and V; when Tiling=2 (as you just set it), the map is tiled 5 times in both U and V.
3. Zoom out and pan so you can see all of the brick-soldier-diff.jpg tiles.

   Two image tiles surround the UVW grid in every direction

4. Region zoom in so you can clearly see the UVW grid and the right edge of the bricks map.
5. On the Edit UVWs dialog main toolbar, turn on (Freeform Mode). Make sure all the vertices are still selected, then Shift+drag the top-right corner vertex all the way to the right-most edge of the map.

   Shift+drag the top right corner of the UVW grid to resize it horizontally

   Because the UVW guides have been stretched horizontally to cover three map tiles (from 0 to 3 along the U axis), now three times as many bricks are mapped along the length of the arch.

Correct the bulging appearance of bricks at the top of the arch:

If you look closely at the top of the arch, you can see that the bricks appear to bulge out.

Bricks in arch show deformation

This deformation is because the number of divisions in the arch object’s polygon mesh does not match the number of bricks mapped onto them.

1. On the Edit UVWs dialog, click (Zoom Extents) to zoom in to the UVW guides, then activate (Freeform Mode) again and select only those vertices in the center that correspond to the top of the arch.

   UVW grid with arch vertices selected

   In the polygon mesh, there are 14 divisions that define the arch, but there are 16 bricks in the underlying map. You need to resize the UVW guides so that the mesh divisions match the number of bricks in the map.

2. With (Freeform Mode) still active, Shift+drag the top-left corner vertex of the selection to the right by one brick.
3. Shift+drag the top-right corner vertex of the selection to the left by one brick.

   The number of arch polygons now matches the number of bricks in the map.

   Bricks at the top of the arch no longer appear to bulge.

Correct the scaling of bricks in the column:

If you look at the whole archway, you can see that the fix you just made to the top of the arch, makes the bricks at the top appear larger than the bricks in the two columns.

Arch bricks are larger than the column bricks.

1. In the Edit UVWs window, select only the vertices that correspond to the left-hand column of the arch (which is on the right in the Edit UVWs window and the viewport).

   Left column vertices

2. Shift+drag the top-right corner vertex of the selection to the left by two bricks.

   Left column after being resized two bricks to the left

3. Repeat the previous two steps for the arch object’s right-hand column, dragging the UVW guides to the right by two bricks.

   All bricks mapped to the arch object, both on the columns and the arch, now appear to be equal in size. The result is a properly mapped archway, with the bitmap convincingly following the contours of the object’s geometry.

   Arch object with bricks of equal size

Render the arch:

1. Close the Edit UVWs dialog and on the modifier stack, click Vertex to exit the Vertex sub-object level, then click any empty part of the viewport to deselect the arch.
2. Minimize the Orthographic viewport.
3. Right-click the Camera01 viewport and from the quad menu, choose Unhide All.
4. On the main toolbar, click (Render Production) to render your work.

   Rendered view of brick material mapped to the pawnshop entrance

   Now your brick material is mapped to the archway properly.

Save your work:

- Save the scene as my_arch_spline_mapping_completed.max.

Summary

In this tutorial, you learned how to use the Unwrap UVW modifier combined with a spline object to map a material onto a curved object. You also learned how to manipulate the object’s UVW lattice in the Edit UVWs dialog to specify how the material’s bitmap image is projected onto the target surface.