View Full Version : Register combiner math question

02-28-2002, 09:47 AM
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 http://www.opengl.org/discussion_boards/ubb/frown.gif. I want to be sure, though, as it's the difference between being GF2 and GF3 compatible.

-- Zeno

02-28-2002, 10:00 AM
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?..

02-28-2002, 10:05 AM
Well, for now, tex1 is GL_LUMINANCE only, but I'm not sure that I can guarantee that in the future....

-- Zeno

Martin Kraus
02-28-2002, 10:28 AM
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

02-28-2002, 12:12 PM
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.r*tex0.r*tex1.r*const0.r + col0.g*tex0.g*tex1.g*const0.g + col0.b*tex0.b*tex1.b*const0.b

refactor this and you get:
(col0.r*tex0.r, col0.g*tex0.g, col0.b*tex0.b) dot (tex1.r*const0.r, tex1.g*const0.g, tex1.b*const0.b)

refactoring again, and you get:
(col0*tex0) dot (tex1*const0)

This can be done in 2 general combiners:
Combiner 1: A*B->spare0, C*D->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).]

02-28-2002, 01:10 PM
Thanks Kronos. You rule http://www.opengl.org/discussion_boards/ubb/smile.gif

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

-- Zeno