simple register combiner question

sorry for posting such a simple question - the documentation for register combiners did not yield the secrets i need…

texture unit 0 is a normal 2D/3D texture fetch
texture unit 1 is AR dependent on unit 0, producing R1G1B1A1
texture unit 2 is GB dependent on unit 0, producing R2G2B2A2

i want the final RGBA color to be the AR from the stage 1 fetch, and the GB from the stage 2 fetch.

i.e. R1G2B2A1 -> RGBA

i know there might be a way to do this with CG or RC1.0 using .rgb swizzle notation, but what is the equivalent glFinalCombinerInputNV function call?


is there any good documentation for register combiners in general? the specs just don’t lend themselves to intuitive real-world examples.

is there an in-general way to do swizzle type stuff with the combiners?
finalcolor.r = unit1.r
finalcolor.g = unit2.g
finalcolor.b = unit2.b
finalcolor.a = unit1.a

check out, he’s go a terrain demo that uses register combiners that blends between different textures depending on the alpha values of each vertex. That is if this is what you’re going for.

It’s been a while since I touched these extensions, but I dont recall anything about swizzling with reg_comb (1 and 2)
The kind of swizzling you can do there is sample BLUE from the ALPHA combiner, which is limited.

You should look into NV_texture_shaders. have fun!

Well, perhaps I don’t completely understand your question, but what you ask is pretty obvious: finalColor=(1,0,0,1)*tex1+(0,1,1,0)*tex2

static const float c0[]={0.000000f,1.000000f,1.000000f,0.000000f};

thanks. this is what i was looking for. i’ll have to try it out.

sometimes it just takes a simple example to get the snowball rolling…

one more thing…

how does the result of combiner 1 get mapped to the final pixel color? is it implicit in the combiner state?

as far as i can tell, each combiner outputs several rgba vectors, so how do you say which is used for the final color. also, is the Final Combiner always used, even if you say you are only using 1 general combiner, or is it implicitly included in the NUM_CONBINERS count?

The final combiner is always active, and is not included in NUM_GENERAL_COMBINERS.

The final combiner is also responsible for mapping register contents to the final fragment color. I think in the default state the final combiner sources from SPARE0_NV (haven’t checked that though, it’s somewhere in the extension spec). So AFAICS h2’s code should work.

i checked the specs and i think you both are right (it’s hard to tell - the specs aren’t exactly crystal clear in this respect).

it would be so lovely if there was a set of docs that gave several example equations to be computed and the corresponding combiner states. i guess this is all moot since we have nvparse and Cg, but i’ve always felt that understanding things at the most basic level helps the understanding at higher levels…

The final combiner is setup initially to implement OpenGL 1.2’s standard color sum and fog stages.

Table NV_register_combiners.6 shows exact setup. If for some reason you want to set output to SPARE0_NV explicitly, add following


[This message has been edited by h2 (edited 11-13-2003).]