Advertisement

Register Combiners problem

Started by October 13, 2004 03:10 PM
2 comments, last by vincoof 20 years, 4 months ago
i'm slowly becoming mad. I've set up register combiners to do diffuse light and works fine. I use tex0 for normal map, tex1 for cube map and tex2 for decal texture. So i should do tex2 * (tex0 dot tex1) right? Here's the code:

//1 general combiner
glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);

//combiner 0 does	tex0.rgb dot tex1.rgb -> spare0.rgb,
glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE0_ARB,GL_EXPAND_NORMAL_NV, GL_RGB);
glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE1_ARB,GL_EXPAND_NORMAL_NV, GL_RGB);
glCombinerOutputNV(	GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV,GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE);

glFinalCombinerInputNV(GL_VARIABLE_A_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_TEXTURE2_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glFinalCombinerInputNV(GL_VARIABLE_C_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glFinalCombinerInputNV(GL_VARIABLE_D_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);


i've tryied this and works. Now all i want to do is to add some attenuation (tex3) . I've created a 3d texture and now all i should do is: tex2 * ( tex3 * (tex0 dot tex1) ) , is this right? So i've changed the final combiner this way:

//do constant spare0*tex2 in the EF multiplier
glFinalCombinerInputNV(GL_VARIABLE_E_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glFinalCombinerInputNV(GL_VARIABLE_F_NV, GL_TEXTURE2_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);

//do tex3*spare0*tex2
glFinalCombinerInputNV(GL_VARIABLE_A_NV, GL_TEXTURE3_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glFinalCombinerInputNV(GL_VARIABLE_C_NV, GL_E_TIMES_F_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glFinalCombinerInputNV(GL_VARIABLE_D_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);


but nothing changes! what's wrong?
I don't know why it doesn't work, but I know something's wrong in your code.

By submitting TEX3 to A, zero to B, E*F to C, zero to D, SPARE0 to E and TEX2 to F, then the final RGB fragment is :
A*B+(1-A)*C+D
that is :
TEX3*zero+(1-TEX3)*(E*F)+zero
that is :
(1-TEX3)*SPARE0*TEX2
that is :
(1-TEX3)*(TEX0 DOT TEX1)*TEX2

so if you want TEX3*TEX2*(TEX1 DOT TEX0) you should set E*F to B and zero to C.
Advertisement
now the screen is black o_O
i'm sure the 3d texture works because if i compute tex3*tex2*(tex0 dot tex1) using opengl extensions everything goes as it should.. so what could be?
Can you host a zip file containing source code + executable please ?
Since it "should" work, I hardly think why it fails just like that.

Also, what's your graphics card / OS / driver version combo ?

This topic is closed to new replies.

Advertisement