Join Adam Crespi for an in-depth discussion in this video Working with texture sheets, part of Learn to Texture for Games.
- View Offline
With the idea of tiling in mind, we'll explore a texture sheets as a way to economize how many textures we are using. The idea on a texture sheet is that rather than using unique textures for every object, we may have a texture atlas, or master texture sheet, that covers many objects in a game. Environments are a terrific example of this. We may have a texture sheet that is good for many of the buildings in the scene, characters then may have their own unique texture. In this scene then, I've got a texture on the brick, actually two of them; a color and a normal and a color and a color so far on the door.
I'll add in a normal and we'll see how this looks and then we'll look at what happens with a texture sheet in this unwrap. I'll go into the blaine here on the door, and into the Bump Mapping, and choose File. In the file setting to Tangent space Normal, I'll go pick up the door normal. As a side note in naming, I'm calling each of my files not only what they are but where they go. So in this case DoorN says, it's a Door and it's a normal map. So I am looking at a list of files. Let's say here in the File browser or in the hierarchy or project view in Unity, I can see very well where the pieces go and what they're intended to be without having to preview each one.
Especially as the alpha channel makes the display in this some what murky. Because of the transparency, having a good naming conventions so you can find things easily is important. I'll click Open and in the high-quality display we can really see how my door shows up. I can also test this by using Viewport 2.0. In Viewport 2.0, I have the ability to add in screen space occlusion if I need, and also anti-aliasing, and really simulate a game environment. It's good to do this, to be able to see how things are going to behave when you get them in an engine, but still here in Maya.
I've turned on my Screen space occlusion and I'm turning all my Anti-Aliasing at two samples. Now when I turn off the wireframe on shaded, I get a pretty good idea of how this'll show up and Unity, at least before I gets lights in. What I'll do now, is look for ways to economize this in a texture sheet, and here's why. Right now, these textures are giant. Now 12 MB may not seem terribly giant but for that brick wall for example, here is 12 MB for the color, and 32 MB for the normal map; here is the door at 5 1/2, and the door normal at another 5 1/2.
Very quickly with unique textures like this, I'm dealing in 55 MB to establish the simple wall. It's simply too big, and this will swamp a game engine if I keep going this way. What I'll do then is get them assembled new a texture sheet and I'll max out my might texture sheet at 2K or 2048 on a side. I'll have the door, a door frame, and a brick wall. I've a texture sheet for a color and a normal map. Here in Photoshop, I've taken the textures I've used on the door and the wall, and put them together on a texture sheet, matted over a color that works on the edges.
The brick is matted against a brick color for example with the door being matted against the clean blue. I have includes some extra blue matting here for the door, for the doorframe pieces, and a long gray strip for the concrete cap on top of the wall. When these maps start out they were drawn large, and clean in this case; this is my brick for example. In the channels often we will tuck a spec map, specular highlights in the alpha that way we can use one image twice; once for the color, and once the shine in Unity. I've done this with the door for example. Here it actually shows two alphas.
I've got alpha one, which is the specularity on the door where is it shiny or not and Alpha-2 is going to be the height map for parallax material, making it look like it sticks out and reorients correctly. In my normal then I got the same thing. I need to optimize the alpha channels, but there is the normal and the alpha for the parallax. These are also very big. For example the door here, press Ctrl+Alt+I for image size is 720 x 1600. I've rendered it very large and plan to sample down.
In my texture sheet then, I drew the initial sheet at 2048 on a side; screen res is always 72. It really matters how many pixels we have, and place the pieces in. There's my brick wall at 1024 square and there is my door larger; and the reason for this on the Texture Sheet in the planning of it, is so that when we get close to the door, because most likely we're going to go through a door, we see it in good detail same with the area given to the frame here in the blue. We are simply more likely to see this closer up.
Finally, I have got some extra space here for other building elements, maybe there is graffiti overlays or other building materials I would like to use. I'll save this out, and put it on in Maya. I'll press Ctrl+Shift+S and save out a tiff here. I'll call this first one Building sheetC for color, and I'll turn off layers and save out the alpha channels. Then in my layers palette, where I have organized by layer sets, I'll turn on the Normal and make sure those layers are on here. I put the normal together as well. There's the door and the brick wall, and matted against the default blue of normals.
I am going to save it out as a TIFF with the alpha channel being the parallax map or height, and choosing TIFF, I'll turn off layers and name this Building sheetN. Back here in Maya, I'm going to start swapping out the materials here for that texture sheet. What I can do then, is actually pick all of my objects and get a new material on or assigned it existing, and swap out the texture. I'll choose Assign New>Blinn and put in my texture sheet elements, starting out with just a color. Here's Building sheetC, it's on and I'll make sure I break the connection to Transparency by right-clicking on the word, and choosing Break Connection.
We can see here is that, that mapping I had didn't work. This is why it's important to plan the texture sheet first, saying as we're designing these elements, or this sheet, or this level, what are we going to be close to? What do we need to see in the texture sheet, and what can we get away with a lower resolution. But we also want to do in a texture sheet and say, where can we break the geometry, by adding and maybe pop out on the wall here, to break the linear run of this texture. What I'll do for example is unwrap the door to lay onto that texture sheet.
Now that I have one material assigned everywhere, I am using one image; although it's bigger I am loading it once. I'll pick the door, and choose Edit UVs and UV Texture Editor. Here my Texture Editor, I can see my texture sheet, and right now my polygons are simply spread out onto it. What I'm going to do then is try and automatic unwrap for example and take these door elements and size them over that particular piece, working in both views here, so I can really see what I'm doing. I'll use my Move Shell tool, going under Tool>Move UV Shell, and turning off Prevent Overlap, and start to stack these UVs.
I'll pull them in, get them nice and tight, right-aligned on each other and then take the whole piece and shrink it down. For this example I am not going to worry about the sides, I'll simply stack them next to it. What I can do though, is get this using one section of my texture sheet for that door. I'll pull these up, press W for move, R for Scale, and get them nicely in place. Now as I can see in my view, there is the door image on the door using one part of one texture sheet and still looking pretty good in the view; its 1024 tall, which is more than enough resolution for this door.
I'll take the shells for the sides and for now I am just going to pull them over, making sure I am using the Move Shell tool, so I catch them all. Ideally we would have some kind of extra material here maybe the doorframe pieces get unwrapped on to it as well. I still need to deal with my brick wall, but now I've got one image, or one texture sheet, and the door is a part of it, and even full in the view it looks pretty good. I'm running at 1280x720, and this is comparable to what we'd see in a game, and even if we go really close, filling the view up with that door, that texture holds up perfectly fine. That as I'm charting through here, it's going to look good and uses one image.
Planning out the texture sheet then is important. We need to figure out it in here, how long of a run of the texture we are after? For example this brick wall definitely needs a tiling texture of some kind, or some sort of break in the geometry such as another pop out here, to accommodate this linear run of brick along that wall. The cap here can be unwrapped on to that section of the texture sheet instead of having its own unique material and as can the doorframe. What this means now is I am going to bring two images into Unity. I diffuse with an Alpha, giving me the specular highlights, and a normal of an alpha, giving me the parallax map.
And I load it once and use it on hopefully, a whole bunch of buildings, keeping my frame rate up and my resource use down.
- Introducing texture tiling
- Stacking polygons in an unwrap
- Establishing base colors
- Establishing realism with age and wear
- Cleaning up seams and joints in textures
- Creating dents and scratches
- Working with normal maps
- Sculpting detail
- Baking occlusion for rust and dirt
- Working with value and color for incandescence
- Faking reflection
- Painting skyboxes