IvanJ147
26-02-2014 18:55:43
Hi all!!
I'm trying yto write my first shader, but I have a problem.
I've created my material file in this way:
And this is MyFirstShader file:
In my application I expect to see my model all red, but actually I see it totally white.
I've tested the shader with RenderMonkey, and it works like I expect, so I think the problem is in the material settings.
Can anybody explain me what's wrong?
Thanks for your help.
I'm trying yto write my first shader, but I have a problem.
I've created my material file in this way:
vertex_program VertexMain hlsl
{
source MyFirstShader.hlsl
target vs_2_0
entry_point vs_main
default_params
{
param_named_auto matViewProjection worldviewproj_matrix
}
}
fragment_program PixelMain hlsl
{
source MyFirstShader.hlsl
target ps_2_0
entry_point ps_main
}
material lambert4
{
technique
{
pass
{
vertex_program_ref VertexMain
{
}
fragment_program_ref PixelMain
{
}
}
}
}
And this is MyFirstShader file:
float4x4 matViewProjection;
struct VS_INPUT
{
float4 Position : POSITION0;
};
struct VS_OUTPUT
{
float4 Position : POSITION0;
};
VS_OUTPUT vs_main( VS_INPUT Input )
{
VS_OUTPUT Output;
Output.Position = mul(matViewProjection,Input.Position);
return( Output );
}
float4 ps_main() : COLOR0
{
return( float4(1, 0, 0, 1 ) );
}
In my application I expect to see my model all red, but actually I see it totally white.
I've tested the shader with RenderMonkey, and it works like I expect, so I think the problem is in the material settings.
Can anybody explain me what's wrong?
Thanks for your help.