Sign in to follow this  
cragwolf

OpenGL terrain textures

Recommended Posts

My first and last OpenGL project involved a terrain that wasn't very large. It was 64x64 vertices, and generally you could see most or all of the terrain at once. I used a single 512x512 texture to cover it all. A single texture was enough in this instance because the terrain was so small. And the camera never got too close to the terrain (it was a god-like view common in RTS games). Now, for my second project, I want to deal with a much larger terrain. Maybe 256x256 vertices. Maybe more. But a 512x512 texture isn't going to cut it, and I'm not going to be using texture sizes much larger than that! I'm not sure about this but I may decide to keep the view top-down and restrict the zoom level so that I'm only showing a small part of the terrain. Now I've heard of splatting, and I know where to find info about it, but are there any other texture techniques for my project? Are there simplifying aspects to having a top-down view showing only a small portion of the map at once?

Share this post


Link to post
Share on other sites
A very very simple and easy to implement method for increasing the realism of your terrain is by adding a detailed texture.

Terrain with no detailed texture:


Terrain with detailed texture:


The detailed texture is a small texture, 64x64, that you will tile across the entire terrain. It needs to be very grainy/rough for it to work.

Hope that helps. It's probably the simplest method for drastically improving the way your scene looks :)

Share this post


Link to post
Share on other sites
I didn't realise that a detail texture would make it look so good. If possible, can you show me what the detail texture looks like, by itself? Not rendered on the terrain, just a 64x64 pixel image of the detail texture itself. Put some logo on it if you don't want people to steal it. I just need to get some idea of what the detail texture should look like.

Share this post


Link to post
Share on other sites
Quote:
Original post by cragwolf
I didn't realise that a detail texture would make it look so good. If possible, can you show me what the detail texture looks like, by itself? Not rendered on the terrain, just a 64x64 pixel image of the detail texture itself. Put some logo on it if you don't want people to steal it. I just need to get some idea of what the detail texture should look like.


Its easy its a Greyscale image saved as RGB. I am sure you can use 8bit if you want but I use RGB for my code. If you need some code to detail texture after you get multi-texturing up and going here it is...


//this is to setup the detail texture

glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[DETAIL_TEXTURE]);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2);

//this is to shutdown the texture unit
glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);



HTH...

Share this post


Link to post
Share on other sites
Yep, all I did was comment out 1 line of code to go from the 2nd image to the first one.

Here is the detail texture I use on that terrain. It is actually 512x512 (but that is pretty arbitray. It would work 64x64 just as well), tiled over the entire terrain. The terrain images are 1024x1024, stretched over the entire plane.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this