#### Archived

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

# help with multitexture blending

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

## Recommended Posts

I am having huge problems getting my blending to turn out the way I want it. I have 3 base textures that are repeated across my terrain. I also have an alpha map for each of them to make them blend into each other. This lets me make one pass for each terrain type and it should come out nice and pretty, but I just can''t get the blending to work. Can anyone help me with these glTexEnvs? First, my blending function:
	glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); 
TexEnvs for the first texture (repeating base texture):
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE); 
TexEnvs for the alpha textures:
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_ADD); 
I know this has been asked before on this forum but my search didn''t find any decent answers .

##### Share on other sites
After more searching I realize what I had before makes absolutely no sense . Here's what I have now:

Blend function:
        glBlendFunc(GL_SRC_ALPHA, GL_ZERO);

Texture 0 env:
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);	glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);	glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);

Texture 1 env:
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);	glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);	glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE);	glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);	glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);	glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);

These are the mods I got from another post which was asking the same thing as I am. It doesn't work . The textures are just applied as if there is no alpha at all but I don't understand why. It really seems like those blending functions should work.

[edited by - Raloth on August 18, 2003 11:58:34 AM]

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632960
• Total Posts
3009476
• ### Who's Online (See full list)

There are no registered users currently online

×