Detail textures....

Can anyone point me to a tutorial explaining the basic method of creating detail textures?

I’ve written a terrain assembling tool for Delta Force (3). Now i would like
to also display the needed detail textures.
Question is: how do i do it?

Or more detailed question:
The terrain itself is made from triangle strips using a heightmap (grayscale
PCX image, 1024x1024)
The terrain’s main texture is 1024x1024 in size and planar mapped from top.

How can i apply a second uvw channel to the terrain geometry?

How do i render a detail texture (256x256 grayscale) onto the terrain, so
that it fades out when the user is too far away from the geometry (like seen
in SOF, Quake, Unreal X)?


I can think of two different ways, one very easy and the other requiring a bit of work:

Both methods require either multi-pass or multi-texture for the detail texture application, so first your application framework needs to support both. You’ll need to support both for those consumers that have video cards that don’t support multitexturing.

The easy method is to always apply the detail texture to your terrain- but the detail texture is RGBA and has a mip map chain that fairly quickly ramps the alpha channel in the texture to fully transparent. This is a quick and dirty method that you can use to get the basic framework operating of your terrain having multiple UV channels, but probably not good enough for a shipping product.

The next method requires a bit of work, because you need to have some method of identifying the verticies of the geometry near the camera. This method only uses an RGB detail texture, because you’ll be providing the alpha information with the verticies. First you need to identify the verticies within some range of the camera (some range that you can tweak) and then set the alpha value of the verticies to some value that grows transparent with distance from the camera. These verticies are poly verts that you’ve identified as being within the “detail range” of your camera- you’ll simply be specifying an additional pass for those polys or doing this work early enough that you can mark those polys to not render with the rest of the terrain and you render them with multiTexturing afterwards.

You may want to check out the archives of the GDAlgorithms mailing list for discussions of this topic. I forget when those conversations took place, but quite a bit of detail was discussed.


I’ve done it using the multitexture extension (it’s a gamer tool so i just leave people without mt-boards out for now). Works pretty good, and i can even dynamically adjust the tiling rate and switch between different slot-1-textures…

but thank you very much for your help, you gave me just more ideas for improving it =)

u might look at using GL_LUMINANCE for the detail textures, i get a 20% speed increase overall (for the whole engine thus its higher than 20%) from using them.