[TUTORIAL] How do I UV mapped in Blender?

PsiweaponPsiweapon Posts: 49
edited November 2015 in Art and Sound
OH HAI GUISE :mrgreen:

Inside the spoiler tags, is a tutorial on UV mapping in Blender that I just wrote. The chance for doing this came from this post: http://forums.runicgames.com/viewtopic.php?f=47&t=57674&p=480856#p480856 where Phanjam asked for help on UV mapping.

I am no 3D or Blender expert by any stretch, but I know how to do this particular task, so I figured this was a good opportunity to both give back to the community and organize my own knowledge of the subject - teaching is always learning, to a varying degree.

The model used as example in the tutorial is by Phanjam.
Hello guys. This is Psiweapon's Blender UV mapping tutorial.

With UV unwrapping, what we're doing is telling the program (and the mesh) instructions on how to separate the polygons and put them on a bidimensional plane, so we can make a texture that "envelopes" the model.

It's like a paper model, but on reverse.

In a paper model, you have a picture in a bidimensional plane, cut it up, and fold it according to instructions to obtain a tridimensional model.

In UV maps, you have a tridimensional model, cut it up, and unfold it according to instructions to obtain a picture in a bidimensional plane.


I will be using Blender 2.68 for this task, if you are using a different version of blender, go figure and good luck, because blender has a tendency to GUI metamorphoses between versions, maybe it believes itself an insect.


INTERFACE BASICS:

This is the default blender start file, with its unfathomably charismatic default cube. Hello, default cube!

image_1.png

Go to ****, default cube. Select it with RMB, hit DEL, then D or click on the little popup.

Now that the default cube has left us alone, I want you to right-click on the line that marks the division between the topbar menu and the 3D viewport:

image_3.png

Then click on "split area". A vertical line will appear in the 3D viewport, move it to more or less the center. This will divide the viewport in two, which is immensely useful for UV unwrapping. The result should be like this:

image_4.png

Having two 3D viewports isn't very useful, at least not for our purpose. We now have to repurpose the right viewport (you'll probably want to do it the opposite way if you're left-handed). Click on the small, graphical drop-down menu (well, moar liek drop-up but whatever) on the bottom left corner of the right viewport, and select "UV/Image Editor"

image_5.png

This is how the screeeeeeeen should look like now, more or less:

image_6.png

I know, I know, we aren't doing any UV anything yet, but please be patient. It's time now to import the mesh. I wonder, what surprises will rexor3.mesh hold in store? I haven't even checked it out yet.

While your mouse pointer is somewhere within the left viewport (3D view), hit the '3' button on your keypad. Please don't tell me you're working on a laptop not blessed with the holy presence of a keypad. If such is your circumstance, please keep silent and don't disturb us with your heretical shame.

Keypad use:
'3' -> side view
'1' -> front view
'7' -> top view
'0' -> camera view
'5' -> Switch between 3D and orthographic projection. Keep it pressed if you want to have a seizure.
Keypad arrows -> rotate
Ctrl + Keypad arrows -> pan
'9' -> ??? THE NINE BUTTON! IT DO NOTHING!

Mouse use:
RMB: Select
Click mouse wheel and drag: Rotate
Shift+click mouse wheel and drag: Pan
Ctrl+click mouse wheel and drag: Zoom

Okay, back on track: Hit 'File > Import > Torchlight OGRE (.mesh)' If this option doesn't appear, you don't have the TL2 OGRE .mesh import/export plugin, or you don't have it properly hooked into your copy of blender, and solving that problem falls outside the scope of this tutorial.

Haha, I always wanted to say that. I think the plugin comes with the TL2 tools and assets pack, if it doesn't, well, elevate a prayer to Saint Google so that your ignorance may be remedied.

image_7.png

Look up the file you want to import, and hit enter once... or was it twice? Whatever. This is what your screen should look like after successful importationizing and zoominalization.

image_8.png

Okay, let's get down and dirty. Like when you perform *r*l s*x. Well, not that pleasant.

