Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - StuntHacks

Pages: [1]
1
Graphics / Re: Blur shader not working - Just a grey "cross"
« on: April 19, 2016, 12:18:07 pm »
I tried to set 0.5 as the blur_radius now. It changes something, but it still isn't a blur. It kinda copies the texture for times, makes them gray and half transparent (See screenshot below).
(click to show/hide)

EDIT: I tried 0.01 now and it seems to work. Still curious why it looks so strange with a bigger radius...

2
Graphics / Blur shader not working - Just a grey "cross"
« on: April 18, 2016, 03:58:34 pm »
Hi,

I'm trying to apply a blur shader on one of my sprites. But all I get is the texture with a half transparent grey cross layed over it (See  screenshot below). Can someone tell me what I have done wrong?

This is my code that draws the sprite:
shader.setParameter("blur_radius", 20);
shader.setParameter("texture", backgroundTexture);

window.clear(sf::Color::Transparent);
window.draw(backgroundSprite, &shader);
window.display();

And this is my shader:
uniform sampler2D texture;
uniform float blur_radius;

void main()
{
    vec2 offx = vec2(blur_radius, 0.0);
    vec2 offy = vec2(0.0, blur_radius);

    vec4 pixel = texture2D(texture, gl_TexCoord[0].xy)               * 4.0 +
                 texture2D(texture, gl_TexCoord[0].xy - offx)        * 2.0 +
                 texture2D(texture, gl_TexCoord[0].xy + offx)        * 2.0 +
                 texture2D(texture, gl_TexCoord[0].xy - offy)        * 2.0 +
                 texture2D(texture, gl_TexCoord[0].xy + offy)        * 2.0 +
                 texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1.0 +
                 texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1.0 +
                 texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1.0 +
                 texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1.0;

    gl_FragColor =  gl_Color * (pixel / 16.0);
}

The shader is loaded correctly and shaders are supported on my computer.

And here is the screenshot of the sprite (As you can see, there is no blur):
(click to show/hide)

Thanks,
StuntHacks

3
Graphics / Re: Layer distance
« on: March 16, 2015, 09:40:37 pm »
Yeah, worked. I think, this is solved now.

4
Graphics / Layer distance
« on: March 15, 2015, 09:26:11 pm »
I hope this is the right place for this, if not: sorry ^^'

So, I want to have this effect with multiple layers of graphics: At the beginning the first layer should be displayed in it's default size and the second one should be displayed a bit smaller so that it looks like there is some distance between the layers. Then, if the users triggers an event or presses a button or something, the view should zoom into the screen so that layer two is displayed in it's original size and layer one is displayed a bit bigger. How could I solve this efficiently and, if possible, with views and without rescaling the layers?

Thanks in advice :)
 ~ StuntHacks

Pages: [1]
anything