Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float4x4 View;
- float4x4 Projection;
- float3 LightDirection = float3(1, -1, 0);
- float TextureTiling = 1;
- texture2D BaseTexture;
- sampler2D BaseTextureSampler = sampler_state {
- Texture = <BaseTexture>;
- AdressU = Wrap;
- AderssV = Wrap;
- MinFilter = Anisotropic;
- MaxFilter = Anisotropic;
- };
- struct VertexShaderInput
- {
- float4 Position : POSITION0;
- float2 UV : TEXCORRD0;
- float3 Normal : NORMAL0;
- };
- struct VertexShaderOutput
- {
- float4 Position : POSITION0;
- float2 UV : TEXCOORD0;
- float3 Normal : TEXCOORD1;
- };
- VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
- {
- VertexShaderOutput output;
- output.Position = mul(input.Position, mul(View, Projection));
- output.Normal = input.Normal;
- output.UV = input.UV;
- return output;
- }
- float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
- {
- float light = dot(normalize(input.Normal), normalize(LightDirection));
- light = clamp(light + 0.4f, 0, 1);
- float3 tex = tex2D(BaseTextureSampler, input.UV * TextureTiling);
- return float4(tex * light, 1);
- }
- technique Technique1
- {
- pass Pass1
- {
- VertexShader = compile vs_2_0 VertexShaderFunction();
- PixelShader = compile ps_2_0 PixelShaderFunction();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement