Frumpy
04-17-2001, 09:59 AM
I am experimenting with bump mapping using quantized normal maps. The last step in the procedure generates a one component bitmap (greyscale bitmap) of unsigned bytes. Dark areas are pixels facing away from the light source, light areas are pixels facing the light source and grey areas are somewhere in between.
I want to multiply each pixel of my greyscale map with its corresponding pixel in the diffuse map using multipass texturing. Lets say r0, g0, b0, a0 represent a pixel from the diffuse map, n0 is a pixel from the greyscale bitmap and r1, g1, b1, a1 is the result. In the end here's what I'm looking for:
r1 = r0 * n0
g1 = g0 * n0
b1 = b0 * n0
a1 = a0
So far I've done all the multipling in software and using OpenGL simply to draw the resulting bitmap. Everything works but slow. I now want to draw the diffuse map in one pass and the greyscale map in another pass and let my video card do all the multipling in hardware. Is this possible?
My attempts so far produce either alot of nothing or an inverted bumpped greyscale and no diffuse map. Please help.
Should I draw the greyscale first or the diffuse?
What should I use for glTexEnv(,,?) for the greyscale?
What should I use for glTexEnv(,,?) for the the diffuse?
Do I need to use blending?
What should I use for glTexImage2D's internalFormat and format parameters for the greyscale map?
Thanks in advance.
I want to multiply each pixel of my greyscale map with its corresponding pixel in the diffuse map using multipass texturing. Lets say r0, g0, b0, a0 represent a pixel from the diffuse map, n0 is a pixel from the greyscale bitmap and r1, g1, b1, a1 is the result. In the end here's what I'm looking for:
r1 = r0 * n0
g1 = g0 * n0
b1 = b0 * n0
a1 = a0
So far I've done all the multipling in software and using OpenGL simply to draw the resulting bitmap. Everything works but slow. I now want to draw the diffuse map in one pass and the greyscale map in another pass and let my video card do all the multipling in hardware. Is this possible?
My attempts so far produce either alot of nothing or an inverted bumpped greyscale and no diffuse map. Please help.
Should I draw the greyscale first or the diffuse?
What should I use for glTexEnv(,,?) for the greyscale?
What should I use for glTexEnv(,,?) for the the diffuse?
Do I need to use blending?
What should I use for glTexImage2D's internalFormat and format parameters for the greyscale map?
Thanks in advance.