468,532 Members | 1,766 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,532 developers. It's quick & easy.

VB Dotnet Shader passing textures from VB to shader help.

x
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.
Aug 21 '06 #1
3 1187
x
Better mention that I am using VB DotNet 2005 too.
thanks.

"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.


Aug 21 '06 #2
x
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.


Aug 21 '06 #3
x
Bah further investigation shows that even though I get a different result
using TEXCOORD1 it is erroneous data, probably because i don't pass a
TECOORD1 in my vertex structure. so back to square one.
Aug 21 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Michael Schneider | last post: by
5 posts views Thread by Michael Sgier | last post: by
22 posts views Thread by Arne | last post: by
2 posts views Thread by MR | last post: by
2 posts views Thread by Feniks | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.