Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Texture2D DiffuseTexture;
- Texture2D DepthTexture;
- float2 Center = { 0.5, 0.5 };
- float BlurWidth;
- float BlurStart = 1.0f;
- float NumberOfSamples = 32;
- struct VS_INPUT
- {
- float4 Pos : POSITION;
- float2 Tex : TEXCOORD;
- };
- struct PS_INPUT
- {
- float4 Pos : SV_POSITION;
- float2 Tex : TEXCOORD;
- };
- shared SamplerState Sampler
- {
- Filter = MIN_MAG_MIP_LINEAR;
- AddressU = Border;
- AddressV = Border;
- };
- BlendState NoBlend
- {
- AlphaToCoverageEnable = FALSE;
- BlendEnable[0] = FALSE;
- };
- DepthStencilState EnableDepthWrites
- {
- DepthEnable = TRUE;
- DepthWriteMask = ALL;
- };
- PS_INPUT VS(VS_INPUT input)
- {
- PS_INPUT output = (PS_INPUT)0;
- output.Pos = input.Pos;
- output.Tex = input.Tex;
- return output;
- }
- float4 PS(PS_INPUT input) : SV_Target
- {
- float2 UV = input.Tex - Center;
- float4 color = 0;
- for (int i = 0; i < NumberOfSamples; i++)
- {
- float scale = BlurStart - BlurWidth*(i / (float)(NumberOfSamples - 1));
- color += DiffuseTexture.Sample(Sampler, UV * scale + Center);
- }
- color /= NumberOfSamples;
- return color;
- }
- technique10 Render
- {
- pass P0
- {
- SetVertexShader(CompileShader(vs_5_0, VS()));
- SetGeometryShader(NULL);
- SetPixelShader(CompileShader(ps_5_0, PS()));
- SetDepthStencilState(EnableDepthWrites, 0);
- SetBlendState(NoBlend, float4(0, 0, 0, 0), 0xFFFFFFF);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement