# Register combiner math question

Is it possible to perform the following combiner math with 2 general combiner stages plus the final combiner stage:

out.rgb = (col0 * tex0 * tex1).(const0) * const1

I don’t think it is because you have to multiply the first three terms in serial, right? That alone eats two stages . I want to be sure, though, as it’s the difference between being GF2 and GF3 compatible.

Thanks,
– Zeno

out.rgb = (col0 * tex0 * tex1).(const0) * const1

hm… nope, not in this form…

are col0,tex0 and tex1 all rgb or is one only a one-component value?..

Well, for now, tex1 is GL_LUMINANCE only, but I’m not sure that I can guarantee that in the future…

– Zeno

Hi ,
actually , if tex1 is luminance it is possible
because then you can rewrite the expression as :
out.rgb = (col0 * tex0 ).(const0) * const1 * tex1
you can calculate (col0 * tex0) in combiner0 rgb
then you do the dot product in combiner1 rgb
and const1 * tex1 can also be done there .
Then all that`s left is multiplying the two temporaries in the final combiner
hope that helps ,
Martin Kraus

Yes, you can do it
(col0 * tex0 * tex1)
really means
(col0.r * tex0.r * tex1.r, col0.g * tex0.g * tex1.g, col0.b * tex0.b * tex1.b)

dot this with const0, and you get
col0.rtex0.rtex1.rconst0.r + col0.gtex0.gtex1.gconst0.g + col0.btex0.btex1.b*const0.b

refactor this and you get:
(col0.rtex0.r, col0.gtex0.g, col0.btex0.b) dot (tex1.rconst0.r, tex1.gconst0.g, tex1.bconst0.b)

refactoring again, and you get:
(col0tex0) dot (tex1const0)

This can be done in 2 general combiners:
Combiner 1: AB->spare0, CD->spare1
Combiner 2: spare0 dot spare1

Then the final combiner, multiple const1 by the result of combiner 2.

[This message has been edited by LordKronos (edited 02-28-2002).]

Thanks Kronos. You rule

I’m embarrased that I was too lazy to multiply it out myself and check for re-grouping of terms.

– Zeno