Added normal based material.

This commit is contained in:
David Williams
2008-01-16 20:56:54 +00:00
parent 4013e9143f
commit 2ec6e8fbda
5 changed files with 69 additions and 16 deletions

View File

@ -0,0 +1,10 @@
struct v2f
{
float4 Position : POSITION; //in projection space
float4 Normal : TEXCOORD0;
};
float4 main(v2f IN) : COLOR
{
return abs(IN.Normal);
}

View File

@ -0,0 +1,27 @@
struct a2v
{
float4 Position : POSITION; //in object space
float3 Normal : NORMAL;
float2 Alpha : TEXCOORD0;
};
struct v2f
{
float4 Position : POSITION; //in projection space
float4 Normal : TEXCOORD0;
};
v2f main(a2v IN, uniform float4x4 world, uniform float4x4 viewProj)
{
v2f OUT;
OUT.Position = mul(world, IN.Position);
IN.Normal = normalize(IN.Normal);
OUT.Normal = float4(IN.Normal,0.0);
OUT.Position = mul(viewProj, OUT.Position);
return OUT;
}

View File

@ -94,4 +94,18 @@ fragment_program TextureAtlasExperimentalFragmentProgram cg
source TextureAtlasExperimentalFragmentProgram.cg
entry_point main
profiles ps_1_1 arbfp1
}
vertex_program NormalVertexProgram cg
{
source NormalVertexProgram.cg
entry_point main
profiles vs_1_1 arbvp1
}
fragment_program NormalFragmentProgram cg
{
source NormalFragmentProgram.cg
entry_point main
profiles ps_1_1 arbfp1
}