GL_ARB_texture_env_dot3 / GL_EXT_texture_env_dot3 confusion

After experiencing the extreme brightness on GF3 card in my demo as discussed here I think I’ve nailed the problem down. It seams nVidia and ATi interprets the specification of GL_ARB_texture_env_dot3 differently.

From the ARB/EXT spec:

    COMBINE_RGB_ARB         Texture Function
    ---------------         ----------------
    DOT3_RGB_ARB            4*((Arg0_r - 0.5)*(Arg1_r - 0.5) +
                               (Arg0_g - 0.5)*(Arg1_g - 0.5) +
                               (Arg0_b - 0.5)*(Arg1_b - 0.5))

                            This value is placed into all three
                            r,g,b components of the output.

The only difference between the ARB and EXT spec is that ARB allows postscaling. It seams as ATi interpreted this as RGB_SCALE_ARB replaces the constant 4 in the expression above while nVidia kept the constant 4 and then multiplied with with RGB_SCALE_ARB, which makes everything 4 times as bright on nVidia cards than on ATi. As the spec is reading now I would say that nVidia is doing it like the spec says, but since the spec is more or less a cut’n’paste work of the original EXT spec which originates from ATi I’m not sure if this was the original intent.
Anyway, seams like I should use the EXT version in the mean time to get consistent results from both vendors until this issue is ironed out and someones drivers is updated.

[This message has been edited by Humus (edited 02-23-2002).]

I think it’s pretty clear with the current spec that an additional scaling step happens. Additional language would be required if this were not to be the case, and such language is not present.

The 4*… method of writing out the dot product is somewhat counterintuitive, for this reason. I prefer the “(2x_0-1)(2*x_1-1)” method.

  • Matt

Yeah, that’s about my thoughts too, guess ATi will hear from me again

What is beyond me though is why this hasn’t been discovered before, am I the only one that uses the GL_ARB_texture_env_dot3 extension?
ATi’s drivers have worked this way a long time, as long as I can remember, so I’ve never questioned how it works, just remember that when I moved over from EXT to ARB everything got much darker, and I just though like “oh, now I have to scale by 4 myself” and never really read the spec too deeply. Guess I’ll have to recompile a lot of stuff I’ve been doing, since they expect a scale by four to be acting like a scale by 1. Oh, well …

Well, most people interested in doing something involving Dot3-type things are probably using either NV_register_combiner or ATI_fragment_shader. So I wouldn’t be the least bit surprised if ATI’s Dot3 drivers had a bug in them.

Yeah, I suppose, but there’s gotta be someone more than me that cares for compatibility with older cards, such as Radeon 7xxx and Kyro. I’m doing diffuse lighting with the dot3 extension, which enables it to run at least on the Radeon 7xxx too (need 3d textures too, thus no GF1/2/Kyro right now), even though it doesn’t get any specular lighting.