tutorial

texturing terrain (part 2 of 3)

figure1



figure2
In the last installment I showed you the basic concepts for modeling terrains in most 3D applications. By using a clever combination of Displacement and segmented Grid primitives you get a very flexible technique for building terrain. Now that you've built it, it's time to texture it. This is a bit more tricky and more specific to certain applications since the application of materials and textures can be quite varied. In this example I have been using 3DS MAX R2, so I'll continue with that.

mapping terrain
Mapping terrain can be very straight-forward, usually planar "overhead" mapping coordinates work best. This is best applied when you create a custom displacement map from scratch. If so, then take that greyscale map as a reference and texture it accordingly. The areas closer to white will correspond with higher elevations and vice versa for black low-lying regions. For example, if I wanted snow capped mountains, I'd create a new layer over the displacement map in Photoshop and build a base texture with greys, browns and greens. Then I'd add white to the areas of higher elevation using the underlying displacement map as a guide.

texturing terrain
There's a very powerful procedural way to do this in MAX that great simplifies the process. Johnny Ow wrote a very cool free material type plugin called, of all things, Terrain Material. It allows you to blend several textures together based on several terrain factors such as elevation, slope, and exposure. You can download it at www.ywd.com/jow or any of the MAX resource sites like www.max3d.com. I suggest you download his sample file too, it contains a good example that you can learn quite a bit from.

using the terrain material plugin
Terrain Material is broken down into two main maps, Base and Cap, and an optional Transition map. Below this there are variables for controlling how the plugin blends the materials together. We're going to make two maps, one for the rocky mountain surface and one for snow at the peaks. For now leave the Cap Controls at there default values.

rock material
There are several steps to making the rock texture and it goes into several layers, so I suggest you start by toggling the "Show End Result" button off. That way you can see the exact map you are working on and not the final composition blended together. To make the rock material, start by adjusting the shininess and shininess strength so that you have a dull highlight, something like 7 and 5 respectively. You can get really complicated here because the MAX material editor is very deep and flexible, but we're going for the basics here.

We want to be able to adjust the colors of the final diffuse map, so start with an RGB Tint or Color Correct map in the diffuse slot. With RGB Tint you can adjust the color channels of your final map allowing minute color variation. From there we assign a Noise map as the main map to build from. I'd normally assign it based on UVW coordinates, but this mountain is not likely to move around much, so using world coordinates is fine. I set up the Noise map with most of the default settings, only adjusting the phase and the low threshold. By bringing
figure3


figure4
the low threshold up from zero, we are going to expose more of color #2. You should be able to see this in the material box. For both noise colors we're going to use maps to define the patterns. For color #2, I used a grass bitmap and set mirror tiling to 12 on both U and V. Color #1 is a little more complicated. I added a second noise map, therefore nesting maps. This noise map uses much of the default settings, although I adjusted the phase again so that the noise pattern doesn't coincide with the previous map. Again I assigned maps to the noise colors, a bitmap for each. For color #1, I chose a dirt bitmap and for color #2 a rock bitmap. For both I set mirror tiling to 12.

These maps are rather generic and you can find them just about anywhere including the World Creating Toolkit that ships with MAX. To finish off this "Ground" portion of the terrain map, I assigned a bitmap as a bump map and raised the value to about 85. This bitmap is a greyscale version of the rock bitmap I had previously assigned to the diffuse color. Be sure to match the tiling to mirror and 12 for U and V coordinates. Because the material is coming out more brown than I had intended, I adjusted the RGB values in the RGB Tint map at the top of the material stack so that the color was less saturated.

snow material
For the snow material, I went with a plain white diffuse map and adjusted the shininess and shininess strength so that it was still a dull highlight, but had more power than the rock map. Settings of 6 and 13 respectively should be fine. Though it's not necessary, I added a slight bump map to the snow by assigning a dirt bitmap and set the strength to 30. This gives us a slightly shiney snow material that only shows relief up close, like real snow.

cap controls
figure5

figure6
Okay, so we have two maps to blend together: Ground and Snow. The text file that ships with Terrain Material doesn't explain much about the controls, but most are pretty straightforward. I started by setting the coordinate system at the bottom to Object. This way, it doesn't matter where in world space your terrain exists. For example, if you had the snow set to start 3/4 the elevation of the mesh and your coordinates were set to world, it wouldn't even look at your mesh to reference the distance, instead it would look to see where your mesh was located in world space. It's sort of like the difference between using XYZ and UVW for procedural maps.

For Elevation, I started with 0 for start and 100 for end. This gives us a simple range to play with. For Slope I set start at 40 degrees and End at 90 degrees. Each Transition value I set to 5. Now what this should do is look at the mesh and where the mesh slopes between 40 and 90 degrees it will retain the rocky ground map and areas with less of a slope angle will collect snow. The elevation value will control where the snow starts to appear. Right now, with 0 to 100 set for Elevation the snow is only showing up on the uppermost peaks. To bring the snow level down lower set the Start to -25. The Transition settings can be adjusted too. The higher the number the more gradual the blending between the two textures.

things to futz with
Again, the documentation is rather vague, so I suggest playing with the settings for the Cap Controls. Of course a lot depends on the materials you chose to blend between. I highly recommend you download Johnny's example terrain file. In his example he's nested a couple Terrain Materials, one for rock, one for grass and one for snow. The blending between all three allows you to create very realistic patches of foliage too.

next month
Okay, so by now you should have already modeled the terrain of your choice and now you can spend the next few weeks texturing it to your liking. Next month I'll wrap up with another detailed tutorial explaining how to finish your terrain by lighting your scene and creating atmosphere and clouds. Until then, drive on and keep creating!


Brandon Davis is the producer of ParticleFX (www.particlefx.com), a web resource for 3D Studio MAX users, and can be reached by email at brandon@particlefx.com.


[ galleries | archives | downloads | about | contacts ]
[ back to main page | back to contents page ]