View Full Version : nvidia register combiners and multipass

03-24-2002, 02:03 AM
Hi all,

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?


03-24-2002, 04:15 AM
You can use the alpha buffer to store the result of (A dot B). Fore more information see Ron Frazier's great tutorial:

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.

Hope that helps a bit

03-24-2002, 04:23 AM
blendfunc http://www.opengl.org/discussion_boards/ubb/redface.gifne,zero
framebuffer = AdotB
framebuffer *= C
blendfunc http://www.opengl.org/discussion_boards/ubb/redface.gifne,one
framebuffer += D

the only ways i can see use 3 passes, sorry..

only if C or D would be alpha-only, not color, then i would see a way..

03-24-2002, 05:16 AM
****in smilies http://www.opengl.org/discussion_boards/ubb/wink.gif

03-24-2002, 12:55 PM

You should be more explicit with your equations.

Using BODMAS ordering I assume you mean;

((A dot B) * C) + D

You can do (A dot B) * (C + D) in two passes, with 1 blend easily.

Simply in register combiners do

1st pass.
A Dot B, store in framebuffer.

2nd pass.
C * D, blend with framebuffer with DST_COLOR, ZERO.

Previous equation will require 3, as Dave said.


03-25-2002, 12:19 AM

That should've been GL_ONE, GL_ONE for the blend.


03-25-2002, 06:48 AM
Yup I meant the previous eqn
((A dot B) * C) + D

The link to Ron Frazier's paper helped a lot.

thx all.