rendered paste bodyfloat4x4 mInvWorld;
float4x4 mWorldViewProj ; //our world view projection matrix
float4x4 mWorldViewIt ; //our inverse transpose matrix
float4x4 mWorld ; //our world matrix
float4x4 mView ; //our view matrix
float4x4 mViewInv; //our view inverse matrix
float3 mLightPos; //our light position in object space
float3 mCamPos; //our cam position in object space
float4x4 mProj;
float3 eyeIn;
float fTime;
struct VS_INPUT
{
float4 position : POSITION;
float4 tex0 : TEXCOORD0;
float4 tex1 : TEXCOORD1;
};
struct VS_OUTPUT
{
float4 position : POSITION;
float4 tex0 : TEXCOORD0;
float4 tex1 : TEXCOORD1;
float4 lightIn : TEXCOORD2;
};
VS_OUTPUT vs_main( VS_INPUT Input )
{
VS_OUTPUT Output;
Output.position = mul( mWorldViewProj, Input.Position );
Output.tex0.xy = (worldviewproj_pos.xy + worldviewproj_pos.w)*0.5;
Output.tex0.zw = float2(1, worldviewproj_pos.w);
Output.lightIn = worldviewproj_pos - (float4)mLightPos;
return( Output );
}
texture texture0; //our texture
texture texture1; //our normal map
float4 ps_main(
float4 tex0 : TEXCOORD0,
float4 tex1 : TEXCOORD1,
float4 lightIn : TEXCOORD2) : COLOR0
{
float2 final = tex0.xy / tex0.w;
float t = fTime / 1000.0;
float3 sample = tex2D(texSampler1,(tex1 + t)/2.0).xyz ;
float3 sample2 = tex2D(texSampler1,(tex1 + t)/-1.0).xyz ;
float3 finalsample = (sample + sample2) / 2.0;
finalsample *= float3(0.015,0.015,1.0);
normalize(finalsample);
float4 color = tex2D( texSampler0, final.xy + finalsample.xy);
// normalize(lightIn);
float specular = dot(lightIn,finalsample);
color.w = 0.5 + specular;
return( color );
}