PDA

View Full Version : multitexture blending question



soconne
10-12-2003, 04:24 PM
How do you get rid of this darken effect when blending 2 textures using GL_INTERPOLATE_ARB? Here's a screenshot http://cs.selu.edu/~soconnell/blend.jpg

I can't seem to figure out how to make this go away, here's the blending code.


glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, rock);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);


glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, alphamap);


glActiveTextureARB(GL_TEXTURE2_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, grass);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_RGB_ARB,GL_INT ERPOLATE_ARB);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_RGB_ARB,GL_TEX TURE0);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SR C_COLOR);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_RGB_ARB,GL_TEX TURE2);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND1_RGB_ARB,GL_SR C_COLOR);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE2_RGB_ARB,GL_TEX TURE1);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND2_RGB_ARB,GL_SR C_COLOR);


Any ideas?

soconne
10-12-2003, 08:02 PM
Well I found out that if you place the alpha values in glColor4f calls for each vertex, then the transition from one texture to another results in no darkening of the texture.

But the way I'm doing it, is that let's say I have one quad, then I can have a bitmap with different rgb values specifying anywhere on that single quad to let another texture blend through. That's the result of the screenshot above. So why does this method result in darkening, but passing alpha values with glColor4f does not?

sqrt[-1]
10-12-2003, 09:54 PM
Could you possibly post a screen shot of just the output of per-vertex colors vs just the output of the alpha texture?

Could you also try and use flat red for rocks and flat green for grass? (May be easier to figure out if something is going wrong when using different flat colors)

Also what video card do you have?