Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Real-time blurring?

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 6th Jul 2010 23:58
You all know the command blur bitmap. Well unfortunately this command takes quite a while to blur the bitmap, so I can not use it for real-time blurring. How can I achieve this effect? It's probably some shader, but I have no idea how to make shaders or use them...

TheComet

C0wbox
20
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 7th Jul 2010 00:56
I came across a code snippet once while looking for motion blur that offered a fast ordinary blur.

I don't have the code to hand but it worked on the principle of simply grabbing the screen image and pasting a sprite with that image around 0,0 (where the top left of the screen is) now it's a bit more complicated than that and I can't even refer to the code to make sure that's really what it does but I think it's the quickest way you'll find to get a quick blur.

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 7th Jul 2010 13:31
You could cheat, depending on your game. In nanoid, I just used a very translucent backdrop, disabled the backdrop and stuck the image there - with a fixed camera though. With that, anything drawn to the screen gets faded out slowly because of the translucent image. Like, if you take an image and make it 2% alpha for instance - you'd end up with the image but it would build up, as the alpha increases all the time, it also overwrites the screen. It gives motion blur and is really fast, but obviously it's only a good idea for a fixed camera, or at least a 2.5D engine - it would work in a Geometry Wars style game for example.


Health, Ammo, and bacon and eggs!
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 8th Jul 2010 17:01
What reason do you need to blur? Is it just an effect you want for your game? Or is it something that hapens to your player like getting stuned?

The fastest code is the code never written.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Jul 2010 17:30
@C0wbox + Van B

I see what you are saying, but I am coming from another direction. I probably should have shown an example of what I meant.

How can I make this:



look like this, but in real-time?



@ Hawkblood

Well, the reason I want to blur is mainly for a cool effect. In my current wip (click my sig) someone suggested I make a replay of the last match play in the background when you are in the menu. I thought this would be an awesome idea, but I thought it would also look better if it is a little faded and blurred.

TheComet

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Jul 2010 17:49
Ohh, I see what you mean - I thought you were talking about a motion blur. If you want that to blur when you go into the main menu, maybe best to just grab the screen, then use a shader to blur the image, or indeed the ImageKit plugin (possibly the neatest option). With imagekit, you could grab the screen as an image, sprite it onto the backdrop, then blur it to that point while showing the menu - it would be like the game paused and blurred out. I know the effect you are after, it is pretty cool, and I think ImageKit will be fast enough to do that for you.


Health, Ammo, and bacon and eggs!
C0wbox
20
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 8th Jul 2010 18:40 Edited at: 8th Jul 2010 18:41
Found the code I was on about:

This does exactly what you need with no shaders.

And just incase anyone comes in here looking for motion blur that's here too:


TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Jul 2010 19:04
Thanks a lot guys

TheComet

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 22nd Jul 2010 17:02
That's just what I was looking for thanks C0wbox!

Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 23rd Aug 2010 05:58
I too have been looking for an answer to this and found the code COwbox posted, after playing around with the code a bit I got this:



Where "SpriteBlur.dba" is this:



The blur function allows steps of 0.5. about 2.5 blur passes (?) gives a nice effect which is far more efficient than the original version's 7 passes. However, the screen goes completely blank when Blur#<1 (see code), anyone know why you can't see the cube objects? I should point out that although this method works at about 250FPS at 256x256x32, when you try it at 1024x768x32 the frame rate is about 12FPS.

Hope this is useful to someone,
Broken_Code
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 23rd Aug 2010 18:40
One method you may want to try is to slightly move the camera left and right, up down by a tiny amount, really fast. It actually blurs the screen slightly with no speed loss at all.

http://s6.bitefight.org/c.php?uid=103081
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd Aug 2010 18:44
Quote: "One method you may want to try is to slightly move the camera left and right, up down by a tiny amount, really fast. It actually blurs the screen slightly with no speed loss at all."

...and occasionally causes epileptic fits and temporary retinal damage.

Actually I'll have to try this method as it does sound like a simple solution.

DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 23rd Aug 2010 18:53
Lol. Quite possibly, I stumbled on it due to a bug a while back, where my object was constantly being reset by a tiny amount on the y axis when it landed on a platform. The entire screen was fuzzy from the simple movement

http://s6.bitefight.org/c.php?uid=103081

Login to post a reply

Server time is: 2026-07-23 07:43:12
Your offset time is: 2026-07-23 07:43:12