| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- float4x4 World;
- float4x4 View;
- float4x4 Projection;
- float4 Fog;
- // TODO: add effect parameters here.
- struct VertexShaderInput
- {
- float4 Position : POSITION0;
- // TODO: add input channels such as texture
- // coordinates and vertex colors here.
- };
- struct VertexShaderOutput
- {
- float4 Position : POSITION0;
- float Depth : TEXCOORD0;
- // TODO: add vertex shader outputs such as colors and texture
- // coordinates here. These values will automatically be interpolated
- // over the triangle, and provided as input to your pixel shader.
- };
- VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
- {
- VertexShaderOutput output;
- float4 worldPosition = mul(input.Position, World);
- float4 viewPosition = mul(worldPosition, View);
- output.Depth = length(viewPosition);
- output.Position = mul(viewPosition, Projection);
- // TODO: add your vertex shader code here.
- return output;
- }
- float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
- {
- // TODO: add your pixel shader code here.
- return lerp(Fog * 0.25, Fog * 0.95, clamp(input.Depth * 0.005, 0, 1));
- }
- technique Technique1
- {
- pass Pass1
- {
- // TODO: set renderstates here.
- VertexShader = compile vs_2_0 VertexShaderFunction();
- PixelShader = compile ps_2_0 PixelShaderFunction();
- }
- }
|