42 lines
1.2 KiB
HLSL
42 lines
1.2 KiB
HLSL
#define RADIUS 7
|
|
#define KERNEL_SIZE (RADIUS * 2 + 1)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Globals.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
float weights[KERNEL_SIZE];
|
|
float2 offsets[KERNEL_SIZE];
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Textures.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
sampler colorMapTexture : register(s0);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Pixel Shaders.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
float4 PS_MAIN(float4 position : SV_Position, float4 col : COLOR0, float2 uv : TEXCOORD0) : COLOR0
|
|
{
|
|
float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
|
|
for (int i = 0; i < KERNEL_SIZE; ++i)
|
|
color += tex2D(colorMapTexture, uv + offsets[i]) * weights[i];
|
|
|
|
return color;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Techniques.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
technique GaussianBlur
|
|
{
|
|
pass Pass1
|
|
{
|
|
PixelShader = compile ps_4_0 PS_MAIN();
|
|
}
|
|
}
|