• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED Problem to apply a blur shader to a specific sprite

Hey everyone,
I have this shader that I took from xorshader :
GML:
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;
}
I have no issue to apply it to whole application surface, but I'm strugguling to apply it to a specific sprite, because this code :

Code:
//CREATE EVENT
usize = shader_get_uniform(shd_gaussian_blur,"size");


//DRAW EVENT

shader_set(shd_gaussian_blur);
shader_set_uniform_f(usize,231,231,8);
draw_sprite(global.snap_mana, 0,0,0);
shader_reset();
produce this result:
1605697354086.png
As you can imagine, there's not only this sprite to display but a lot of other stuff around, in my window...
What am I doing wrong?
Thank you for your answers
 

FoxyOfJungle

Kazan Games
If you refer to quality, try changing these values:

const int Quality = 8;
const int Directions = 16;

If you refer to the size of the sprite, draw it with draw_sprite_stretched()
 
Last edited:
Top