UV UNWRAPPING

If you have the imported item selected, which I think it's by default, it should have a colored outline. Hit TAB *while your mouse is in the left viewport* to switch to edit mode, your screen should look like this:

image_9.png

Now, to UV unwrapping: in the bottom bar menu of the left viewport, hit 'mesh > UV unwrap > unwrap'

image_10.png

...to get a completely useless mess of an UV map. No, I'm not a troll. Well yes, I am, but I'm not trolling you right now. This is just how you DON'T do it - a negative example:

image_11.png

First of all, all the polygons are all independent from each other. I guess this is because they were made in Sketchup - I knew there were going to be surprises. I seriously don't know how to proceed like this, so let's make them love each other once again. First, hit CTRL-Z repeatedly until that misshapen UV map, that defaces the faith in the Omnissiah is sent back into non-existence. Second, let's intone the Most Holy Litany of Duplicate Vertex Removal.

If the polygons aren't all separate, you don't need to recite this particular incantation:

image_12.png

For good measure, four of five buttons below "remove duplicates", change the shading from "smooth" to "flat".

Okay, after removing duplicates (some 500 vertices), if we hit "UV unwrap" we'd still get an unusable mess:

image_13.png

How do we get beyond this? Well, introducing four new concepts: Seams, projecting from view, partial unwrapping, and symmetry.

Q.: What are seams?
A.: Seams are edges along polygons that have been marked as "cut here" for the program.

Q.: What is projecting from view?
A.: Projecting from view is putting the polygonssssss in the UV map viewport with the exact same shape as they have in the 3D viewport.

Q.: What is partial unwrapping?
A.: Partial unwrapping simply means that you don't have to unwrap the entire model at once. You can unwrap the blade first, then the shaft, then the pommel, etc., making sure that everything looks good step by step.

Q.: What is symmetry?
A.: Well, moar liek symmetrical laziness. Simply put, if the two halves of a blade are identical, why would you texture them twice? You don't! You just make the faces overlap in the UV map and then paint the texture *just once*!

MARKING SEAMS:

You need to make sure to be in "edge selection mode":

image_14.png

And now, let's select the edges that should become the seams of the blade:

image_15.png

And mark them as seams with 'mesh > edges > mark as seam'

image_16.png

The result should be like this:

image_17.png

The edges we selected before are now shown (if deselected) in a red-and-black scheme apt to induce retinal hemorrhaging, and Blender will cut through them when unwrapping the model. I'm going to fast forward a bit and have all the seams marked in the next step, because otherwise this tutorial would become más largo que un día sin pan ;)

These are all the seams I think this particular model needs:

