terrain splatting texture problem

My geomipmap terrain is rendered using multi-pass splatting texture if the patch is close enough or single base texture which has only one pass and one texture stage if the patch is far enough. This is all Ok. The problem is, when i apply fog, the patches using different render method looks not the same. The multi-pass patch looks like have less deep fog.
Screen shot: http://www.websamba.com/simpleengine/download/a.jpg

You make want to make sure you’re including the Primary Color with each texture splat you are doing.

Here is how I do it in my terrain for each layer.

  
 glActiveTextureARB(GL_TEXTURE0);
                glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
                glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE0);
                glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
                alphamap->bind();

 glActiveTextureARB(GL_TEXTURE1);
                        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
                        glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
                        glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PRIMARY_COLOR);
                        glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
                        glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE1);
                        glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
                        glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE0);
                        glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
                        glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_TEXTURE0);
                        glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA);
                        imagemap->bind();

Hope this helps.

Thank you for your reply. My algorithm is similar to you. Here is my algorithm:

for every splatting pass i {
Stage0.TEXTURE = alpha;
Stage0.ALPHA = REPLACE(texture)
Stage1.TEXTURE = splat
Stage1.RGB = MODULATE(texture, previous.alpha)
if (i > 0) {
AlphaBLend = (ONE, ONE)
ZWrite = off
}
else {
AlphaBlend = off
ZWrite = on
}
}

Finally the lightmap pass:
Stage0.TEXTURE = lightmap;
Stage0.RGB = MODULATE(texture, previous)
AlphaBlend = (DstColor, 0)

with FOG enabled, the more passes rendered, the fog is more deep. I’v tried only enable the FOG at the first pass or the last pass, neither does it work.

So what is the correct way to deal with FOG for multipass rendering? Or i must use the same pass count for FOG?

Yeah I have problems doing fog as well. The fog gets blended together for each pass and becomes more intense. I can’t figure how to get pass this.

Originally posted by oconnellseanm:
Yeah I have problems doing fog as well. The fog gets blended together for each pass and becomes more intense. I can’t figure how to get pass this.
Thanks. I’v solved this problem :slight_smile:
http://p214.ezboard.com/fmrgamemakerfrm0.showMessage?topicID=3969.topic

                                   gaoyakun.