It’s been nearly two months since the last post, and in that time I’ve been doing a lot of important work on Townsend. In a nutshell, I’ve fleshed out the rest of the terrain’s ground, come up with a workflow for retopolizing it, and figured out how to make the cartoon assets mobile-ready. Ready for a ton of pictures? Let’s dive in!
The first thing on the list for finishing the terrain was to complete the landscape. It’s a pretty fun exercise; the terrain tools in Unity allow you to basically mold the terrain like clay, and it’s exciting to be working on the base of everything. It’s also a challenge to figure out how to hide the edge of the terrain from view and make it seem like like a natural cut-off. Here’s what I’ve come up with:
I think I might revisit this one more time to incorporate some techniques I’ve noticed while playing other games. For instance, most of the time when you’re making terrain like this you get caught up in making hills here and valleys there along this flat plane. This ends you up with basically a hilly flat-land with no real elevation difference. Not the best. What good 3d mapmakers will do is mold the terrain via a few passes. The first pass is a very broad altering of the landscape–lifting and setting entire regions to make highlands and lowlands. The second pass is then simply to add the hilly details that I’ve done. I’m hoping that I can manage to do the steps out of order without any side effects. You see, I come from a 2d mapmaking world, so this is one of those tricks of the trade that I hope will make a big difference. I might end up doing this in some sort of V2, because the terrain is completely playable as it is–and I want get *something* finished . We’ll see!
The second thing on the list is retopolizing the terrain. In an earlier post I explained retopolization for character models, and it’s a similar concept here: use more vertices for the complex parts, and less vertices for the flat and simple parts. Because this terrain doesn’t have any super sharp edges, and we don’t really care about the flow of the vertices on the terrain, we can use any common vertex decimator tool. For instance, blender has a decimator tool and a polygon reduction script that, when used together, give satisfactory results. Here’s the before (263,169 vertices) and after (6,579 vertices) of my terrain after decimation:
The last thing on the list is to get the cartoon assets mobile-ready. The cartoon assets were made by a talented vector artist who cunningly used Unity’s tree creator to automate things. For normal PC and Mac games where power isn’t much of an issue this is a benefit, as the terrain system will use the tree creator to toggle certain aspects of the stock version of the tree in order to make each tree on the terrain unique. For mobile, the fact that they were made with the tree creator is actually is a big issue due to the incompatibility of the materials that the tree creator uses. So, for me, this feature means a little more work.
The biggest problem is that the mobile shaders deal with the alpha channel of the generated textures in a different way. For those that don’t know, the alpha channel is simply the transparent ‘color’ value of the image. Unfortunately, the generated textures base the alpha layer off of white. This results in the edges of the leaves (where there is a range of semi-transparency) having a white outline.
So, what’s the fix? Well, it turns out this is a pretty common problem in general (mipmapping produces this problem, for instance). The most simple way to fix it is to set the alpha value to a color that more or less fits the texture. There’s a procedure in Photoshop that’s pretty simple:
- Make a new layer (Layers->New->Layer)
- Select a color that will blend with the edges of the image
- Use the Paint Bucket to fill the layer with the color
- Layer->New->Background from layer
- Save/Export the file. Done!
The ultimate fix is to set the alpha value to a layer that has literally repeated the pixels along the edge of the texture tangentially outwards. You can of course do this manually, or download the Photoshop script from the unity docs.
I’ve been using the simple fix and it has worked perfectly for my textures. As I continue converting the rest of the cartoon assets, I might come across some textures with multi-colored edges and end up having to use the more complex fix, so I’m glad I found it. The last treatment to the assets is to adjust the hue and saturation to fit the new shaders, and finally to manually apply shading to the textures. I don’t normally use Photoshop, so I had to dig out some masking techniques and eventually I came up with a conversion I was satisfied with.
So, that’s as far as I’ve gotten this month. Honestly I’ve been slacking a bit via Halo 4 and Assassin’s Creed 3 (and Hawken as of late!), but I hope to put in some good time in the near future now that I’m getting to the good part!