blending multitexturing over multitexturing?
i am trying to use multitexturing to apply 4 textures to a quad. i have two computers to play with here, one has 2 texture units and the other has 3.
for the PC with three texture units, i can multitexture three of the textures (like in this tutorial) and then alpha blend the fourth one over that to get it to look the way i want.
for the PC with just two, i can multitexture two of the textures, and then alpha blend the other two as two more passes.
what i would like to do is use the two texture units to do it in two passes, i.e. multitexturing two of them, and then multitexturing the other two and blending them over the first set in just one more pass.
is this possible? i am new to multitexturing, and i am still toying with GL_ARB_texture_env_combine and the different texture environment settings i can use.
[edited by - krez on May 7, 2004 11:04:08 AM]
Depends on what you''re doing, but it certainly is likely. Could you post a specific multitexturing equation?
Textures are combined in multitexturing via a series of operations. GL_MODULATE, for example, multiplies the colours. Basically, what does the setup for your textures look like?
for the "three texture units" path, i use:
for the "two texture units" one:
is that what you mean?
texture 1: glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);texture 2: glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PRIMARY_COLOR_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_COLOR);texture 3: glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PRIMARY_COLOR_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_ALPHA);
for the "two texture units" one:
texture 1: glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);texture 2: glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PRIMARY_COLOR_ARB); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_COLOR);
is that what you mean?
Okay, based on what you''ve posted, here''s what the multitexturing equation would be:
The first part is just a GL_REPLACE, which is basically the same as saying:
result = tex0
Next, an GL_INTERPOLATE, using the result of the previous op as one of the sources:
result = result * colour + tex1 * (1 - colour)
Then, another GL_INTERPOLATE:
result = result * alpha + tex2 * (1 - alpha)
This results in:
result = tex0
result = result * colour + tex1 * (1 - colour)
result = result * alpha + tex2 * (1 - alpha)
The problem is that second interpolation. . . I can''t think of any easy way to put it in the second pass. Blending can multiply, add, or subtract, but interpolation is quite beyond it.
The first part is just a GL_REPLACE, which is basically the same as saying:
result = tex0
Next, an GL_INTERPOLATE, using the result of the previous op as one of the sources:
result = result * colour + tex1 * (1 - colour)
Then, another GL_INTERPOLATE:
result = result * alpha + tex2 * (1 - alpha)
This results in:
result = tex0
result = result * colour + tex1 * (1 - colour)
result = result * alpha + tex2 * (1 - alpha)
The problem is that second interpolation. . . I can''t think of any easy way to put it in the second pass. Blending can multiply, add, or subtract, but interpolation is quite beyond it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement