A
alex19735
Guest
Hello, I am trying to blur a specific area in the game window that basically blurs everything underneath it. I have managed to make it work using a separate surface for the blur, however it seems it does not blur translucent objects correctly. I have a shadow system set up with a separate surface for it, and basically the entire surface has the alpha set to 0.5.
This is the blur without the shadows. Works fine! (You can see it in the top left corner)
Here is the blur with the shadows. As you can see, the shadows not only don't blur, but they make everything around them not blur as well.
And here is the blur with the shadow surface set to alpha 1, working fine.
Here is the code to the shader:
I am sorry if this has an obvious solution, I have only started using Gamemaker recently and don't really know it that well.
Thank you in advance.
This is the blur without the shadows. Works fine! (You can see it in the top left corner)
Here is the blur with the shadows. As you can see, the shadows not only don't blur, but they make everything around them not blur as well.
And here is the blur with the shadow surface set to alpha 1, working fine.
Here is the code to the shader:
Code:
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec3 size;//width,height,radius
const int Quality = 8;
const int Directions = 16;
const float Pi = 6.28318530718;//pi * 2
void main()
{
vec2 radius = size.z/size.xy;
vec4 Color = texture2D( gm_BaseTexture, v_vTexcoord);
for( float d=0.0;d<Pi;d+=Pi/float(Directions) )
{
for( float i=1.0/float(Quality);i<=1.0;i+=1.0/float(Quality) )
{
Color += texture2D( gm_BaseTexture, v_vTexcoord+vec2(cos(d),sin(d))*radius*i);
}
}
Color /= float(Quality)*float(Directions)+1.0;
gl_FragColor = Color * v_vColour;
}
Thank you in advance.
Attachments
-
267.2 KB Views: 41
-
322.9 KB Views: 42
-
217.5 KB Views: 44