image_18.png
(I've marked all vertical edges that divide the weapon or its parts into two identical flat halves, and the horizontal surfaces are single pieces separate from everything else, this method will come in handy when we start to projecting things from view)

Now, onto projecting the faces to the UV map:

First, select ALL the faces in the flat of the blade, but not the "internal sides":

image_19.png

Now, make sure that you have "orthogonal projection" activated, and the 3D viewport is set as the side view:

image_20.png

Heh... I can see both flats of the blades don't line up perfectly... well, that's not a crime or anything. While keeping the selection I told you, hit 'mesh > UV Unwrap > Project from View' and this should be the result:

image_21.png

You can see that the UV vertices don't line up perfectly, but nearly so... to solve this, in the UV viewport, select everything and hit: 'UVs > Weld/Align > Remove Doubles UV'
NOTE: No, you can't see it because Photobucket's resolution is too low but BELIEVE ME IT IS AS I TELL YOU :(

image_22.png

Everything looks much neater now! Both sides, back and front, are there, they're just superimposed so we don't have to break any sweatdrops in excess of what's strictly necessary when we get to texturing. What would be awesome though, is for the left and right sides to be superimposed too, so we can show in four places a texture that we have painted only ONCE. Let's do that.

In the UV viewport, make sure you're in "island select mode" An "island" is a set of polygons in an UV map that is separate from the rest, as such, we now have two islands: left blade and right blade. Why they are two islands and not four is beyond me, I confess, but that's not going to stop us. Select the right blade:

image_23.png

Now we're going to make it align with its left-wing sister, har har har. With only the right blade selected, hit the 's' key (to enable Scaling), then the 'x' key to restrain the scaling to the 'x' axis, and while holding CTRL (so the scaling increments in discrete amounts rather than smoothly) move your mouse around until the right blade is inverted and has the exact same shape as the left blade:

image_24.png

Now we have to move it exactly on top of the left blade. With the right blade still selected, hit the 'g' key (to make the selection "go" somewhere else), then 'x' to restraing the movement to the 'x' axis, then very carefully place it on top of the left blade:

image_25.png

Now we should scale everything to be a bit bigger and move it out of the way:

image_26.png

Unwrapping the shaft:
First, let's select all the vertical shaft faces. Don't panic when the blades stop showing on the UV viewport, it's normal: they aren't displayed simply because they aren't selected in the 3D viewport:

image_27.png

And now, let's do the same trick than we did with the blade: making sure we're using orthogonal projection on the side view, let's 'mesh>UV unwrap > project from view' while we have the shaft selected. The blades are shown again because I selected them again in the 3D viewport afterwards:

image_28.png

The shaft is a bit skinny compared with the axe, so scale it with the 's' key and move it around with the 'g' key until it has a size and position that suits you. Do NOT press 'x' or 'y' after hitting 's' to scale the shaft, if you did that you'd end up distorting the texture on the shaft - it wouldn't be serious though. If you don't want to paint the texture for the different sections of the shaft, just make them overlap as needed, like I did with the blades. I'm not doing that now, though:

image_29.png

Unwrapping the metal rings and sleeves:
You should know the drill already. Select all the vertical faces, switch to side view and orthogonal projection, project from view. The result should be more or less like this:

image_30.png

Finishing touches - Ends of the shaft, horizontal faces of metal rings and sleeves, inner faces of the blade.

Ends of the shaft: Same as we have done before, except projecting from the top view ('7' on the holy keypad) instead of side view.

Horizontal faces of metal rings and sleeves: Same as above, and project from view both the top and bottom of each ring at once so they overlap without additional work. As long as they're all going to be metal, you might as well make them ALL overlap and save yourself some work.

image_31.png

Inner faces of the blade: These are tricky. I first unwrapped the inner lower sides of both blades, resized, rotated, moved and straightened them manually, then made them both to overlap; then I repeated the same operations with the inner upper sides of both blades. Why not make them all overlap? Because the upper inner sides of the blades should have a lighter texture than the lower inner sides. The middle section of the inner sides of the blades were projected from view using the Most Holy Frontal View ('1' on the keypad)

image_32.png


Okay, now we have a complete UV map! But it's not applying anything! If we want to use our UV map to wrap a texture around our model, we need to give a couple of simple instructions to our model. First of all we have to create a material:

image_33.png

You should call your material something befitting and easy to remember, like "Koosalagoopagoo_Wing_Wong_Chowzor", I called it "Rexor_Axe_Psiweapon_Tutorial_Mat", "nameoftheobject_material" is usually a good idea. Make it shadeless:

image_34.png

We now have to give this material a texture:

image_35.png

Again, you should name the texture something useful, like "Mr_Magoo's_Sophomore_Orgies_vol_II_electric_bogaloo". I named mine "Rexor_Axe_Psiweapon_Tutorial_UV_Texture". You must set the type to "movie or image" and the "coordinates" to "UV". Select the UV map, of which there should be only one.

image_36.png

The problem is that we don't have yet any image to plug into the UV map. Let's solve that temporarily by exporting the UV layout, this will create an image that very conveniently will also serve as a sketch for the future, well developed texture:

Oh ****. I just accidentally closed Blender. ****, screenshots are so confusing. I thought I was closing one of the screenshots in Gimp.
I better hit the save button in Notepad lest I cause any more damage. GO ME!

Okay, where was I... oh yeah, on the UV viewport, hit UVs > Export layout:

image_37.png

Now this should bring up an export dialog screen, the settings are in the bottom left. For now, I recommend .PNG format and a size of 256x256. Torchlight II textures must be square-shaped and a power of 2, usually they are 128x128, at least for weapons, but it accepts bigger textures. Remember that before importing the model into the game, the texture must be in .DDS format (direct draw surface), but for now, we don't need to convert it as Blender is perfectly happy with .PNG textures. I use the GIMP with a plugin to export textures to their definitive .DDS format.

image_38.png

This is what the exported layout should look like:

rexor3_UV_layout.png

Now let's assign this very exported layout as the texture, to see that everything works properly. In the same texture properties tab, or menu, or whatever it is, where you set the texture as "image or movie" and "UV coordinates", click on "open" and select the UV layout we just exported as a .PNG:

image_39.png

So, Blender is already loading that image as the texture of the model, but we aren't seeing it yet. In the 3D viewport, select "textured" in the "display method" dropdown, and in the UV viewport, select the texture image in the "image to be linked" dropdown. Drop-up, I mean. How the **** does anything drop upwards? Ah, the mysteries of Blender. You should now be seeing the UNGODLY UGLY exported UV layout correctly wrapped around the model, with the black lines following the edges:

image_40.png

The good news is that you can now save the file, close blender, and start drawing like crazy on top of that ugly .PNG (kids, remember to ALWAYS make backups), when you have already painted over some zone (for example, the shaft) you just have to fire up blender and load the file to see how it's looking.


...And with this, the tutorial is finished, since it's not meant to cover texturing, exporting to .mesh, or avoiding sweet and common pitfalls such as the normals trolling you no matter what, not setting the material settings in the .material file properly, or faling at alpha-enabled textures. You'll have to look for that wisdom elsewhere, O Seeker of Knowledge.

NOW **** OFF AND START MODDING LIKE CRAZY! :D
thanks for reading through this **** ^^

I hope that was useful :)

Comments

  • ZyphZyph Posts: 829
    This a great tutorial. My 16 yo son has spent months surfing the web for what is contained all in this tutorial. :D
    Join us at http://torchboard.org/forum/index.php to discuss the Far East Expansion!

    "Well, there can't be a final mod file, because everything keeps evolving." bran
  • PhanjamPhanjam Posts: 3,297 ✭✭✭
    :o o m g ...

    this is HUGE psiweapon! both literally and figuratively! As far as tuts go, this is one of the most impressive i've ever seen. i am in awe and i bow before you.

    Thanks so much for all the effort you put into this! you've done a great great service to the community (not to mention me!) :D
    Torchmodders
    Torchlight 1 Class Pack (TL1CP) Mod for TL2: Steam | RGF
  • If any one of you comes up with an improvement for the tutorial or think that any particular aspect of it needs clarification, please speak your mind and I'll try to improve it :geek:
  • PhanjamPhanjam Posts: 3,297 ✭✭✭
    Been going through this tutorial and I just had to say, that is one UGLY model I made :lol: :lol: :lol:
    Torchmodders
    Torchlight 1 Class Pack (TL1CP) Mod for TL2: Steam | RGF
  • ChewtoyChewtoy Posts: 185
    great tutorial, I like it, explains it really well.
    9pwcg9.jpg
    (YOUTUBE) N3KIO
    Potions of Chew Respec Sharedstash viewtopic.php?f=48&t=35925
    The Toy Collector (Mapworks Overhaul) viewtopic.php?f=48&t=54724
  • PhanjamPhanjam Posts: 3,297 ✭✭✭
    Hi Psiweapon! In case you still come by around these parts, just letting you know I transcribed this here tut of yours on to the Torchmodders wiki ;) hope that's okay!
    Torchmodders
    Torchlight 1 Class Pack (TL1CP) Mod for TL2: Steam | RGF
Sign In or Register to comment.