Archived

This topic is now archived and is closed to further replies.

Smooth Texture Transitions

This topic is 5334 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

I noticed in most games with terrain there usually occurs a smooth transition between two different kinds of textures, and it usually looks like the two textures are randomly blended somehow. Does anyone know how this is done? Thanks.

Share this post


Link to post
Share on other sites
there are three ways.

a)

multi-pass render the terrain.
ie, use a second pass using alpha blending.. with alpha values representing the transition factor.

b)

use multi-texturing and GL_ARB_texture_env_combine.
and use the GL_INTERPOLATE_ARB blend mode.
you will need to read up a lot on this though. so don't jump in.


c)

I have ideas about how it could be done with 3d textures, but there are issues. so yeah

| - Project-X - my mega project.. close... - | - adDeath - | - email me - |

[edited by - RipTorn on May 7, 2003 3:05:26 AM]

Share this post


Link to post
Share on other sites
Thanks for the reply. I gave option b) a try. It didn''t seem to do anything however. I wrote a small program with draws two textures on a quad to see how the would interpolate but only the second texture shows up. Is there something wrong with my texture environment modes?

glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
Texture1->Bind();
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
Texture2->Bind();
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_RGB_EXT,GL_INTERPOLATE_EXT);

Thanks.

Share this post


Link to post
Share on other sites
gl_tex_env_combine works on the basis of utilizing a ''source'', an ''interpolant'', and a ''destination''. The first and last parameters are common in normal alpha blending with the interpolator being the vertex/texture alpha. However, with this extension, u can specify an arbitrary element as an ''alpha-map''.

In my terrain project, for instance, i have 4-layer texturing; 1 base, and 3 detail textures. the detail textures had no alpha info. Instead, blending info is extracted from (in my case) the mesh vertex color and alpha. Note that the alpha blending itself is not enabled.

when u setup the SOURCE0/1/2 and OPERAND0/1/2, i believe its the SOURCE2 & OPERAND2 that denote the blending information. I specified it to use the mesh color to blend detail 1+2, and the mesh alpha to blend the result of detail(1+2)+3. Its cryptic but thats the best could do for now.

In ur code sample, u have yet to specify these details for source and operand modifiers. see the documentation for the extension for more information. Or head to Delphi3D.net for a nice article on terrain texture blending using this extension.

Share this post


Link to post
Share on other sites