Sign in to follow this  

Terrain Texturing

This topic is 3810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am now doing a terrain from heightmap, and using shaders-based multi-texturing. Basically, the weightage of each texture being blended on a polygon is dependent on its height. Is there anyway I can use the same concept to do a terrain editor, something like the WC3 Map Editor or the Age of Wonder II map editor, where you can pretty much paint any texture you want? Right now, for multi-texturing, I already have 4 textures load...would using the same technique cause any resources management problem? Is it possible to accomplish this by having a separate bitmap and using its color value to determine which texture to use for a particular patch of terrain? Thanks in advance!

Share this post


Link to post
Share on other sites
I'll answer your second question only because that's the only one I know about (I havent used either terrain editor).

The way I texture terrains is a method called "Texture Splatting" (Google it). I use a shader, with 6 textures bound to it. The first 4 are actual terrain textures (ie: grass, sand, rock, and dirt), the 5th is a 32 bit (RGBA) map to tell the shader which texture to blend (must have linear filtering), and the 6th is a normal/lighting map of some sort.

Then it's easy. if you're using OpenGL and GLSL, it's just
texmap = texture2D(tex5, coord).rgba;
outcolor = texture2D(tex1, coord).rgb * texmap.r + texture2D(tex2, coord).rgb * texmap.g + ... + texture2D(tex4, coord).rgb * texmap.a;

Hope that helps you some
~Zix

Share this post


Link to post
Share on other sites
Quote:
Original post by zix99
I'll answer your second question only because that's the only one I know about (I havent used either terrain editor).

The way I texture terrains is a method called "Texture Splatting" (Google it). I use a shader, with 6 textures bound to it. The first 4 are actual terrain textures (ie: grass, sand, rock, and dirt), the 5th is a 32 bit (RGBA) map to tell the shader which texture to blend (must have linear filtering), and the 6th is a normal/lighting map of some sort.

Then it's easy. if you're using OpenGL and GLSL, it's just
texmap = texture2D(tex5, coord).rgba;
outcolor = texture2D(tex1, coord).rgb * texmap.r + texture2D(tex2, coord).rgb * texmap.g + ... + texture2D(tex4, coord).rgb * texmap.a;

Hope that helps you some
~Zix


Thanks for the idea, but what if there is more than 4 textures? Would it end up hogging lots of resources?

Share this post


Link to post
Share on other sites
Ya, it could depending on the size of the textures and the size of the terrain. You may have to swap back and fourth from the HD and the graphics VRAM. I'm sure there are tutorials out there that could explain it better than I could. I'm also sure there are more efficient methods of doing splatting for more than 4 textures.

Share this post


Link to post
Share on other sites

This topic is 3810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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