I first saw this on Serious Sam(first or second encounter... don`t remember
). And now it`s fairly used in games like Unreal and the like. Basicly we have a diffuse map, a detail map, and a lightmap.
After seeing what the env_combine funcs can do, I came up with the idea for that
1 texture unit->Base Map*Detail Map(actually I use the GL_INTERPOLATE_ARB, but can`t figure out where to best put the Detail Map)
2 texture unit->LightMap
This is what I use for that stuff ->
//
glActiveTextureARB(GL_TEXTURE0_ARB);
//
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_RGB_ARB,GL_INTERPOLATE_ARB);//
// now setup Arg0
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_RGB_ARB,GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SRC_ALPHA);
// now setup Arg1
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_RGB_ARB,GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND1_RGB_ARB,GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE2_RGB_ARB,GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND2_RGB_ARB,GL_SRC_COLOR);
//
glActiveTextureARB(GL_TEXTURE1_ARB);
//
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_RGB_ARB,GL_MODULATE);
// now setup Arg0
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_RGB_ARB,GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SRC_COLOR);
// now setup Arg1
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_RGB_ARB,GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND1_RGB_ARB,GL_SRC_COLOR);
My problem is-> If I`d normally use 3 texture units to make this stuff(and I wouldn`t bother anymore), everything would be just fine, but this way I won`t be able(or don`t know how to) scale the alpha map(which is the Detail Map), any help would be apreciated
Edit:To clarify-> I mean I can`t use the
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(size,size,size);
glMatrixMode(GL_MODELVIEW);
to show detail upclose
[edited by - cippyboy on June 1, 2004 12:33:48 PM]