Intro to Blender UV Mapping

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Before we jump directly into UV mapping some 3d objects let's talk a minute about what is UV mapping and why do we need it at its core UV mapping is the process of creating a 2-dimensional image of our three-dimensional object it's like if you took a cereal box and strategically cut a couple of corners so that you could open up the box and lay it out flat on your kitchen counter then once it's flat you could paint on it draw on it paste on some photographs or images to it and then when you're all done you could pick it up and assemble it back to a 3d object to a box and tape up the corners so it all holds together again and that's kind of what we're doing with UV mapping we're taking a 3d object we're deciding where to cut it we're laying it out flat so that we can then apply two-dimensional images now when you first open up blender you have a cube here and it actually has a UV map on it if I come over here to the UV editing tab you can see that when we click on that the cube switches to edit mode and you can see over here this is the UV editor there's a flat representation of the cube here in this view and as it turns out every 3d object every primitive mesh object here in blender that you can create has a UV map attached to it or already created so the purpose of this is to be able to export this say to creat ax or or Photoshop and be able to paint or draw on it we could add images or textures here in blender and whatever we put on this UV map here is going to appear on the faces here on this cube so okay you may ask why don't we just use this UV map why do we need to create our own well the problem is is that this UV map is just for this particular shape let's say we hit the 3 key to go to face mode and then clicked on this face here and hit E and extruded now let's hit the a key and select everything again even though the object has changed we now have more faces edges vertices our UV map over here hasn't changed at all so just because we change the object doesn't mean the UV map changes so let's try this again I'm going to tab back into object mode and hit the X key and delete this and I'm gonna press a shift a and go to mesh cube and here we have a new cube I'll tab back into edit mode and here we are back at that same UV map so we can't just use the UV maps that come with the objects once we begin to change them extrude scale add geometry to it then we need to go back and UV map it so that it reflects the object the way it is but how did they get this UV map what process did they go through to create this well first of all what we can do is come over here to this UV maps area here under our object data panel and this UV map layer holds all of these UVs and we could come over here and just hit the remove UV map button and delete those now our object has no UV map associated with it all right so what can we do just from this here if we press the U key on the keyboard we get the UV mapping menu and right up top we've got unwrapped let's give that a try I'll click that and this is what we get and what it's done is it's taken each one of these faces and put them just one right on top of the other up here we can switch between UV edge and face select mode so if I just select UV and I click on one of these let's say and I hit G you can see I can move this out and keep moving and keep moving and we can begin spreading these out and you can see how each face has been laid one over the other and that's not really what we want because when we put a texture on one face it will appear on all of them so let's try something else what I'll do is I'll hit the two key and I'll hit alt a to deselect and if we select a few edges I'll say select this edge this and this what we can do is we can add a seam we can say to blender these selected edges should be seams or should be the edges we want to cut just like that cereal box so that we can open up the object and lay it flat so we've selected these three edges now what we can do is press ctrl e and that brings up the edges menu and in this menu we've got mark seam if I click this you can see those selected edges now highlight kind of a reddish orange so now let's hit the a key and select everything and then let's hit you again and click that unwrapped oK we've got a little bit different thing now there's still some issues here this doesn't look quite right but it appears that we're being able to lay at least this part of the cube out flat the way we want if I come over here and select this face right here you can see that's the one there if I then press control I and invert the selection all of these faces now are still being represented by this one object or this one shape so what we can do is we could go back to edge mode and we could begin selecting a few more edges what if we selected this edge and this edge and well let's try this one and this one down here so we've kind of created edges all the way around here I'll press ctrl e and mark seam you can see the seams there now all right so let's hit a press U and unwrap now we're getting something a little closer to what we were after all of the phases now have been laid out flat in a non-overlapping pattern but how do we get that T shape that we saw before with that other UV map well we could take maybe one of these edges and we could remove this seam and move it somewhere else maybe let's press ctrl e clear the seam here now you can see we don't have a seam there and maybe we could put a seam here let's try this ctrl E and mark seam now let's press the a key to select everything over here even though our seams have changed the map still stays the same because we haven't unwrapped it again so now let's press U and unwrap again and there we go now we can see we've got that T pattern the way we had from the default cube but it's still not quite right I'd like to turn it 90 degrees so what let's do is over here in the UV editor let's press the a key and then let's just turn it by pressing R and typing in nine zero well that didn't quite work now did it I'll hit the Escape key so let's try this let's try our negative nine zero and there we go now we can press the G key and just move it up into place and we have a UV map very similar to the one we had from the default cube so that right there is generally how we're going to create our UV maps we're going to try and figure out where we can cut the 3d object using our seams tool and we may have to do a little bit of experimentation try putting a seam here no that didn't work and try again on another edge but ultimately what we need to do through our UV mapping is really two important things one we need to create the UV map so that we can avoid stretching and two we need to be able to hide our seams when they would be dis reacting or breakup our textures in a way that we don't want so we need to hide the seams and avoid stretching so what do I mean by avoiding stretching well to see we're gonna have to actually apply a texture and let's go ahead and work on that now I'm going to tab back into object mode and I'm going to come right up here to this corner of this window and click and drag to create a new window we have our UV editing window here but I want to change this one from a UV editor here to a shader editor here now that we have this I'm going to hit the N key to close that panel and here in this node editor we can actually apply our textures to our material for our object now one problem here is that if we go over to the materials panel we can see we don't have a material for this object yet if we click on the object we can see our material panel is blank we can click new here to create a new material we can also click new over here it's the same thing so I'm going to go ahead and click new over here so that when I do you can see what happens here we get this shader node here and a material output node here this shader node is reflected over here in the materials panel and if we scroll in here you can see these different sockets and we can attach different nodes to these various sockets we're going to use the base color here in this course probably the most but now that we've created this material let's go ahead and give it a new name we can do that over here or over here so we can call this well let's call this UV test pattern that's going to be the name of our material and now we want to actually put a texture on this object so that we can see if we have any stretching in our UV map to create a texture we can here in the UV editor create a new one by clicking new here and creating a new image so I'll click new and for this let's call this UV test texture and our size of 1024 by 1024 pixels is fine for now but down here for the generated type instead of blank which would just give us a black image let's click this and choose UV grid and what that's going to do is give us a black and white checker pattern so that we'll be able to see and he's stretching very easily on the object alright so I'll click OK and here it is I'm going to scroll out a bit here's our UV test texture that we're going to apply to our UV test pattern material so let's come over here in the node editor and press shift a let's go to texture and choose image texture here we go and in this node we want to add this texture well we've already created the texture so in this pulldown we can see it here and that's the same pulldown over here so we can just choose it from the pulldown here and then connect the color with the base color on the principle shader okay so now we should be able to see it but we can't yet what we really need to do is just slide over and click on the look dev display I'll click here and there's our texture so what do we have here well what's going on if I tab into edit mode again what's going on is we're actually laying this checkerboard texture over our flat UV map and when we're doing that each of these faces are getting a certain amount of the texture here so let me just make sure I'm in UV mode here and I'm going to select this UV and this UV right here let's now hit the G key and just drag this out and look at what happens as I drag this further and further away the checkered pattern gets more and more squished and if I hit the G key and move this in like this let's say I just move it way into here and we've only got say one two and a half rows of squares here in this particular face and you can see over here we've just got one two and a half year as well and let's say that this was a building and we were putting a brick texture on this and over on this side we had the brick textures the way they were supposed to look but over here they were stretched way too much this wouldn't be what we'd want out of our UV map we'd want something where the texture is fairly consistent across the whole object so even here it's a little bit squished if I pulled this back a little bit like this there we go so now we've got a more consistent texture throughout the object and that's what we're trying to do we're trying to avoid this kind of stretching that we see here so that our textures are applied more realistically or the way we want them to be in addition to making sure we don't have our textures stretched when were UV mapping we also want to make sure we hide any unsightly seams from the viewer a visible seam can sometimes give us a drastic break in the texture and be very distracting for the viewer well we don't have to go too far to see a visible seam here if we tab back into object mode you can see that right here on this edge we've got our texture up here with pretty much square black and white checkers and then these here are squished and right along this edge you can see that visible seam whereas if you look here these two faces right here have a continuous part of the texture that doesn't break it's all the same size it flows over the edge seamlessly let's go back and take a look at our UV map real quick and see where that is so if I hit the two key to go to edge mode and select this edge now we can't see it currently but if we come over here right here to these two arrows we can keep UV and edit mode in sync so if I click this now we can always see the UVs even if things over here aren't selected and we can see where that edge that we've selected here is right there so with this edge it's a smooth transition between one face and another on the texture with this edge over here of course you can see these two selected here in the UV map are the same edge here but of course these two are wildly different that's causing the difference in the texture from one face to the other so this is the kind of thing we need to avoid we need to avoid stretching and we need to avoid visible seams when become distracting now if we tumble around over here this seam over here may not be as distracting depending on the object we're dealing with you can see here that this top part here and the and the side here are the same size the top here and the side but they're off just a bit you can see this square doesn't quite line up with this square and depending on the texture that may be okay maybe it's a stucco wall or an evenly painted piece of machinery something like that that this break in the texture wouldn't be that visible so you have to consider what kind of texture is going to be going on the object to get a sense of whether or not a seam would work there so what let's do is kind of put this all together at least what we've talked about so far and try and use that cereal box image that we had earlier to apply it to this object will create a cereal box and see if we can apply those images that label design to our object here so what let's do is let's go ahead and tab back into object mode and I just want to change the shape of this so I'm gonna press s and Y and scale this in just a bit and then maybe I'll press s and Z and scale this up just a bit so we kind of get a cereal box kind of shape here I'll go to the move tool and move it up so it's just kind of sitting on the grid and notice how as I've changed the shape of the object the texture has stretched on it and that's because if you recall the UVs didn't change they're still like this even though I changed the scale the proportions of the object the UVs are still the same so of course as you may have guessed we're going to need to Ryu vs now we can just go ahead and select everything and press U and unwrap and there we go but take a look at this we've got some pretty serious stretching here and up on the top and the bottom but our uv-map is still pretty even over here it looks about the same so how do we fix this well the problem is is our scale and if we hit the end key to open up this panel here and we need to tab back into object mode we can look at our scale here and we can see that it's non-uniform if we created a new object let me just press shift a and create another cube and let me just move this to the side here you can see that this cube when its first created has a scale of 1 1 and 1 in the XY and Z and that's a uniform scale and when we uv-map an object blender is looking at the object's scale to try and help it layout the UV map I'm gonna hit X and delete that here so what we really need to do is now that we have our object in the shape that we want it we need to apply the scale to get it back to a uniform state and to do that all we really have to do is just press ctrl-a and we can apply our transformations then we can apply all the transformations just rotation and scale the rotation but all we really need is just scale so let's just click that and take a look at this now we've got all ones all right so now if we tab back into edit mode and hit the U key and unwrap now look at what happens the squares on our object are all square again right and that's what we want that's good and look at our UV map it's now been reorganized to better represent our object the way it is now and that's what we want that's good all right we're on our way to texturing this cereal box but now we need to talk about yet another issue and that is texture resolution how to try and use this zero to one space this square here as efficiently as possible to get as much of the texture within our UVs as we can currently the vast majority of this area of this square here has no UVs over it we're not using this texture space very efficiently let's first begin by taking a look at the texture we're going to be using if we take a look at this we can see that we've got a continuous texture from the front to one of the sides here and then we've got brakes it looks like they've actually cut it apart completely here and then we've got a continuous texture on the back to one of the sides as well so I think I like my seams the way I'm going to break apart the object to reflect this so that we can get a continuous texture over that edge all right let's go back to blender here I think well let's do first of all let's just clear all of our seams I'm going to hit the a key and press ctrl e and then choose clear seam here now as I'm working I kind of feel like the checker pattern over here is getting in my way it's hard for me to see the islands so I'm gonna go ahead and just hit the X here to remove that texture out of this view and that's all it does is just remove it out of the view it's still here attached to our material so we can see it in our 3d view okay so I know I want to maintain this face and this face together right since that's what our texture has so what I think I'll do is go into edge mode with two key and I'm just going to select these edges all the way around that area to a right to here and let's give this a seam ctrl e mark seams there we go and we can also do that back here as well we had the back and one of the sides as a continuous texture as well so let's go ahead and press control II and Mark seams here now let's see I think we've got seams all the way around the bottom seams all the way around the top so those will be broken out separately as individual UV Islands and then we've got the front and the side and the back and aside as all one UV island all right so let's give it a trial hit the AE key then I'll press you and unwrap and there we go so what I may do is just press the our key and then I'm gonna hold the control key down and you can see in the upper left corner of this screen of the UV editor screen you have the degrees of rotation and I'm just gonna hold the ctrl key down until I get to 90 degrees and click there we go now I can hit the G key and kind of move this in just a bit now we need to know if if these are arranged properly so I'm gonna hit the 2 key to go to the edge select again and if I select this edge right here look at what happened this edge is now turned on the bottom so I need to flip this around alright so let's go to face select and if I select this base and I believe this face here right yep there we go I can hit the R key and type in 180 and it'll spin it around so R 1 8 0 and enter now if I select this edge right up here yeah there it is there okay let's try the same thing over here I'm gonna hit the 3 key to go to face mode and this back here and this here it looks to me like these are in the proper place if I hit the 2 key and select this edge sure enough it's here on the top but these islands here are kind of in an awkward place they're kind of it seems that this edge should really match with this edge up here so what I could do is go back to face mode select this move it up it the R key and control and turn it 90 degrees and just maybe put it right up here like this just so it's in place and for the front if this is our edge down here yeah you can see that this edge and this edge kind of go together so I'm just gonna take this and move this over like this that's not strictly necessary but I just like to arrange things so I know what they are I'm gonna hit the a key and then I'm gonna hit the G key and I'm gonna move these into this is zero to one space at the S key and maybe scale it down just a bit so that I'm sure that everything is in this square and is in this gray square and you may wonder why do I call this the zero to one space that's an important thing to talk about so if I hit the end key I can open up this panel here we've got image tool and view and here in the view we've got something cursor location and currently it's here at the bottom left hand corner of this square and its location as if on a graph is at zero zero now if I type in say 1 and zero it moves over here if I type in 1 and 1 it moves up here if I type in zero in one it moves over here so this is really just a graph if I click on this button here I can click and move this cursor around and you can see the different coordinate locations for it as I do right over here so if I put this back to zero and zero it goes right back here so this is really just a coordinate space between zero and one so it's often called the zero to one space all right so we have broken up our 3d object into multiple flat planes and laid them out here in the UV editor the next thing we need to do is actually apply that image the image we saw here so how do we do that well what we're gonna need to do is actually go into a paint program I'm gonna use creative for this particular object but you can use or Photoshop or Corel Painter really just about any 2d paint program okay well we've managed to use our 0 to 1 space here our texture resolution a little bit more efficiently we've increased the size of our UV Islands to take up more of the space now what let's do is export this UV map out to crete a' so we can apply our textures to export this out i'm gonna hit the a key and select everything and then i'm going to go to the UVs menu here and go to export UV layout now i'll put this in my textures folder here and if we come down here the size we've got it currently at 1024 by 1024 and i happen to know that this particular image is only about 500 pixels big so why don't we take our resolution down to something like 512 by 512 just so we aren't having to scale up our image to fit the UVs and therefore cause some pixelization we've got the format here as P&G and we've got the fill opacity at 0.25 now we're using a PNG because it automatically comes with an alpha Channel so we'll have transparency we'll be able to see through it but the actual UV Islands will have an opacity of 0.25 so we'll be able to see through them but they'll be slightly more opaque all right let's give this a name let's call this cereal box you v's there we go and export all right so let's go over to credo and take a look at it I've gone ahead and opened up credo and then opened up our cereal box image here that we're going to use a couple of things that I've done here in the credo interface is I've gone to Windows and workspace and I'm using the default workspace here in addition in here I'll click in here and press shift S and that'll bring up the snap menu and I've turned off everything you might see image Center or image bounds checked it's just easier for what we're gonna do if we uncheck everything here all right let's bring in our UV map let's go to file open and here it is our cereal box UVs and I'll click open and there it is so you can see how that fill opacity at 0.25 gave us this kind of shaded view of the UVs over here in the layers panel I'll click on this and just type in UVs so we know what that is so now what we can do is come over here to the fruit loops tab here to our cereal box and if I click on the rectangular selection tool right here I can just click and drag a selection right here it looks like I got a little bit of the black in here I'm gonna press ctrl shift a to deselect you can also come up here to select and choose deselect here I'm gonna try that again I didn't get that quite right there we go that's a little bit better and I'm gonna go ahead and select all of this including that side panel as well right there all right let's press ctrl C and then let's go back to the UVs and let's press ctrl V and there it is alright so now we need to fit it into this panel right over here remember this is the front so I'm gonna come over and turn on the transform tool right here and I'm also going to take this layer and drag it down underneath the UVs so we're seeing that image underneath the UV area here with that layer selected I'm going to click on it to turn on that tool and I'll just move this over here like this kind of covering up those black lines and I'll click here and drag down and try and stretch it down just a little bit like this there we go all right let's do that again I'll come over here to the cereal box image I'll press control-shift a to deselect I'll grab the back of the box right here and that side right there press control-c go to my you've ease ctrl V to paste make sure I'm in my transform tool over here click on it now let's move it over here into place and I'll just grab this corner and kind of stretch it down just a bit kind of like that there we go Center it looks like I've got it a little bit too low down here I'm gonna pull it back just a little bit like this and hit enter again all right now let's work on the tops here maybe I'll go back over here and I'll press control-shift a again to deselect and for the top let's um let's grab this area right up here right there let's say there we go control C control-v and i'll just drag this over this will be the top of the box like this and I'm just gonna grab the corner and stretch it out to fit the UV island and then over here control-shift a and let's grab this down here on the bottom like this right here alright ctrl-c ctrl-v [Music] click and let's drag it over here wretched out to fit the UVs we go I'll hit enter I'll come over here and hide the UVs lair we don't want to export that out again that was just a template just a guide to tell us where to put the images so I'll just hide that layer right here and now there's our UV map one more thing I usually do in something like this is I add a black background so I'm going to come over here and create a new layer just click here and I'll drag this down to the bottom let's call this background there we go and let's come over here to the fill tool I'll click that and in the color selector over here I'll just click and drag all the way up to black now I can come over here and click in an open area and it'll fill that with black all right I think we're ready let's export this out and see how it looks in blender I'll go to file export and let's call this cereal box let's call this Co L for colormap and save I'll click okay there we go let's go back to blender now here in blender all we really need to do is just replace this test texture our UV test pattern with the actual image that we want to bring in so I'll go ahead and just click the X here and get rid of that and then let's click open browse to our textures folder and here is that cereal box Co L buy click on this icon here we can see it let's select it click open and there it is there is our cereal box I'll tab back into object mode and yeah that's looking pretty good so you can see what I've done here I've just ensured that this corner here has that continuous texture on it and I've ensured that this corner here has that continuous texture the seams here where it isn't continuous isn't too bad because the images or the texture has a natural break there but you can see from this example how you can keep in mind what textures need to be continuous and what can be broken up by seams as well as making sure that your UV map uses the zero to one space fairly efficiently you
Info
Channel: Darrin Lile
Views: 132,889
Rating: 4.9433055 out of 5
Keywords: video game, blender, 3d, animation, character, tutorial, unity, substance painter
Id: GTd8NBg8EZU
Channel Id: undefined
Length: 35min 40sec (2140 seconds)
Published: Mon May 18 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.