What is Texture Padding and How to Master it

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey this is Malcolm 341 in this video we're gonna look at how mapping works and the best settings to use for texture padding in the UV editor correct extra padding is a must for any good UV pack so let's get into it okay so what are mitt maps and how do they relate to texture padding in the UV editor MIT maps are a sequence of images contained within a texture each of which is a progressively lower resolution representation of the same image this is what MIT maps look like the height and width of each image in the MIT map is a power of two and is smaller than the previous image in the sequence the name MIT is an acronym of the Latin phrase multum in parvo meaning much in little I guess the programmer that invented this thought it was appropriate because multiple images are packed into one texture and then compressed to save disk space so yeah much and little makes sense latin so fancy MIT maps are used to increase rendering speed and reduce aliasing artifacts on textures far away from the camera or at oblique angles very confusing so let's look at what this all actually means ok so the best place to demonstrate this is actually in marmoset toolbag so basically what happens is I have my texture applied here and when you have MIT maps generated for the texture what's gonna happen is it is going to switch to the lower resolution texture at oblique angles or as the camera gets farther away from the object so as you can see here i zoom out and everything's great there's no aliasing happening with the texture and it looks normal and it's actually getting blurry ER as it gets farther away from the eye and this is to simulate how the real world works so basically in the real world when you look at something really far away it's not crisp and aliasing and all like dancing around and sparkling it gets blurry as things get farther away from your eye and so to simulate this in video games we use this technique called MIT mapping now watch what happens when I turn MIT mapping off so I'm just gonna go into this gear icon hearing you'd say use mitts off okay so everything looks fine up close but now if you watch the oblique angles here you'll see see how they start to shimmer and sparkle see here it's getting all sparkly when I move the camera like that that's because the resolution of the texture is too high to represent like how many pixels on screen and screen space it has and i watch when i zoom the camera out see everything's good but see as I get farther away you'll start to see a more a pattern everything starting to shimmer and look really crappy and then here look how bad this gets so really faraway objects are obviously the worst like see all that flickering and banding and aliasing and more-- that's happening there that's again because the texture is a 2k texture but it's only being displayed on-screen at like I don't know what that is 32 pixels or something like that and so it doesn't know what to do and so I just freaks out and creates all this crazy like flickering crap all over the screen and so obviously like that's not what you want to see and so the solution for that was to come up with the idea of loading smaller textures as the object blending between smaller textures as the object gets farther away from the camera and believe it or not when I first got into making 3d art for video games this was the norm so I started working on the PlayStation 2 and the PlayStation 2 wasn't powerful enough not only to render the shader correctly but it didn't have enough memory like memory was very scarce back then and so you couldn't store the extra scaled down textures to do the blending so this is actually what games would look like when I first started working in the industry and this was the norm you would just get farther away from objects and they would alias to and look terrible so we've come a long way in terms of graphics quality even since like like 2001 so you can see how important MIPS are so see all that sparkly here I'm just going to enable them use MIPS on and you can see there see it's already smooth though so off on off on leave that on and then when I move around nothing happens it's a nice smooth transition everything looks great magic modern game technology is the best you might not know it but probably every texture you've ever made has MIT mats in it most render engines will automatically generate MIT mats inside of your texture when you import it into programs like unreal or marmoset toolbag or unity or Maya or pretty much anything at this point this all happens behind the scenes for the most part so in the modern age of game making you don't really need to worry about that but you do need to understand them to set texture padding settings correctly in the UV editor if you want to look at what your textures look like with MIPS you can download this plugin for Photoshop and save your textures as DXT one I'll explain dxt compression in another video I'll put the link for the plugin in the description as well so if you check your file it with MIPS here let's just go to do a file save as of the texture let's put it wherever you want to choose after you've installed the plug-in the DDS format here it's gonna call this test so I can find it however ok and then it's going to pop open this window it's ancient window and you're just gonna want to do the top option for the sake of this and you want to say generate MIPS obviously ok and then save it ok and then I just have to close this and then I just need to go and open that file so into the rough textures here so I'm just going to drag it in and it's going to pop open this options box here and you want to upset probably off by default but you want to turn that on load nips and say ok and boom there you go so this is what your actual texture looks like in a game engine or in things like a render engine like marmoset toolbag or something like that you've got your basically your source image here 2 K by 2 K image and then it automatically goes in and scales down each one of these guys for you so in a power of 2 so basically I'm half each time so you get 2 K 1 K 5 12 - 5 6 128 so on and so forth all the way down here let me just zoom in all the way down to one pixel and that's how the whole system works to actually blur out your texture as you get farther away from it to fix all of those aliasing errors that we see when we turn mid mats off but like I said you don't really need to worry about MIT Maps anymore you just need to understand that your texture gets compressed and mitts are added to it when you import it into unreal for example okay so now that we understand mipmapping let's look at how it relates to texture padding so what texture padding means is the space between UV shells and how many pixels that is so for example in a 2048 by 2048 texture if I lay out you v's and set texture padding to 4 pixels each UV shell will be 4 pixels apart from the shell beside it the goal in texture padding is to have this smallest space between UV shells as possible the reason for that is if you add your shells too far apart you lose resolution in the texture I've seen terrible padding coming from some artists I've seen people use 32 pixels of padding to unwrap a prop on a 2k texture that is crazy you're throwing away so much resolution just in the padding before you even do a proper UV layout okay let's look at a quick shell padding example here just go to the UV editor and right hold click go to modify and then find layout and go into the options box here let's do a reset here and I'm just going to set the texture map size to 2k because that's what I have applied and then here you can control the shell padding and the tile padding what shell padding is is the distance between the UV shells and the tile padding is the distance from the edge of the texture basically the 0 to 1 UV space so let's say I put in 32 pixels whoops that's me 32 pixels of shell padding so watch what happens here so I've got my 32 pixels of shell padding that's great but as I reduce space there I'm actually losing resolution here so let's also put 32 into the edge stuff there okay so that might not seem too bad but here let's look at an extreme example let's go like like 500 and 500 just to get the point across here so see how I've added all the padding here and then all my texture looks like crap here so when you're working in the games industry texture resolution is gold like you're always trying to get the highest resolution possible and if you're patting things out 264 pixels or something or 32 pixels you're throwing a way a percentage of your texture just in the space between UV shells and then I'm just going to open up like another window here that'll make it really clear so let's go up into here and go to view and we're gonna go to the heads-up display and then we're going to go to the UV statistics you want to turn that on and then you want to go to the options box here we'll just reset it back to default and then you can turn on percentage of used UV space this is super powerful and hit apply and down here it's going to tell you how much UV space is used so you get a percent number there right and so if you can imagine there is a direct correlation between the amount of shell padding that you do for example let's put in a shell padding of zero and hit apply and you can see we've got 66% usage this is a weird case just because it doesn't pack into like a square whatever so you can ignore that it's all wasted space but we've got 66 percent used UV space and then if we were to put something in like 32 pixels or 32 pixels and hit apply they're actually gonna see we've wasted a bunch of UV space just in the edge padding there so this is a really good way to know whether you're on track for a good UV layout or not at my job we have a like a minimum of 70% so if we see a UV pack and it is less than 70% we have to ask the artist to redo it because it's unacceptable to waste all of that UV space either through poor padding or just bad UV layout choices in general so anywhere between 70% and 85% that's like a natural kind of a good UV layout good UV pack and now you might ask well why don't I just put one pixel of padding or zero pixels of padding save some space and make everything super efficient I'm glad you asked that question the reason is because of texture bleeding and mid Maps so because we use MIT maps if we texture right to the UV border edge and don't leave any space between UV shells will see texture bleed as the object that further away from the camera so here you can see I've had it out my UV shells here and and my texture I've got great represent where the texture is and the background color is red for demonstration purposes in this example and you can zoom in here everything's good and then you can see I've got a great cube here all good but when I bring this into marmoset toolbag you can see I've got these weird kind of red edges here and you'll see as i zoom out the red edge problem will get even worse it'll get edges will start to get thicker and the red edges are visible in marmoset toolbag because this viewport simulates more like a real game render engine compared to what my viewport does so you'll see this kind of error if you bring the acid into unity or marmoset toolbag or unreal or whatever does all this we need a little bit of extra texture that actually extends past the UV boarder edge so here gray is our texture and red is our background color and the white line is the UV shell so we need to actually extend that texture out a little bit there to compensate for the mid mapping and that's usually referred to as dilation or texture padding so to do that I'm just gonna quickly go into Photoshop here and I've got an example set up so this is my texture and Photoshop just zoom into one part of it there and then I've just extruded those border pixels out a little bit so you can see that's with my dilation off and that's with it on so I'm just going to save the texture here and we'll go back into Maya and so now you can see that's where my UV border edge ended and that's where all my texture happens and then I need to dilate out from that point to get a little bit of edge there to stop it from bleeding over when it mitts down to a lower resolution and then let's jump in over into marmoset toolbag and boom they're solved fix that problem and then you'll see when i zoom out the problem will always occur to some degree because we're talking about nipping down to like a single pixel but you want to solve it as much as possible given like a reasonable amount of pixel wastage between your UV shells versus like acceptable texture bleed so this is like well in the acceptable texture bleed range because the other thing too is we're not going to have red you don't actually ever want to have red or black or pure white or any high contrast color as your background color you want to dilate the texture out fully so in this example if it was an actual texture that we were making there would be no red because we would dilate out 100% to gray and to answer the original question why we can't have zero space or one pixel of UV space here let's just take a look so I'm just gonna go into UV mode here I'm just gonna scale these down to zero space for example and scale these guys down to zero space let's zoom in here and so we've got zero space between our shelves so you can see these guys are all just sitting on top of each other now to fix the original problem we want to extend the grey pixel past the UV border edge but if we've already left no space there there's no way that I can extend the gray and extend the gray and extend the gray and extend the grape past any one of these white lines and so as i zoom out I won't have any leading room there for the texture to scale down to a lower resolution and therefore will always get kind of UV border edge seams now of course because this is a fully great texture that wouldn't be a big deal but in a real texture you're gonna have different information on each side of each u-visa shell so to speak so we talked earlier about 32 pixels being way too much space and wasting a bunch of resolution and then what the magic number would be for the spacing between these that would give you enough space to pad out but still give you the most efficient UV packs and that number is eight pixels so the distance between these two UV shells on 2048 by 2048 texture should be about eight pixels if you can hit it right on the nose great what's going to happen though when you do your UV layout it's kind of inaccurate and then some shells are going to be stacked a little bit closer and some are going to be stacked a little bit wider so what I would for is I would aim for a space of eight pixels but if you end up with ten pixels that's okay and if it shrinks down and you end up with six pixels space that's also okay so you know you want an average of eight pixel space between here here here and here and there's actually a tool that you can use in Maya to measure out and where you are just to get kind of a reference point here so if you open up the UV toolkit to expand that guy and you go down to arrange and layout and you click the measure tool it pops up on this little window here which is neat and this guy will measure the pixel space between two selected UV points so if we select these guys here and we click recalculate you'll see in a 2k map they are currently 2 pixels along R 3 close to 3 pixels along U and 42 pixels along V so basically what that means is along u horizontally you can see they're almost lined up and so they're they're just like 2.5 pixels and then vertically they're way too many they're 42.6 pixels so that's like way too far right were targeting 8 and 8 here so this is a good way when you're just kind of working with UV layout some practicing to kind of see how your stuff is actually kind of padding out it's a good test to run the layout tool type in 8 pixels and 8 pixels run it and then just grab a couple and calculate them and see how they come out like let's measure these two here it's like those guys so that one is 50 pixels horizontally and only 5 pixels vertically and I have a trick that when I first got into 3d modeling I always had a hard time remembering what you and the meant like which one was horizontal and which one was vertical and basically how I've remembered this is IB is vertical so if you just remember V then you know what u is so U is horizontal and V for vertical so I always work backwards I go ovie ok vertical so that means U is horizontal and another really interesting thing to point out about this tool is because like we mentioned earlier UVs are kind of in like vector space like infinite space they're procedural but your texture is in pixel space so it's not so this tool will actually show you like these two pixels are 50 pixels apart and that's very wasteful but in a 4k map there are actually a hundred pixels apart because there's more pixels but the UVs don't update as you apply different texture so if you think about it that way if you're working with 4k maps and even at 8 pixels apart that's actually going to be double it's actually gonna be much more on a 4k map but I find 8 pixels is a great compromise between texture bleed and UV space wastage so I would always target 8 and primarily I work with 2k maps and when I work with 4k maps I still had out to be to be 8 in a 2k map if that makes sense so this stuff should be way closer together so here I'm just gonna like do a quick thing here and straighten these guys out those guys straight just for a little test here just for fun well straighten these guys out straighten these guys out and then let's just measure this here okay so yeah we have 0 so that's great and then V we're looking at 40 so it's actually like way tighter way tighter way tighter yeah it's like I'm still at 15 so I can't even do it on this texture because the way that I've done the texture but basically whoops there we go we're getting close basically somewhere around or a point on good enough so somewhere around there is about the space that you're looking for that you came at so that's it keep your UV percent usage to 70% minimum but always aim for higher and keep your texture padding to 8 pixels on average but if you end up with some shells that are padded 6 and some shells that are padded to 10 that's ok too if you liked this video and want to see more game art tips and tricks please click the subscribe button as usual any links will be in the description if you got any questions post them in the comments area thanks for watching everybody have a phenomenal day
Info
Channel: malcolm341
Views: 26,397
Rating: undefined out of 5
Keywords: Maya, autodesk, time, saving, tricks, secret, secrets, tips, 3d modeling, 3d modelling, easy, fast, tutorial, workflow, pipeline, best, mel, script, malcolm341, 2018, 2017, 2016, 2015, video, quick, free, beginner, learning, how, to, learn, polygon, polygons, hotkey, hot, key, use, save, uv, uvs, uvw, unwrap, unwrapping, mapping, map, texturing, texture, texel, density, pixel, pad, padding, dilation, mip, mipmapping, spacing, editor, what, is, bleed, bleeding, texture padding, how much texture padding should I use, how far, space, UV islands
Id: MVsIIkJNkjM
Channel Id: undefined
Length: 19min 36sec (1176 seconds)
Published: Sun Aug 05 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.