texture blending

Hi,

I need to blend two textures like so:

T1 = texture #1
T2 = texture #2
F1 = fragment #1
F2 = fragment #2

needed blend = T1 * F1 + T2 * F2

Thanks

[b]I need to blend two textures like so:

T1 = texture #1
T2 = texture #2
F1 = fragment #1
F2 = fragment #2

needed blend = T1 * F1 + T2 * F2

Thanks[/b]

I must have missed the question mark…

Julien.

sorry.

I am trying to blend these two textures as I described. I cant find the support for such a blend.

I am trying to do this in one pass (using multitexturing).

modulating seems to take the first texture as the fragment for the second texture, like so:

out = F1 * T1 * T2.

opengl blending seems to do the following:
F1 * (1 - T1 ) + F2 * T2

whereas I need

F1 * T1 + F2 * T2.

I took a look at ARB_texture_env_add.
but this just wants to add the fragment to the texture.

does anyone know how to implement the blend function I need, namely F1 * T1 + F2 * T2?

thx

Where is the second fragment supposed to come from?

both first and second fragments are calculated real-time and are supposed to encode the blend ratios for r,g,b values in each texture.

Now, ultimately, the fragments are supposed to be the (ohterwise unuser) diffuse and specular color fragments.

should I move this to the beginner’s forum, you think?
thanks again

No, but I think you should explain what you need a little better.

You want two different textures to be modulated by two different “modulators” (I don’t think “fragments” is the word you really want here). Then you want to sum them.

The next question is where F1 and F2 come from. Are these a primary and a secondary color? Or are they texture lookup results?

Assuming that you want full color modulation, not just alpha modulation, and that F2 is not just 1-F1, then you will need to use the register combiner extension on nVIDIA hardware and the pixel shader extension on ATI hardware.

If you want better answers, you’d need to supply better information about the problem :slight_smile:

thanks.

This sort of formula is supported on all NVIDIA hardware since the TNT, using the NV_texture_env_combine4 extension.

  • Matt