Hey

I’m trying to mask a RGB texture with another RGB texture. I’m looking for some kind of combinder/shader operation that can do this. I want to do this in a single pass, and alpha testing will not work. I basically want to do this:

texture unit 1 = texture1(24bit RGB)
texture unit 2 = texture2(24bit RGB)
texture unit 3 = texture3(24bit RGB)

Operation:
if(tex1.fragment == tex2.fragment) tmp = 1
else tmp = 0

tmp*tex3.fragment = output

/Pete

Hmm, doesn’t seem possible in combiners. What is this for?

-Ilkka

Well, I am basically interested in implementing a convolutional sum for smaller textures. GL supports 2d convolution but only in software for consumer based boards(imaging subset). The algorithm would be something like:

f(i,j) = SUM ( f(k,l)*g(f(k,l),table[i,j]) )

where g(a,b) => if(a==b) return 1,else return 0

The entire SUM would need mulitple passes but not the kernel(hopefully).

Did that make sense?
/Pete

Hmm, just thought of something. I guess this would also work, but would require an extra texture unit.

texture unit 1 = texture1(24bit RGB)
texture unit 2 = texture2(24bit RGB)
texture unit 3 = texture3(24bit RGB)
texture unit 4 = texture4(24bit RGB)

Operation:
tu1->tu2 tmp = tex1.fragment & tex2.fragment
tu2->tu3 tmp = tmp-tex3.fragment
tu3->tu4 output = tmp*tex3.fragment

In tex3 I would store tex2-1. If the bitwise and succeded in tu1->tu2(tmp = tex1), tmp would be 1 in tu2->tu3. If failed, tmp would be negative, and clamped to 0. Or maybe I’m just dreaming.