I want to set up this equation:
(A dot B) * C + D
where A and B are vector maps, C and D are texture maps, so all 4 need their own texture units.
I’m using a geforce2, so I only have 2 texture units to play with. Is it possible to perform the equation in 2 passes? One pass to perform (A dot B) and another pass to perform the rest?
If so, how do I store the results of (A dot B) without taking up another texture unit?
I don’t think that it is possible to do that operation in 2 passes. I think you will need 3 passes. Store (A dot B) in the alpha buffer. Multiply the alpha buffer with C and add the result to the color buffer. Then add D to the color buffer. If your equation is for lighting calculations you could even add several lights using this alpha buffer technique.