« Posts tagged uv

[Game] A Grave Affair

Grave Texture Mapped UV Islands

I’m creating a cemetery scene so you can imagine that I’m going to need some tombstones. I have sculpted another since my last WIP and thought I would share it. As I was breaking down the scene I was trying to think of ways I could maximize my work time. I wanted to make sure I wasn’t sculpting more assets than I needed to make the scene look full. From that point on I decided that all the tombstones were going to have a different design on each side. This would let me cut the number of tombstones that needed to be created in half.

Just like the last mesh I started in ZBrush my sculpting the general shape. With hard objects like this I like to start by smashing together basic geometric shapes with Dynamesh. After I have the basic shape it’s time to save a copy and start sculpting wear and tear. I was able to use the noise profile that I saved from my last sculpt to break up the noise on this one as well. Saving out the noise and other commonly used elements will also help me to keep things artistically cohesive throughout the production of the scene.

(http://www NULL.terrymatthes NULL.com/wp-content/uploads/2013/01/gravesculptL NULL.jpg)

Dynamesh is your best friend in ZBrush while creating game assets! Maybe it’s because I started working with 3D before ZBrush was around, but I just love the ability to kit bash with ZBrush while staying largely ignorant of topology. Gone are the days of matching up verts and integrating meshes before they can be treated as a single surface. With  the tombstone here I was able to take a human skull I had modeled for a previous project and insert it into the top of the grave. The book sculpted the same way, but I created the book within ZBrush as a separate subtool. If you’ve never merged dynamesh objects before it’s actually quite simple. Start by making sure both objects are dynameshes themselves and then use subtool master to merge all visible subtools. They aren’t quite the same yet though. They should be one sub tool, but you’re going to have to ctrl drag and empty marquee selection to have ZBrush retopologize your dynamesh subtool once more. Bam! It should be all one surface now. If the objects look to crude then you need to turn up your dynamesh resolution before dragging to retopologize.

Like most of the assets in the scene I’m trying to keep the poly count around 1K. And speaking of polygons I wanted to address a common misconception about them. A lot of people fret about poly count in-game design. Whether its triangles or quads less is not always better. We’ve gotten to the point on mid level hardware where poly count isn’t the limiting factor it used to be. “I spent a solid few months of optimizing polys, lightmap UV channels, collision meshs for everything in UT and the act of stripping 2million polys out of a level generally improved the FPS by 2 or 3 frames.” – Kevin Johnstone (http://www NULL.polycount NULL.com/forum/showthread NULL.php?t=50588). Texture maps represent modern geometry more than polygons do at levels of high frequency detail. We are using lots of texture memory to affect and displace geometry. Stripping down the polygons to an absolute minimum is going to cripple the ability of a normal/displacement map to affect the perceived detail of your asset. If you need a few more verts to make an edge look better just do it!

If textures are the new limiting factor then what you should be aware of is “draw calls“. Your video card can only do so many of these per rendered frame and keeping this low is going to have a big impact on performance. A draw call is done for each material on a mesh every frame.  One mesh doesn’t equal one draw call. A lot of engines will actually limit the number of materials you can put on a single mesh.  The 600 series Nvidia cards can do roughly 600 draw calls per frame and that’s pretty good. When you think about how many textures that is you might that’s a lot, but each of those calls is slowing down performance.  One last thing worth mentioning is that even instanced meshes with the exact same materials will require separate draw calls. This means that if you have a metropolitan city full of instanced buildings each individual building is adding another draw call. If you have more than one material on heavily instanced assets you can see how this would start to adversely affect your frame rates. Just try and keep the number of materials on each mesh as low as possible :)

Just like our last tombstone mesh I broke out the damaged bits and strong surface changes into their own “UV Islands”. These islands are keeping xNormal from casting seams along the edges of those areas. The key is to break out UVs where the geometry sharply differs from the continuity of the surface around it. In the following diagram I’ve outlined the UV islands in blue on both the mesh and UV editor. You can see how these areas differ from the geometry surrounding them. Doing this with your light map UVs as well as your texture UVs will help shadow fall across your object with less error.

(http://www NULL.terrymatthes NULL.com/wp-content/uploads/2013/01/GraveUVL NULL.png)

During the initial baking of normals I produced two errors outlined in below. These particular errors were not from UV mapping, but from floating vertices that weren’t connected with an edge. Retopologizing in ZBrush is awesome, but now without its downside. I find the vertices you lay down quite hard to see and the cursor snapping can give you errors if you’re backed to far out by not connecting your edges. On closer inspection of the erroneous areas I was able to find the floating geometry and correct it. Now you can see how this got rid of those errors on the updated normal map texture. Always inspect your errors thoroughly. Chances are your error is coming from errant geometry at the site or flipped normals. If your normal map comes out looking like details are being projected on from the front to the back or vise versa you’re having scale issues. Your models scale is too small for xNormal to properly bake the texture map.  The UDK’s native scale in Maya is too small so you’re going to have to scale up your geometry 20-50 times its actual size to get proper normal map bakes.

Normal Map Errors on UVs (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2013/01/UVerrorL NULL.jpg)

The job I’m working has the potential for me to work on some “magic” type effects so I am going to post a couple R&D clips this weekend. These will be geared more towards film although I will try to explain the fundamentals well enough so that you may apply it to Cascade in the UDK. If your still  feeling confused about baking normals? Check out Tombstone WIP2 (http://www NULL.terrymatthes NULL.com/unreal-2/materials/tombstone-wip-2/) to learn more about game asset creation with the UDK in mind. Until then Cheers,

Terry

[Game] Tombstone WIP 2 – UV Work

Tombstone UV Layout

Tombstone UV Layout (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2012/11/tombstoneWIP4 NULL.jpg)Since my last update I’ve stopped working in ZBrush and started testing in the UDK. My goal for this update was to have the light maps working with a basic material in place. The first shot on the left shows the low poly tombstone with it’s UV’s layed out. These are also the same UV’s I used for the light map. If you plan your layout you can make sure that you use the same set of UV coordinates for both diffuse and light map.You still have to put the light map UVs in a second channel within Maya, but this can save you a lot of time. Making the UVs for the light map is a very similar process to making proper UVs for a normal map. You want to ensure that you have separated any faces that break out of the continuity of the surface flow. To illustrate this I have colored all of those faces blue. These faces happen to correspond to all the chips and scrapes in the model. These faces all have one thing in common. They are sharply opposing the direction of the faces around them. Faces like these have to be broken off from the model and separated into UV Islands. You’ve probably heard this term before. UV islands prevent normal map errors when baking down from your high res model to your low res mesh in programs like xNormal. A general rule of thumb is that if a face comes close to or is more than a 90 deg. angle from the regular surface flow it should be separated into it’s own island joined by any adjacent faces with the same behavior. The map pictured here is 1024 square. I should note that I left a little bit of padding around each UV group as this helps with normal and light maps.

Tombstone Work In Progress Shot 2 (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2012/11/tombstoneWIP2b NULL.jpg)In the picture on the right you can tell the light maps are working correctly because the shadows in the second picture are falling over the crosses as they should. If there were errors in the light maps you might get strange blotches or shadows showing up on the wrong faces. Again it’s important that we separated all those sharply angled faces so that we don’t get these errors. It’s also of note that the lower the resolution of your texture, the more padding you need  to give those islands.  If they are too close the shadows will start to bleed from island to island. In the UDK the entire shadow maps are being baked down to very very low resolutions to save memory. If you look at the ground shadows they are set as high as you can go with 1 pixel of screen space being dedicated to 1 pixel in the light map. You can not do this for every asset in your map or you will kill the texture memory of your video card. I only did this as a test for myself to see how far I could push the shadow correctness. Now you might look at those shadows and think they aren’t that sharp, but in a game with a textured ground and movement they are more than enough to sell the realism of the shadow.

Tombstone Rough Material (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2012/11/tombstoneWIP3 NULL.jpg)Here we have a simple material with a diffuse, specular and normal map along with a 1 Variable Constant set to “10” being plugged into the specular power. To drop a constant down in your work area you can simply press 1, 2, or 3, on the keyboard and left click. Specular Power operates like Eccentricity on a Maya material. The higher you put the number the more “glossy” your highlight becomes. We are dealing with stone here so we’ve entered a low value of 10 as the porous nature of the stone surface would scatter a lot of the diffuse light being cast. The map we’ve used for the specular is actually a darkened version of the cavity map with some noise applied to help sell the diffuse nature of the stone surface. The cavity map works well as a specular base because it stops the cracks and depressions from casting light out into the scene and in turn sells the sunken  nature of those areas. One last thing I wanted to touch on was your low poly mesh’s normals. I found that if I let the UDK set my vertex normals (which is does by default) my faces looked too sharp where the texture seams were running and I generally wasn’t happy with the result. I spent a bit of time setting all the normals in Maya and I wanted to use those instead. Luckily you can do this when importing.

Tombstone Import Normals Protection (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2012/11/tombstoneWIP5 NULL.jpg)When you choose to import your mesh you can select a couple options that will stop the UDK from wiping out your normal values. Under the General section and Static Mesh sections there are two options; Import Tangents and Explicit Normals. Check both of these off. If you do all of this and your still having trouble with shadows falling improperly over your object you probably haven’t turned your light map settings up high enough in your mesh’s properties. If it’s the “ground” that isn’t showing shadows correctly then the same holds true for whatever surface the shadows fall onto. Remember though that with a static mesh you want a higher number for a crisper result and with BSP geometry it’s a lower number that casts a crisper shadow.

That’s all for now :) I’ll be back with more soon and hopefully have some of the actual scene to show. If anyone has any questions email me or just ask them in the comments section within this post.