Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualJuliean

Posted 24 October 2013 - 04:58 AM

You could reduce some of the passes used for blurring by using a different kind of blur, that does vertical and horizontal blurring in one pass. Don't know its exact name anymore, and don't know how it would affect visual quality, but here it is:

cbuffer stage : register(b2)
{
	float2 cTextureSize;
}

sampler InputSampler : register(s0);
Texture2D Input  : register(t0);

float4 mainPS(VS_OUTPUT inp) : SV_TARGET0
{
	float2 uTexelSize = 1.0 / cTextureSize;
	float result = 0.0;
	for (int i = 0; i < 4; ++i) {
		for (int j = 0; j < 4; ++j) {
			float2 offset = float2(uTexelSize.x * float(j), uTexelSize.y * float(i));
			result += Input.Sample(InputSampler, inp.vTex0 + offset).r;
		}
	}
	
	return result / 16.0;
}

#1Juliean

Posted 24 October 2013 - 04:58 AM

You can reduce some of the passes used for blurring by using a different kind of blur, that does vertical and horizontal blurring in one pass. Don't know its exact name anymore, and don't know how it would affect visual quality, but here it is:

cbuffer stage : register(b2)
{
	float2 cTextureSize;
}

sampler InputSampler : register(s0);
Texture2D Input  : register(t0);

float4 mainPS(VS_OUTPUT inp) : SV_TARGET0
{
	float2 uTexelSize = 1.0 / cTextureSize;
	float result = 0.0;
	for (int i = 0; i < 4; ++i) {
		for (int j = 0; j < 4; ++j) {
			float2 offset = float2(uTexelSize.x * float(j), uTexelSize.y * float(i));
			result += Input.Sample(InputSampler, inp.vTex0 + offset).r;
		}
	}
	
	return result / 16.0;
}

PARTNERS