Jump to content
  • Advertisement
Sign in to follow this  
O-san

Blur artifact

This topic is 3411 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I'm having trouble with my bloom shader. The shader blurs my scene in two passes, first a horizontal pass then a vertical pass. When I render my screen aligned quad I get a seam that stretches from corner to corner of my screen: The seam is quite diffuse but I think it originates from my Gaussian blur because it disappears when I turn it off. My horizontal and vertical shaders look like this Horizontal fragment shader:
uniform sampler2D RT;
uniform float alpha;
varying vec2 vTexCoord;

const float blurSize = 1.0/128.0;
 
void main(void)
{
	vec4 sum = vec4(0.0);
	
	sum += texture2D(RT, vec2(vTexCoord.x - 4.0*blurSize, vTexCoord.y)) * 1.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x - 3.0*blurSize, vTexCoord.y)) * 2.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x - 2.0*blurSize, vTexCoord.y)) * 3.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x - blurSize, vTexCoord.y)) * 4.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x, vTexCoord.y)) * 5.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x + blurSize, vTexCoord.y)) * 4.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x + 2.0*blurSize, vTexCoord.y)) * 3.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x + 3.0*blurSize, vTexCoord.y)) * 2.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x + 4.0*blurSize, vTexCoord.y)) * 1.0/25.0;
	gl_FragColor = sum;
}
Vertical fragment shader:
uniform sampler2D RT;
uniform float alpha;
varying vec2 vTexCoord;
 
const float blurSize = 1.0/128.0;
 
void main(void)
{
	vec4 sum = vec4(0.0);
	
	sum += texture2D(RT, vec2(vTexCoord.x, vTexCoord.y - 4.0*blurSize)) * 1.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x, vTexCoord.y - 3.0*blurSize)) * 2.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x, vTexCoord.y - 2.0*blurSize)) * 3.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x, vTexCoord.y - blurSize)) * 4.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x, vTexCoord.y)) * 5.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x, vTexCoord.y + blurSize)) * 4.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x, vTexCoord.y + 2.0*blurSize)) * 3.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x, vTexCoord.y + 3.0*blurSize)) * 2.0/25.0;
	sum += texture2D(RT, vec2(vTexCoord.x, vTexCoord.y + 4.0*blurSize)) * 1.0/25.0;
	gl_FragColor = sum;
}
Any help appreciated!

Share this post


Link to post
Share on other sites
Advertisement
The seams have the right inclination to be aligned with polygon edges in your isometric scene; there might be texture coordinate discontinuities between adjacent polygons, or texture border sampling artifacts (e.g. a black border).
You should be able to test easily whether the position of the defects depends on the camera, the objects or their interaction.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!