TexCtrlFade/ Texture Mixer on GPU

Hello people,

is it posible to adapt this shader to be used with several textures?, i mean more than 2.

I made some transformations in the shader to use 3 textures, but i don´t know how to mix the several textures.

maybe is it posible to conect the R,G,B,A data to every of the 4 textures?

any help would be very apreciated



multi texture mixer test (104.6 kB)


i made some changes in the shader,
i don´t know if it´s the best aproach to do that but it runs.
finally i´m not using the mask texture but it would be nice to have this posibility to mix all the textures, maybe with the RGBA data,
if anybody knows how to do that, please show me it.


Multi texture mixer GPU (155.4 kB)


the fx in your last example is pointing to a file somewhere on your harddrive.

how you would want to mix the 4 sources?
like a->b->c? or a->b + a->c? any defined goal, or just experimenting?

you could try:

float4 outColor = 0;
outColor += lerp(src1,src2,ctrl.r);
outColor += lerp(src2,src3,ctrl.g);
outColor += lerp(src3,src1,ctrl.b);
outColor /= 3.;

no idea, how it will look like, but this would mix these 3 sources depending on rgb values of the control texture

It looks nice,
thanks a lot woei, i have not so much experience with hlsl,
i´ll experiment with the diferent posibilities.