# nvidia register combiners and multipass

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?

tia.

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
LaBasX2

blendfunc ne,zero
blendfunc:dstcolor,zero
framebuffer *= C
blendfunc ne,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…

****in smilies

HUH?!

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.

Nutty

Oops!!

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

Nutty

Yup I meant the previous eqn
((A dot B) * C) + D

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

thx all.