Quote: "dark coder : I know about that, but how does program know, what UV stage has .. "
The program, i.e. your shader, doesn't know - as Dark Coder said, you have to tell the shader which to use when you write the texture look-up.
To use your example, the shader might have 5 texture declarations:
texture stage0 < string ResourceName = ""; >;
texture stage1 < string ResourceName = ""; >;
texture stage2 < string ResourceName = ""; >;
texture stage3 < string ResourceName = ""; >;
texture stage4 < string ResourceName = ""; >;
with associated samplers
sampler sampler0 = sampler_state { texture = <stage0>; };
sampler sampler1 = sampler_state { texture = <stage1>; };
sampler sampler2 = sampler_state { texture = <stage2>; };
sampler sampler3 = sampler_state { texture = <stage3>; };
sampler sampler4 = sampler_state { texture = <stage4>; };
At that point the samplers are just associated with the five texture stages specified in your DBPro program - the shader doesn't yet know which set of UV coords to use.
You do this as follows in your example:
First tell the vertex shader to read the two sets, e.g. your vertex shader input structure might be:
struct VSInput
{ float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
};
and the vertex shader might have something like
VSOutput VShader(VSInput In, VSOutput Out)
{ Out.pos = mul(In.pos, wvp);
Out.UV0 = In.UV0 + scroll.xy * seconds;
Out.UV1 = In.UV1 + scroll.zw * seconds;
return Out;
}
(You would need a matching output structure and an input structure for the pixel shader of course.)
The pixel shader then assigns the 2 UV coords to the 5 textures with something like the following:
PSOutput PShader(PSInput In, PSOutput Out)
{ float4 colour = tex2D(stage0, In.UV0);
colour *= tex2D(stage1, In.UV0);
colour *= tex2D(stage2, In.UV1);
colour *= tex2D(stage3, In.UV1);
colour *= tex2D(stage4, In.UV1);
Out.col = colour;
return Out;
}