If I change the value indicated between TEXCOORD0 and TEXCOORD1 i get it
sampling the different textures.
Is it not possible to use the same texture coordinates to sample two
different textures?
Changing the other TEXCOORDn values doesnt seem to make any difference, just
the one in the vertex shader.
float4x4 matInvZRotWorld : InverseZRotWorld;
float4x4 matWorldViewProjection;
float4x4 matPosObj;
float4x4 matInvRot;
float4x4 matZRot;
float Timer;
float Param;
sampler2D MainTex;
sampler2D Lookup;
struct VS_INPUT
{
float4 Position : POSITION;
float4 Normal : NORMAL;
float4 Color : COLOR;
float2 Texture : TEXCOORD1; // ****** IF I CHANGE HERE *******
};
struct VS_OUTPUT
{
float4 Position : POSITION0;
float2 TexC0 : TEXCOORD0;
float2 TexC1 : TEXCOORD1;
};
VS_OUTPUT main( VS_INPUT Input )
{
VS_OUTPUT Output;
// Rotate around the origin by an inverse of all the rotations to be
done.
float4 NewPos = Input.Position;
// Position it correctly in world space
NewPos = mul(NewPos,matWorldViewProjection);
Output.Position = NewPos;
Output.TexC0 = Input.Texture;
Output.TexC1 = Input.Texture;
return( Output );
}
struct PS_INPUT
{
float2 Texc0 : TEXCOORD0;
float2 Texc1 : TEXCOORD1;
};
float4 Textured_Pass_0_Pixel_Shader_ps_main( PS_INPUT Input ) : COLOR0
{
float4 Color = tex2D(Lookup, Input.Texc1);
return Color;
};
//--------------------------------------------------------------//
// Technique Section for Textured
//--------------------------------------------------------------//
technique Effect1
{
pass Pass_0
{
VertexShader = compile vs_2_0 main();
PixelShader = compile ps_2_0 Textured_Pass_0_Pixel_Shader_ps_main();
}
}
"x" <si**********@yahoo.co.ukwrote in message
news:5x******************@fe1.news.blueyonder.co.u k...
Still fairly new at this, I have been trying to find out how to compile
and effect with multiple samplers.
Been able to find loads of examples that show the HSL code once the
samplers are loaded, but not how to get the textures from VB into the
shader.
If i set up two samplers in the shader with no associated texture then
when I compile the shader from string works fine.
but when the shader actually runs both sample the same texture rather than
different ones.
I can pass a texture in as a parameter but get told I cant sample it
intrinsically.
All the examples I can find seem to assume you know how to do this
already. Very frustrating.
I know you can use the commands:
PvDev.settexture(0,texA)
and
PvDev.settexture(1.texB)
and that this presumably sets up two samplers but as mentioned, both
sample texA. Obviously I am missing something any ideas?
thanks in advance.