Using multiple textures for terrain rendering

I have a question/problem that I was hoping someone else could help me with…

I’m working on rendering some terrain/landscape. Currently I’m setting vertex colors based on height, (shades of green at low elevations going to brown and then white at the highest elevations.) I then apply a tiled texture and modulate it with the vertex colors.
While it looks okay, it doesn’t thrill me much. I was thinking about a couple of options, using multiple textures for the grid. Basically I would use different texures for mts (more rock looking) and more grassy looking textures for the plains but I’m not sure how to do this without having obvious seams when I switch to a different texture. And for that matter I’m not sure how to switch textures in the middle of a tri-strip. (is there a performance hit?)

The other thought I had is using the original height field to generate one texture (pre rendering), since I know the elevation I can then have this created texture reflect the topoloty, but the problem here is I’m not sure if using one texture for a large terrain (80x80) grid will look good up close. Or how big I should make it.

Maybe I just need some better textures to use.
Any help, suggestions, resources etc would be appreciated.


As far as using different textures within a tri_strip. You can’t. You have to break it into two strip. To hide the seam, you can alpha blend two textures on the boundary bewteen two texture types. You can arrange it so that one texture appears to gradually and irregularly fade into the next texture.
And I doubt the single texture approach would look pleasing except for all but the smallest terrains. To look pleasing you’d surely need a texture larger than 256x256, which some video cards can not handle. Carefully tiled textures would work fine homwever.

I’ve been trying to implement the gradual fade between textures, but seem to have hit a brick wall! Any hints as to go about it? I’m assuming you set the alpha value of each vertex procedurally, but the only way i’ve been able to make this method work is to draw the triangle twice in the same spot… This seems to be a bit of a waste! Is there any way of drawing only 1 triangle but use the two textures?

  • Phrantik

The question above raises another question that is somewhat related.

Say I’m drawing a series of Tristrips that had different colors between some of the vertices, (basically making a terrain mesh with a row of tri-strips.

In some cases I want the color to fade/blend between vertices (it is doing this now). But in some cases I don’t want the color to blend. The case in point is for water. It looks odd when the water areas blend in with the grass areas going uphill

Any thoughts on this?

Phrantik, look into the multitexture extensions (GL_ARB_multitexture), and the combiner extension(GL_EXT_tex_env_combine). If both of these extensions are available, you can use the INTERPOLATE_EXT combine operation to blend the textures in this way in one pass.

elroy, are you drawing the water surface as part of the landscape mesh, or is it a smaller mesh that is rendered on top of a depression in the landscape mesh? If it is an additional mesh, you shouldn’t have this problem.

[This message has been edited by DFrey (edited 06-29-2000).]

Thanks DFrey, most appreciated!

Wouldn’t 3D texturing suit for what elroy wants to do ?

Take a look at You can find a very well method to texture your terrain. It gonna look great!