HLSL Programmable Tweening

rifter1818

Junior Contributor
Joined
Sep 11, 2003
Messages
255
Location
A cold dark place
This is my Effect file.
float4x4 WorldViewProj;
float Time;
void Main(
in float4 Pos1 : POSITION0,
in float4 Pos2 : POSITION1,
out float4 Pos : POSITION)
{
float4 tPos = pos2 - pos1;
tPos *= Time;
Pos = tPos + pos1;
pos = mul(pos,WorldViewProj);
}
technique ANM
{
pass p0
{
VertexShader = compile vs_1_1 Main;
PixelShader = Null;
}
}
When i try and load it i get the following error
C:\ANM.fx(8): error X3004: undeclared identifier 'pos2'
Any ideas folks.
On another note my vertex Declaration is
Dim ve As VertexElement() = New VertexElement() {New VertexElement(0, 0, _
DeclarationType.Float4, DeclarationMethod.Default, _
DeclarationUsage.Position, 0), New VertexElement(1, 0, _
DeclarationType.Float4, DeclarationMethod.Default, _
DeclarationUsage.Position, 1), VertexElement.VertexDeclarationEnd}
Dec = New VertexDeclaration(dev, ve)
if you see anything wrong there let me know.
 
HLSL is case sensitive then
pos2 is differente from Pos2
hovever to interpolate value use Lerp that do a linear interpolation from 2 vector passing a single value from 0 to 1.
 
I think HLSL is case sensitive so the line "float4 tPos = pos2 - pos1;" needs to be "float4 tPos = Pos2 - Pos1;" cause you declared your Pos1 and Pos2 vars with capital P's. ... Yes, no, maybe so???
 
Very Much So. Got The Case sensitive thing worked out not sure what the problem is now, no errors but nothing is displayed. But thats not a problem for here right now. Oh And Thumbs up for RobyDx's ShaderDK very nice. Check out his site.
 
If you can't see nothing the problen could be that you havent passed transform matrix in properly way
 
Back
Top