In the previous movie, we showed you how to apply a UV map to a relatively simple pistol mesh.
In this movie, we’ll show you how to map a comparatively more complex rifle mesh.
Start by setting your current project to the provided scene folder,
then open the file “02-UVToolkit_rifle_start.ma” or use your own file.
Unlike the pistol, which was just a single mesh,
the rifle is made up of multiple meshes that need to be mapped individually.
To change things up a bit from last time though, let’s try assigning an image file for reference first.
In the Viewport, select all the parts of the rifle and assign a new Blinn to it.
Use its Color field to assign the M4.jpg image file.
Now if you select any part of the rifle,
you can see that they all appear on top of the same image in the UV Editor,
even though their UVs are unusable at the moment.
You’ll find it helpful to dim the image by going to Image > Dim,
or by clicking this button in the Panel Toolbar.
You can even adjust the amount of diming using this slider.
The rifle body is a good review of the practices we learned in part 1.
Start by planar projecting the rifle’s body in the Z axis, then scale and rotate the resulting UV shell.
Since we applied the material first this time, we also now have a reference for where to put it.
You can activate UV selection mode
to make more nuanced adjustments to certain areas.
For the adjacent sides,
you can select a face and then double-click an adjacent face to select the entire face loop.
Don’t forget to get this area inside the handle as well.
Then project a mapping in Y just like the pistol.
Unlike the pistol, we don’t have a specific texture for the front, top, bottom, or back,
so just scale and move the shells into this generic grey metal area.
Then use the Back-Facing Selection Constraint to create a new UV Shell for the right side,
just like you did in part 1.
With the body complete, let’s move on to the clip and handle.
The process for both of these is largely the same as what you’ve already done,
so start with a planar projection for both in Z.
However, you may notice that the texture we’re using
only has a right-side image of the clip and left- side of the handle.
This is because, unlike the asymmetrical body of the rifle,
both the clip and handle are identical on both sides.
Therefore, we can use the same image for the left and right sides of the mesh
just by overlapping the shells.
However, what will cause an issue is the fact that this clip
doesn’t line up perfectly with the clip in the image.
First of all, it’s upside-down,
so use the Transform > Flip button to flip the UVs around in V.
However even then it’s a bit misshapen.
To fix this, select all the UVs on the clip, then go to Transform > Tools > Lattice.
The Lattice Tool allows you to move UVs along a gradient, which in turn reduces image distortion.
Once the clip UVs fit in the 2D view,
feel free to re-project the front and back faces to place them in our generic “metal” area.
Make the same adjustments for the handle.
However, for these two faces on the back side of the handle, let’s try a neat little trick.
Project them as they’re own Planar UV mesh in Y.
Now move and scale them so they overlap the handle like this.
Now if you look in the Viewport,
you can see that the back of the handle has the same rough grippy texture as the sides,
without having to create additional texture maps.
Tricks like this can save you valuable UV space.
Next let’s map the barrel, scope, hand grip, and laser.
These are all cylinders, which will use this cylinder space in the middle of the texture.
Because they’re cylinders, we’ll also create a Cylindrical mapping instead of a planar one.
This will spread the texture evenly around the cylinder objects.
Scale and translate each one separately.
Notice that because the grip is oriented differently from the others,
the cylinder is mapping the wrong way.
Fix this by clicking this handle to bring up the universal manipulator,
then clicking the rotate handle to bring up the Rotate manipulators.
Then just rotate the cylinder so it’s oriented in the same direction.
For the scope and laser sights,
you’ll also want to select the lenses by selecting one UV at the center
and then converting that selection to faces by Ctrl + clicking the Face filter in the UV Toolkit
to convert that selection to adjacent faces.
You can quickly move between various component types this way.
Now project these faces in Y, then translate and scale them onto the laser dot in the image.
Repeat for the scope lenses.
Note that you can quickly stack the front and back lenses on top of each other
by selecting both shells and clicking Arrange and Layout > Stack Shells.
This is especially useful when multiple shells use the same part of the texture map.
This just leaves three more parts: the hand guard, sight, and stock.
Like the body, we’ll start all these with planar projections in Z.
But why are we using a planar map for the hand guard if it’s also cylindrical?
This is because the image provided by the texture needs to be printed on both sides.
Unfortunately, the planar projection will result in these unsightly distortions
at the top and bottom of the guard.
Thankfully, we can get rid of them using the same technique we did for the handle,
by projecting UVs in X and then overlapping the meshes.
Use the Viewport to line up the ridges.
You’ll also want to separate out the smaller slip ring since it has its own image.
For the front and back faces, you can just use the generic metal image.
Same for the entire sight.
At first glance, the stock may seem equally simple too.
But, if you try selecting it in UV Shell mode,
you’ll notice that it’s actually made up of a number of disconnected shells.
This is actually a good thing, since it gives us a bit more control over shell placement.
First, select all the shells and go to Arrange and Layout > Unstack Shells
to get a better sense of what we’re working with.
Now select these primary parts and lay them onto the stock portion of the texture.
Then select the adjustment rod here and place it on the metal tube we used for the barrel.
For the remaining parts, stack them back together and lay them on the generic metal section.
You can even recast these dividers in Y so the pattern fits better.
And that’s it. Your work on the rifle is complete.
In the final part of this series, we’ll show you how to use an unwrap workflow
to create UVs for our character model.