Smooth Texture Transitions

Started by
2 comments, last by CraigL 20 years, 11 months ago
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.
Advertisement
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]
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.
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.
- To learn, we share... Give some to take some -

This topic is closed to new replies.

Advertisement