UV Maps for buildings
Hi, I'm trying to wrap my head around a model I'm making of a simple building.
The model itself is done in Sketchup and I've made the model into a single object.
Now, I've tried to import it into BodyPaint, just to see what the UV look like.
And it turns up somewhat like this:
http://img244.imageshack.us/img244/2517/uvmapla6.png
See how the UV splits the geometry? I have seams everywhere and can't be able to make it look more like this:
http://www.free3dtutorials.com/userimages/brilliant/UVMapping/uvmap0019.jpg
In the image above (it's just an UV of a character I found with google pictures)
you can clearly see that the parts that connect to each other are folded out in a way that would allow seamless textures. So I was wondering, would 3d models of buildings actually have these kinds of UVs? Is this normal? What can I do to make unfold in a better way?
That other picture you posted is a UV map generated by something called "pelt mapping". It's a solution for organic UV mapping, used for people, creatures, and other things with smooth curvatures and organic shapes. Pelt mapping is done by first defining seams, then flattening polygons defined by seams, and attaching each outside edge of the resulting polygon mesh to an outer "control" circle. When this is done, a "stretching" factor is applied to polygon mesh within the circle, pulling the polygon mesh apart toward the edges of the circle. This results in a "smooth" looking mapping (see animation here: http://mag.awn.com/issue10.07/10.07images/lesser02_PeltMapping.gif). You would not use that for a building, unless that building has lots of smooth curves (in more than 2 dimensions).
To map a building, you would use a combination of planar and box mapping. Most 3D design packages support this. If you are a programmer, planar and box texture mapping are known to you as "texture projection" techniques. After you do the automatic mapping for each part, you will have to do some detective work (very difficult and time consuming), to figure out which layed out pieces (called "UV Islands" by the way) fit together, and weld them by vertices or by edges. This will eliminate physical seams. To make your job of sealing seams easier, you should carefully map each part of the building separately, and position all related parts in the same general area, so you later know which is which.
The UV map of the building you posted was probably automatically generated - it looks terrible. First of all, you need to make sure texture space gets reused as much as possible - it looks like there are some similar shapes which should use exactly the same texture space (because the data is essentially the same). Second, you need to make sure that everything related is welded together (as I mentioned in previous paragraph) - it looks like there is a large amount of tiny broken up pieces that belong to various parts. Third, make sure that the relation in size is properly maintained, and think carefully about texture space allocation. This means that the smaller the polygon is on the model, the smaller it should be on the texture map. In contrast, more "important" polygons should be larger (have more texture resolution) than less important polygons, even if in physical dimensions the size proportions are the opposite. So for example, on a character, you always make the face larger, so the texture on the face is always more high-res than the rest of the body.
When you paint the texture based on the UV layout, make sure to fill the space between UV islands with color that is an extension of the data within the island (use clone stamp tool in Photoshop for example). This works to eliminate texture sampling artifacts. As you may know, when you have non-point texture filtering enabled, several texels get sampled from around the area of each sampled texel, and when sampling on the edge this will "pull in" the pixels from beyound the edge. If for example you fill everything between the islands in black, all of your seams will have dark lines once you export your model into the game. Don't forget that mipmapping also works by sampling, so when the game engine generates mipmaps, even more of pixels that lie beyound edges will get pulled in, and seams will become glaringly visible.
Well, and the last thing to mention. Most buildings will benefit from using repeated textures - this saves texture space, and allows you to use higher resolution for the polygons, allocating more texture space to them. Most 3D design programs have a "texture square" in the UV map layout. When you stay inside that square, texture coordinates range from 0.0 to 1.0. When you go outside the square, texture coordinates can go up to any number, in the multiple of texture size. For example, positioning a polygon the size of two textures over to the right will result in the 2.0 coordinates, etc. Most game engines support some sort of texture-out-of-bounds mode for the textures. For example, there is wrap, mirror, clamp and border color. Wrap/repeat is of course the most common, and it repeats the texture over the surface as many times as the texture coordinates say. So, depending on which engine you are using, you would have all the repeating parts of the texture layed out in sequence either horizontally or vertically. For example, a side wall of the building could go in a continuous strip from bottom left to bottom right of the texture. Then, make your wall polygons extend past the end of texture, causing the whole strip to repeat itself over the polygon, to fill the whole polygon. This repeating can also be accomplished without the texture modes, by simply partitioning the wall into squares, and pointing each square to exactly the same location in the texture.
To map a building, you would use a combination of planar and box mapping. Most 3D design packages support this. If you are a programmer, planar and box texture mapping are known to you as "texture projection" techniques. After you do the automatic mapping for each part, you will have to do some detective work (very difficult and time consuming), to figure out which layed out pieces (called "UV Islands" by the way) fit together, and weld them by vertices or by edges. This will eliminate physical seams. To make your job of sealing seams easier, you should carefully map each part of the building separately, and position all related parts in the same general area, so you later know which is which.
The UV map of the building you posted was probably automatically generated - it looks terrible. First of all, you need to make sure texture space gets reused as much as possible - it looks like there are some similar shapes which should use exactly the same texture space (because the data is essentially the same). Second, you need to make sure that everything related is welded together (as I mentioned in previous paragraph) - it looks like there is a large amount of tiny broken up pieces that belong to various parts. Third, make sure that the relation in size is properly maintained, and think carefully about texture space allocation. This means that the smaller the polygon is on the model, the smaller it should be on the texture map. In contrast, more "important" polygons should be larger (have more texture resolution) than less important polygons, even if in physical dimensions the size proportions are the opposite. So for example, on a character, you always make the face larger, so the texture on the face is always more high-res than the rest of the body.
When you paint the texture based on the UV layout, make sure to fill the space between UV islands with color that is an extension of the data within the island (use clone stamp tool in Photoshop for example). This works to eliminate texture sampling artifacts. As you may know, when you have non-point texture filtering enabled, several texels get sampled from around the area of each sampled texel, and when sampling on the edge this will "pull in" the pixels from beyound the edge. If for example you fill everything between the islands in black, all of your seams will have dark lines once you export your model into the game. Don't forget that mipmapping also works by sampling, so when the game engine generates mipmaps, even more of pixels that lie beyound edges will get pulled in, and seams will become glaringly visible.
Well, and the last thing to mention. Most buildings will benefit from using repeated textures - this saves texture space, and allows you to use higher resolution for the polygons, allocating more texture space to them. Most 3D design programs have a "texture square" in the UV map layout. When you stay inside that square, texture coordinates range from 0.0 to 1.0. When you go outside the square, texture coordinates can go up to any number, in the multiple of texture size. For example, positioning a polygon the size of two textures over to the right will result in the 2.0 coordinates, etc. Most game engines support some sort of texture-out-of-bounds mode for the textures. For example, there is wrap, mirror, clamp and border color. Wrap/repeat is of course the most common, and it repeats the texture over the surface as many times as the texture coordinates say. So, depending on which engine you are using, you would have all the repeating parts of the texture layed out in sequence either horizontally or vertically. For example, a side wall of the building could go in a continuous strip from bottom left to bottom right of the texture. Then, make your wall polygons extend past the end of texture, causing the whole strip to repeat itself over the polygon, to fill the whole polygon. This repeating can also be accomplished without the texture modes, by simply partitioning the wall into squares, and pointing each square to exactly the same location in the texture.
Oh, man.. :( Seems like a pretty steap learning curve. I would have to learn while I progress through my model I guess. But, to take it a bit from the beginning. When creating Sketchup-models, how should I exactly organize the model to begin with? I supposed I need to "tell" the UV map that one particular "island" means more than just one set of geometry? In my UV map I've got separate UVs for each window, which is identical (cause it's really the same component in sketchup). Meaning, one island could represent all windows. Now, how would I exactly DO that? ;) Can I do it in Sketchup, Bodypaint or Zbrush? I think I understand the whole meaning of your post, just seems a bit advanced with all the texels and the stiching UVs together.
But basically, I need to carefully plan and design how a building is layed out. Probably as far back as the drawing board, thinking out which parts could be reused in other areas and such. Especially since it's art assets for games this will eventually become and therefore I need to think about performance as well. I like the challenge! :)
Extremely good post by the way, one of the best and well though out responses I've ever seen on an internet forum :) And also, you know of any good books or ebooks about this sort of thing your talking about in your post? I could probably use a bit of a beginners study when it comes to 3dmodels and texturing. All I know is that when I walk around town, I constantly look at sections that would be great to model or to use as textures! :D It's really driving me crazy, all I want to do is take out my camera and take a huge megapixel shot of it and create displacement maps and sculpt further in Zbrush. :) Do you by the way, tell if my "thought out" workflow would actually work? Are you familiar with Sketchup and Bodypaint or Zbrush?
But basically, I need to carefully plan and design how a building is layed out. Probably as far back as the drawing board, thinking out which parts could be reused in other areas and such. Especially since it's art assets for games this will eventually become and therefore I need to think about performance as well. I like the challenge! :)
Extremely good post by the way, one of the best and well though out responses I've ever seen on an internet forum :) And also, you know of any good books or ebooks about this sort of thing your talking about in your post? I could probably use a bit of a beginners study when it comes to 3dmodels and texturing. All I know is that when I walk around town, I constantly look at sections that would be great to model or to use as textures! :D It's really driving me crazy, all I want to do is take out my camera and take a huge megapixel shot of it and create displacement maps and sculpt further in Zbrush. :) Do you by the way, tell if my "thought out" workflow would actually work? Are you familiar with Sketchup and Bodypaint or Zbrush?
I'm familure with ZBrush. It's not that difficult to figure out, I use it to place all the U,Vs.
Basicly once the model is completed (I usualy use Wings3D for modeling), I import it into ZBrush. From there I select all the model then use one of the ZBrush built in tools to map the U,V cords...for a building typicaly use something like box or plain, selecting the axis I want to represent.
Then from there I go about selecting faces and moveing them around texture space to create "islands" useing as much of the texture space as I can...This is the hard part, and it requires some planning and even experience.
Once I'm happy with that, I save the model (so my U,Vs are maintained) then use a Zbrush tool allowing me to "render" the texture. There are a number of settings for this, from size to color and even polygonal normals. But I useualy just spit out a black texture with a white wireframe showing where those "islands" are and all that. This then becomes the template for the final texture.
Once done with that I reload the model in ZBrush, and use the materials tab to load in the texture and apply it. From there I can go back and make U,V corrections to fine tune the model.
It also lets you edit multiple sets of U,V cords, which can produce some effects if the game engine supports it (i.e. a model tank with one texture representing the body for use with U,V set #0 and another representing the treads for use with U,V set #1. Then the game engine can "scroll" the tread texture makeing it appear the treads are moveing)
Basicly once the model is completed (I usualy use Wings3D for modeling), I import it into ZBrush. From there I select all the model then use one of the ZBrush built in tools to map the U,V cords...for a building typicaly use something like box or plain, selecting the axis I want to represent.
Then from there I go about selecting faces and moveing them around texture space to create "islands" useing as much of the texture space as I can...This is the hard part, and it requires some planning and even experience.
Once I'm happy with that, I save the model (so my U,Vs are maintained) then use a Zbrush tool allowing me to "render" the texture. There are a number of settings for this, from size to color and even polygonal normals. But I useualy just spit out a black texture with a white wireframe showing where those "islands" are and all that. This then becomes the template for the final texture.
Once done with that I reload the model in ZBrush, and use the materials tab to load in the texture and apply it. From there I can go back and make U,V corrections to fine tune the model.
It also lets you edit multiple sets of U,V cords, which can produce some effects if the game engine supports it (i.e. a model tank with one texture representing the body for use with U,V set #0 and another representing the treads for use with U,V set #1. Then the game engine can "scroll" the tread texture makeing it appear the treads are moveing)
My deviantART: http://msw.deviantart.com/
I am a 3D Studio Max guy, so all of my knowledge concerns primarily that program. I have also used XSI Mod Tool, but very little.
When you design an object in Max, let's say a box, you can UV map it. UV mapping basically assigns texture space coordinates to each vertex, in addition to its model space coordinates. This, as you know, controls which texels of the texture will get sampled as the rasterizer interpolates texture coordinates from vertex to vertex over each triangle.
I'm going to be concrete here (talking about 3D Studio Max). Once you make a box, first you need to apply a checker texture to it. Checker texture is useful because it allows you to see any distortions that occur (you will immediately notice when squares start being parallelograms for example), allows you to see any incorrect scaling (you can easily see when squares become rectangles), and allows you to see texture resolution (the smaller the squares, the more texture resolution a polygon will have). To apply checker texture to a box, display Materials palette. Click on one of the unused ones, go down and find Diffuse channel. Click on button with ellipsis to display texture chooser. Click procedural textures, and double-click on checkerboard texture. Then select the box, select the new checker material, and click "apply to object" button. Also, click the "show textures in viewport" button, so you can see the checker texture on the box as you are doing UV mapping.
Then you go Convert To->Editable Poly in Max. The box becomes editable, and you can select individual faces, edges, vertices, and holes. In the simple case of a box, you would probably do box mapping. So you go to Face mode, select all box faces, and apply a UV Map modifier. This will display a UV Map widget, and a UV Map panel. On the UV Map panel, you will choose "Box" in "Mapping Type". This, basically, does automatic assignment of texture coordinates to all vertices, using projective texturing. Other choices are Cylindrical, Spherical, and Planar. Once you do this, the UV Map widget changes to a wireframe box centered on your box. You can adjust width and height on the UV Map panel, thus stretching the checkers on the box horizontally or vertically. You want them to actually be perfectly square, to get a "good" UV map.
Remember, this first stage of "UV Map" is simply used as a starting point. Just to assign some initial texture coordinates before you start UV mapping, so you have something to work with, besides a huge mass of islands scattered all over the place. Doing this initial "automatic" projective texturing brings more order to the islands, so you can work with them easier in the next step.
So once this is done, apply another modifier, called UV Unwrap. That's when you are actually going to edit the UVs - drag the islands around, rotate them, scale them, break them apart, and stitch them by vertices, edges, or faces. You will see the changes to the checker on the box right in your viewport. So after you apply the modifier, click the "Edit" button on the UV Unwrap panel. This will display the infamous dialog where you can visually assign texture space coordinates to all vertices you are mapping. You displayed a screenshot of that in your first post in this thread. There are buttons on the bottom of the dialog that allow you to do all the manipulation. Oh, and each time you select a vertex in the UV map dialog, that vertex gets highlighted on the 3D viewport. Same goes for edges and faces. That way you can figure out what you are looking at more easily.
You can download GMax from TurboSquid. It's a lightweight version of 3D Studio Max, and it's free. If you decide to do this, I can teach you UV mapping.
When you design an object in Max, let's say a box, you can UV map it. UV mapping basically assigns texture space coordinates to each vertex, in addition to its model space coordinates. This, as you know, controls which texels of the texture will get sampled as the rasterizer interpolates texture coordinates from vertex to vertex over each triangle.
I'm going to be concrete here (talking about 3D Studio Max). Once you make a box, first you need to apply a checker texture to it. Checker texture is useful because it allows you to see any distortions that occur (you will immediately notice when squares start being parallelograms for example), allows you to see any incorrect scaling (you can easily see when squares become rectangles), and allows you to see texture resolution (the smaller the squares, the more texture resolution a polygon will have). To apply checker texture to a box, display Materials palette. Click on one of the unused ones, go down and find Diffuse channel. Click on button with ellipsis to display texture chooser. Click procedural textures, and double-click on checkerboard texture. Then select the box, select the new checker material, and click "apply to object" button. Also, click the "show textures in viewport" button, so you can see the checker texture on the box as you are doing UV mapping.
Then you go Convert To->Editable Poly in Max. The box becomes editable, and you can select individual faces, edges, vertices, and holes. In the simple case of a box, you would probably do box mapping. So you go to Face mode, select all box faces, and apply a UV Map modifier. This will display a UV Map widget, and a UV Map panel. On the UV Map panel, you will choose "Box" in "Mapping Type". This, basically, does automatic assignment of texture coordinates to all vertices, using projective texturing. Other choices are Cylindrical, Spherical, and Planar. Once you do this, the UV Map widget changes to a wireframe box centered on your box. You can adjust width and height on the UV Map panel, thus stretching the checkers on the box horizontally or vertically. You want them to actually be perfectly square, to get a "good" UV map.
Remember, this first stage of "UV Map" is simply used as a starting point. Just to assign some initial texture coordinates before you start UV mapping, so you have something to work with, besides a huge mass of islands scattered all over the place. Doing this initial "automatic" projective texturing brings more order to the islands, so you can work with them easier in the next step.
So once this is done, apply another modifier, called UV Unwrap. That's when you are actually going to edit the UVs - drag the islands around, rotate them, scale them, break them apart, and stitch them by vertices, edges, or faces. You will see the changes to the checker on the box right in your viewport. So after you apply the modifier, click the "Edit" button on the UV Unwrap panel. This will display the infamous dialog where you can visually assign texture space coordinates to all vertices you are mapping. You displayed a screenshot of that in your first post in this thread. There are buttons on the bottom of the dialog that allow you to do all the manipulation. Oh, and each time you select a vertex in the UV map dialog, that vertex gets highlighted on the 3D viewport. Same goes for edges and faces. That way you can figure out what you are looking at more easily.
You can download GMax from TurboSquid. It's a lightweight version of 3D Studio Max, and it's free. If you decide to do this, I can teach you UV mapping.
Quote: Original post by MSW
I'm familure with ZBrush. It's not that difficult to figure out, I use it to place all the U,Vs.
Basicly once the model is completed (I usualy use Wings3D for modeling), I import it into ZBrush. From there I select all the model then use one of the ZBrush built in tools to map the U,V cords...for a building typicaly use something like box or plain, selecting the axis I want to represent.
Then from there I go about selecting faces and moveing them around texture space to create "islands" useing as much of the texture space as I can...This is the hard part, and it requires some planning and even experience.
Once I'm happy with that, I save the model (so my U,Vs are maintained) then use a Zbrush tool allowing me to "render" the texture. There are a number of settings for this, from size to color and even polygonal normals. But I useualy just spit out a black texture with a white wireframe showing where those "islands" are and all that. This then becomes the template for the final texture.
Once done with that I reload the model in ZBrush, and use the materials tab to load in the texture and apply it. From there I can go back and make U,V corrections to fine tune the model.
It also lets you edit multiple sets of U,V cords, which can produce some effects if the game engine supports it (i.e. a model tank with one texture representing the body for use with U,V set #0 and another representing the treads for use with U,V set #1. Then the game engine can "scroll" the tread texture makeing it appear the treads are moveing)
Ok, I think I'll just start with single sets of UVs to begin with. Just to get familiar with the whole prosess. But in general, UVs DO matter right? Especially when creating game art assets? But I'm gonna try this using BodyPaint to begin with regarding the UVs. I've heard that Zbrush screws up the UVs and that it's basically a real mess before correction it. And I like the UV interface in Bodypaint so I think I'll just use that to begin with. Just hope that it's not much trouble preservind the UVs when exporting from Bodypaint to Zbrush. Need some experience here and there's no better way to learn then just doing it really. And also, I guess that stuff like this (UV, texture size and polygon count) can change during the game development prosess? That means that I need to figure out a good workflow to work with here.
Edit: Regarding UV islands that would represent the same in the 3d mesh. In my UV map I've got separate UV islands for each window, which is really identical. Could I just move all UVs to overlap each other and just paint from there on?
Would that render the same texture on all windows? Or is there any other way of "assigning" a set of UVs to several objects in the 3dmodel?
To make multiple polygons share the same texture space (as with all the windows on your building) just make sure the UV islands for all of those polygons overlap each other on the UV layout. Just like you thought.
Yeah ok, I've done some testing now. And I'm really wondering if there isn't an easier way of unwrapping these UVs. I'm wondering if the best way of doing it would be to set up the UVs on each of the different parts of the building, such as the windows separate. And then the door, etc. So I export these objects as a single model, UV and texture it and just use that completed model when rebuilding the full building. Does that make any sense to any of you? Can't think of a more efficient way of doing it and it would probably ease my work on it too.
Still experimenting with this and what settings to use when exporting the model. Sketchup seems to have a poor exporter and I really need to make sure that there aren't any errors is the model. And that would probably affect the UVs too.
Thanks for all help so far! :) You've been great!
Still experimenting with this and what settings to use when exporting the model. Sketchup seems to have a poor exporter and I really need to make sure that there aren't any errors is the model. And that would probably affect the UVs too.
Thanks for all help so far! :) You've been great!
You could do it by parts if you wanted, then join the parts. Practically, this will be more work, because of all the additional time you will need for splitting and joining parts. Your UV layout feature should allow you to "isolate" UVs for objects from each other temporarily (by hiding, for example) so it's easier to work on them.
When mapping a building, I would first select polygons for each window (one at a time), and apply box mapping. This should pretty much make sure the UVs for windows are "perfect". Unless, after applying a checker texture, you see that they are not, in which case a little tweaking may be required. The reason box mapping should work well for windows is because all the faces will be at 90 degree angles to each other. If you have arc windows, you may have to do some tweaking, but only on the inside and outside faces of the arcs (not the front or back faces). Do all the doors the same way.
After the windows and the doors are done, start mapping the walls. Here, I would use Planar mapping instead of box mapping, even if your house is a rectangle. It's just easier to manage that way. Then do the roof with planar mapping as well. If the roof has an angle, you will have to planar map each part separately.
Then there are miscellaneous things. For example, pillars. Those you would do with cylindrical mapping, probably no additional tweaking required. If you have any balls (like on top of pillars, or maybe on top of fence posts), you would use spherical mapping for those.
That pretty much covers it. It would be nice to see your actual house model, your current texture and any progress you made.
When mapping a building, I would first select polygons for each window (one at a time), and apply box mapping. This should pretty much make sure the UVs for windows are "perfect". Unless, after applying a checker texture, you see that they are not, in which case a little tweaking may be required. The reason box mapping should work well for windows is because all the faces will be at 90 degree angles to each other. If you have arc windows, you may have to do some tweaking, but only on the inside and outside faces of the arcs (not the front or back faces). Do all the doors the same way.
After the windows and the doors are done, start mapping the walls. Here, I would use Planar mapping instead of box mapping, even if your house is a rectangle. It's just easier to manage that way. Then do the roof with planar mapping as well. If the roof has an angle, you will have to planar map each part separately.
Then there are miscellaneous things. For example, pillars. Those you would do with cylindrical mapping, probably no additional tweaking required. If you have any balls (like on top of pillars, or maybe on top of fence posts), you would use spherical mapping for those.
That pretty much covers it. It would be nice to see your actual house model, your current texture and any progress you made.
Will take your good advice! :) I understand how each mapping type works now, the hard part is figuring out what kind of mapping would be apropriate for each part etc. This is what I find to be the hardest and it feels like I have to dumb down the complexity of my model. Or if I perhaps need to think of another way to model my windows for example, meaning, not using so many polygons and rather have apply the details using textures instead. I know I can get depth using displacement maps or bump maps, but the depth is limited though. And parallax mapping requre some resources hardwarewise. So that could be a problem. But I'm working on this now! :)
The best way I can think of doing this is actually trying to split up my building into sections instead of each object. I can just make my model the normal way and then just cut it in half or even smaller peices so I can stitch these together in the game editor and THEN build the building, kinda like this:
http://www.gamasutra.com/features/20051202/6_2Models.jpg
Then I would probably need to UV map each part carefully, like Windows etc. Still need some more experience doing this as this time. Will post results when I actually have them! :)
The best way I can think of doing this is actually trying to split up my building into sections instead of each object. I can just make my model the normal way and then just cut it in half or even smaller peices so I can stitch these together in the game editor and THEN build the building, kinda like this:
http://www.gamasutra.com/features/20051202/6_2Models.jpg
Then I would probably need to UV map each part carefully, like Windows etc. Still need some more experience doing this as this time. Will post results when I actually have them! :)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement