View Full Version : Multitexturing and color with 2 tpus

02-25-2002, 02:34 PM
I'm having a bit of a problem with multitexturing.
I'm wanting to accomplish this goal using only 2 tpus.

I have 2 textures t1rgb and t2rgb and both textures have alpha channels which i will refer to as t1a and t2a. and finally i have a color of c1

What I want to do is if the alpha channel of texture1 is 1 display texture1 and where the alpha channel of texture1 is 0 display texture2 and then I want to light it with c1rgb.

in math terms this is what I want:
result texel= (t1rgb*t1a + t2rgb*(1-t1a))*c1rgb
note this expands to:
result texel= t1rgb*c1rgb*t1a + t2rgb*c1rgb*(1-t1a)

t2a isn't used
This seems like it would be a common use but I can't seem to figure out how to make it fit.

With tpu1 I can do t1rgb*c1
and with tpu2 i can do tpu1*t1a+t2rgb*(1-t1a)
but i can't seem to light t2rgb

Any solutions or is there something in the extensions I'm missing.
I know this was easily possible with glide oh so long ago.

Is there some other way to accomplish the same goal? All I want is 2 textures mixed as stated above with lighting.


02-25-2002, 06:53 PM
not possible (in one pass) with combine/nvcombine4/crossbar it is possible without lighting/colour either use a 'more pwerful combiner' eg register combiners or use multiple passes

02-26-2002, 04:11 AM
The problem is that you want to multiplies per term.

TE1: out=tex1rgb*color*alpha
TE2: out=color_previous+tex2rgb*color*(1-alpha_prev)

The blend operation (GL_ARB_TEXTURE_ENV_COMBINE) and the NVidia extensions (GL_NV_texture_env_combine4) only allow a single multiply on both sides.

[This message has been edited by zeckensack (edited 02-26-2002).]