I'm writing tile-based game. Level contains few layers. I want to blur layers beneath player but I can't find any explanation how to blur screen.
I am thinking of something like that process:
- Draw layer 0
- Draw layer 1
- Draw layer 2
- Blur whole Screen
- Draw layer 3 (with player)
- Draw layer 4
- ... etc
- Draw GUI
Is it possible to achive blur that way? How can I do this?
How to blur whore game screen
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: How to blur whore game screen
It sounds like you need to use Shaders (PixelEffects in 0.8), which you can read up on here: http://love2d.org/wiki/PixelEffect
Basically what you'd want to do is set a pixel effect to start bluring. Draw layers to be blurred. Then remove the pixel effect, and draw the player and remaining layers. The actual shader, theres a "Share a Shader" thread you can go looking for here on the love forum, where there might be one that does what you want.
Incidentally, whole is spelled with an 'l'
Basically what you'd want to do is set a pixel effect to start bluring. Draw layers to be blurred. Then remove the pixel effect, and draw the player and remaining layers. The actual shader, theres a "Share a Shader" thread you can go looking for here on the love forum, where there might be one that does what you want.
Incidentally, whole is spelled with an 'l'
Re: How to blur whore game screen
First you have to wait until she's playing a game in the bathroom. When that happens, you invade and lock her in with the shower on on super hot mode. After a few minutes her game screen will surely be blurred.
Code: Select all
-- Simple 3x3 box blur
simple_blur = love.graphics.newPixelEffect[[
extern vec2 image_size;
extern number intensity = 1.0;
vec4 effect(vec4 color, Image tex, vec2 tc, vec2 pc) {
vec2 offset = vec2(1.0)/image_size;
color = Texel(tex, tc);
color += Texel(tex, tc + intensity*vec2(-offset.x, offset.y));
color += Texel(tex, tc + intensity*vec2(0.0, offset.y));
color += Texel(tex, tc + intensity*vec2(offset.x, offset.y));
color += Texel(tex, tc + intensity*vec2(-offset.x, 0.0));
color += Texel(tex, tc + intensity*vec2(0.0, 0.0));
color += Texel(tex, tc + intensity*vec2(offset.x, 0.0));
color += Texel(tex, tc + intensity*vec2(-offset.x, -offset.y));
color += Texel(tex, tc + intensity*vec2(0.0, -offset.y));
color += Texel(tex, tc + intensity*vec2(offset.x, -offset.y));
return color/9.0;
}
]]
Re: How to blur whore game screen
So I have to draw SpriteBatch with enabled blur shader or draw rectangle with shader over previously drawn layer?
Re: How to blur whore game screen
I don't understand your question, but one way to do it would be to set the pixel effect and draw your first blurred layers. Then you remove the pixel effect and draw the rest.
Code: Select all
function love.draw()
love.graphics.setPixelEffect(blur)
drawLayersThatShouldBeBlurred()
love.graphics.setPixelEffect()
drawLayersThatShouldntBeBlurredAndPlayer()
drawGUI()
end
Re: How to blur whore game screen
If you're not already using it you could check out a system I came up with to layer your tiles: http://www.love2d.org/wiki/Layering_Tiles
In the draw_map you may want to make an argument called 'blurry_layer' or something that makes since to you. Then change the code to this:
In the draw_map you may want to make an argument called 'blurry_layer' or something that makes since to you. Then change the code to this:
Code: Select all
function draw_map( blurry_layer )
for l = 1, #layers do
if l == blurry_layer then
--put in your particle effect.
end
for y = 1, layers[l].map_display_h do
for x = 1, layers[l].map_display_w do
love.graphics.draw(
tile[layers[l][y+layers[l].map_y][x+layers[l].map_x]],
(x*layers[l].tile_w)+layers[l].map_offset_x,
(y*layers[l].tile_h)+layers[l].map_offset_y)
end
end
end
end
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 7 guests