Allright… it works like this then.
thank you for this detail.
now i would like to implement a shadow_ambient like (ext which is not available on my FX5200).
Thus i saw from the shadowCast example from nvidia the func:
configCombinersForHardwareShadowPass(int withTexture)
{
glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 2);
glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, lightDimColor);
glCombinerParameterfvNV(GL_CONSTANT_COLOR1_NV, Ka);
/* Argb = one /
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
/ Brgb = constant0rgb = light dimming /
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
GL_CONSTANT_COLOR0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
/ Crgb = 1.0 - constant0rgb = 1.0 - light dimming /
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV,
GL_CONSTANT_COLOR0_NV, GL_UNSIGNED_INVERT_NV, GL_RGB);
/ Drgb = texture0rgb = unshadowed percentage */
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
/* spare0rgb = light dimming + (1.0 - light dimming) * unshadowed percentage */
glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
/* Discard entire Alpha combiner stage 0 */
glCombinerOutputNV(GL_COMBINER0_NV, GL_ALPHA,
GL_DISCARD_NV, GL_DISCARD_NV, GL_DISCARD_NV,
GL_NONE, GL_NONE,
GL_FALSE, GL_FALSE, GL_FALSE);
/* Argb = spare0rgb = light dimming + (1.0 - light dimming) * unshadowed percentage /
glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV,
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
/ Brgb = primary color = light’s diffuse contribution /
glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV,
GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
/ Crgb = constant 1 = Ka = ambient contribution /
glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_C_NV,
GL_CONSTANT_COLOR1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
/ Drgb = 1 */
glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_D_NV,
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
/* spare0rgb =
(light dimming + (1.0 - light dimming) * unshadowed percentage) * diffuse +
ambient */
glCombinerOutputNV(GL_COMBINER1_NV, GL_RGB,
GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
/* Discard entire Alpha combiner stage 1 /
glCombinerOutputNV(GL_COMBINER1_NV, GL_ALPHA,
GL_DISCARD_NV, GL_DISCARD_NV, GL_DISCARD_NV,
GL_NONE, GL_NONE, GL_FALSE, GL_FALSE,
GL_TRUE); / Use the MUX operation. */
if (withTexture) {
/* A = texture1 = decal /
glFinalCombinerInputNV(GL_VARIABLE_A_NV,
GL_TEXTURE1_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
} else {
/ A = one /
glFinalCombinerInputNV(GL_VARIABLE_A_NV,
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
}
/ B = spare0 /
glFinalCombinerInputNV(GL_VARIABLE_B_NV,
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
/ C = zero /
glFinalCombinerInputNV(GL_VARIABLE_C_NV,
GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
/ E = unshadowed percentage /
glFinalCombinerInputNV(GL_VARIABLE_E_NV,
GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
/ F = specular /
glFinalCombinerInputNV(GL_VARIABLE_F_NV,
GL_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
/ D = EF product = unshadowed percentage * specular contribution /
glFinalCombinerInputNV(GL_VARIABLE_D_NV,
GL_E_TIMES_F_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
/ RGB = A*B + (1-A)*C + D = (texture1 OR 1) * space0 + specular * unshadowed */
/* G = 1 /
glFinalCombinerInputNV(GL_VARIABLE_G_NV,
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
/ Alpha = 1 */
glEnable(GL_REGISTER_COMBINERS_NV);
//…
which use the depthmap in unit0.
Ok, i’m not really familiar with combiners so is it possible to modify this function when the depthmap is binded in the last unused texture unit? eg: unit0 is used with a texture and unit1 is the depthmap or unit0 and unit1 are textures and unit2 is the depthmap and so on… ?