| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #include "$ENGINE$\PPBase.bslinc"
- Parameters =
- {
- float2 gInvTexSize;
- Sampler2D gInputSamp : alias("gInputTex");
- Texture2D gInputTex;
- };
- Blocks =
- {
- Block Input;
- };
- Technique : inherits("PPBase") =
- {
- Language = "HLSL11";
-
- Pass =
- {
- Fragment =
- {
- cbuffer Input
- {
- float2 gInvTexSize;
- }
-
- SamplerState gInputSamp;
- Texture2D gInputTex;
- float4 main(VStoFS input) : SV_Target0
- {
- float2 UV[4];
- // Blur using a 4x4 kernel. It's assumed current position is right in the middle of a 2x2 kernel (because the output
- // texture should be 1/2 the size of the output texture), and moving by one in each direction will sample areas
- // between a 2x2 kernel as well if bilinear filtering is enabled.
- UV[0] = input.uv0 + gInvTexSize * float2(-1, -1);
- UV[1] = input.uv0 + gInvTexSize * float2( 1, -1);
- UV[2] = input.uv0 + gInvTexSize * float2(-1, 1);
- UV[3] = input.uv0 + gInvTexSize * float2( 1, 1);
- float4 sample[4];
- for(uint i = 0; i < 4; i++)
- sample[i] = gInputTex.Sample(gInputSamp, UV[i]);
- return (sample[0] + sample[1] + sample[2] + sample[3]) * 0.25f;
- }
- };
- };
- };
- Technique : inherits("PPBase") =
- {
- Language = "GLSL";
-
- Pass =
- {
- Fragment =
- {
- in VStoFS
- {
- vec2 uv0;
- } input;
-
- uniform Input
- {
- vec2 gInvTexSize;
- };
-
- uniform sampler2D gInputTex;
- out vec4 fragColor;
- void main()
- {
- vec2 UV[4];
- // Blur using a 4x4 kernel. It's assumed current position is right in the middle of a 2x2 kernel (because the output
- // texture should be 1/2 the size of the output texture), and moving by one in each direction will sample areas
- // between a 2x2 kernel as well if bilinear filtering is enabled.
- UV[0] = input.uv0 + gInvTexSize * vec2(-1, -1);
- UV[1] = input.uv0 + gInvTexSize * vec2( 1, -1);
- UV[2] = input.uv0 + gInvTexSize * vec2(-1, 1);
- UV[3] = input.uv0 + gInvTexSize * vec2( 1, 1);
- vec4 samples[4];
- for(uint i = 0; i < 4; i++)
- samples[i] = texture2D(gInputTex, UV[i]);
- fragColor = (samples[0] + samples[1] + samples[2] + samples[3]) * 0.25f;
- }
- };
- };
- };
|