PDA

View Full Version : 3D-textures - internal format



Jan
06-11-2003, 01:59 PM
Hi

i am new to 3D-textures, i just started to do some dynamic lighting with it.
Anyway, i started with a normal RGB texture. However since 3D-textures need so much memory, i switched to GL_LUMINANCE as the internal format. This works, but it makes problems with alpha-testing. Suddenly all dark corners get invisible. So the LUMINANCE texture seems not only to modulate the color, but also the alpha-channel, which then makes the pixel invisible due to alpha-testing.
So iīd like to know, if there is an internal format, which does the same, except, that it doesnīt change the alpha-channel.
I tried GL_INTENSITY (found it in the msdn), but that seems not to work at all (or it isnīt intended for such a thing?).

And another question: Is it possible to modulate the texture-color of the second texture unit? I mean, i have a grey-scale texture as a light, but what if i want to have a red light? I mean something like glColor, which modulates the polys, but it should only modulate the texture of the second texture-unit BEFORE that one modulates the poly it gets applied to. I tried glSecondaryColor, but that didnīt work.

Well, i think it should be possible with texture_env_combine, but i donīt know much about that extension.

Thanks,
Jan.

dorbie
06-11-2003, 02:31 PM
Look at the manual for texenv and you'll find that the key difference between luminance and intensity formats is the treatment of alpha fragments by some texenv modes.

Put simply, LUMINANCE textures pass through the polygon color alpha fragment but INTENSITY textures use the texture color for both texture color and texture alpha in the texturing operation. There are some undefined options there too for DECAL.

These seem like the only two 'reasonable' behaviours one might expect given that you're only feeding one value in.

If an implementation doesn't do this then you've found a bug, but I am concerned you expect something 'magic' to happen that the implementation cannot reasonably know.