When you perform the diffuse term per pixel (N dot L) then that IS what you are calling dot3bump. They are not two unrelated things. You can do diffuse+specular on a perpixel basis in a single pass with GeForce 3 level of hardware or up. I would recommend using the texture shaders and HILO texture formats. The nvidia opengl sdk demo section has countless demos doing just this. Check here: http://cvs1.nvidia.com
BTW, the ATI Radeon 8500 level hardware and up and also do this but since I never had a Radeon I’m not sure what extensions to use. Besides ARB_fragment_program for the newer ones.
-SirKnight
[This message has been edited by SirKnight (edited 08-09-2003).]
Originally posted by SirKnight: BTW, the ATI Radeon 8500 level hardware and up and also do this but since I never had a Radeon I’m not sure what extensions to use. Besides ARB_fragment_program for the newer ones.
Yeah I like I said, this kind of thing on at least GeForce 3 level hardware can be done in a single pass. Using Texture Shaders with Register Combiners with HILO textures would be your best best, unless you can support ARB_fragment_program. That page, and many others, show the math needed for this, now what you need to do is learn how to use your hardware to do what you want. It sounds to me you still don’t know much about your hardware, because doing this is actually not all that diffucult to do (when all the math is presented right there) if you know how to program the GPU.
Actually you can easily do it with ARB_texture_env_combine, too.
What that tutorial has is just normal dot lightvector, but as long as you have the texture units available you don’t have to stop there. Since you mentioned you have 4 texture units, just add another texture env operation that multiplies the colour map with the result of the previous tex env operation (making sure to bind the texture and setup the texture coordinates for that 3rd texture unit as well, of course).
//Send texture coords for normal map to unit 0
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer(2, GL_FLOAT, sizeof(TORUS_VERTEX), &torus.vertices[0].s);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
//Send tangent space light vectors for normalisation to unit 1
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glTexCoordPointer(3, GL_FLOAT, sizeof(TORUS_VERTEX), &torus.vertices[0].tangentSpaceLight);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
//Send texture coords for colour map to unit 2
glClientActiveTextureARB(GL_TEXTURE2_ARB);
glTexCoordPointer(2, GL_FLOAT, sizeof(TORUS_VERTEX), &torus.vertices[0].s);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
//Set up texture environment to do (tex0 dot tex1)*color
glActiveTextureARB(GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glActiveTextureARB(GL_TEXTURE1_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_DOT3_RGB_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
glActiveTextureARB(GL_TEXTURE2_ARB);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
glActiveTextureARB(GL_TEXTURE0_ARB);