Original Post
Hello, short question this time:
I'm trying to do dot3 bump mapping. I have a normal map which contains the normals for each pixel encoded in it - X, Y, Z into R, G, B. This is pretty standard procedure I think.
The tutorials I've seen go into complicated math on creating another map which contains the vector to the light at each pixel (from what I understand, which is not much). "Well, no problem," I thought, because I'm using only a flat plane and a single infinite light source. So I thought I'd cheat by loading a premade texture that is just gray and use that for the light vector map.
The trouble is, I don't really understand what all these commands do, and all I get is pure white. Here is the code:
glBindTexture(GL_TEXTURE_2D, waterbumps[0]); //waterbumps[0] contains GL name of normal map glEnable(GL_TEXTURE_2D); glActiveTextureARB(GL_TEXTURE1_ARB); glBindTexture(GL_TEXTURE_2D, textures[TEX_LIGHTMAP]); //this contains the gray map //glEnable(GL_TEXTURE_CUBE_MAP_ARB); glActiveTextureARB(GL_TEXTURE0_ARB); //Set up texture environment to do (tex0 dot tex1)*color glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE); glActiveTextureARB(GL_TEXTURE1_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_DOT3_RGB_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB); glActiveTextureARB(GL_TEXTURE0_ARB);which was pretty much ripped from Paul's tutorial at http://www.paulsprojects.net/tutorials/simplebump/simplebump.html and then modified to use the premade gray texture instead of the calculated light vector map. I'm totally lost - anything anyone could give me (like a document on what these commands do for beginners) would be awesome. It seems like given the fact that it's an infinite light source, this should be simple. But of course, it isn't :-) If anyone has an easier way, I'm all ears. EDIT - edited source because I pasted it wrong... [edited by - DuckWizard on May 16, 2004 10:45:31 AM]