Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 16,707 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 4
Page 1 of 3 1 2 3
Cheap, Faked Motion Blur (Pro Edition) #78705
06/20/06 17:27
06/20/06 17:27
Joined: Aug 2002
Posts: 681
Massachusetts, USA
Ichiro Offline OP
User
Ichiro  Offline OP
User

Joined: Aug 2002
Posts: 681
Massachusetts, USA


I tried my hand at a largely-framerate-independent motion blur, and figured I'd put it out there for some feedback/bashing/improvement. This basically renders a camera view to a bitmap on a transparent panel, then changes that panel's alpha based on the framerate and desired blurring. First, we define the panel:

Code:
// Load in a blank 1024x768 bitmap to render to:
bmap bitmap_motion_blur="bitmap_motion_blur.tga";

// This is the panel that contains that bitmap:
panel panel_motion_blur {
bmap = bitmap_motion_blur;
layer = -1;
flags = transparent;
}



(See www.dejobaan.com/misc/bitmap_motion_blur.tga for the bitmap_motion_blur I'm using.) Next, we create the function that we use to set the blur amount:

Code:
var motion_blur;
// This essentially sets the transparency (alpha value) of our view at 100fps. Call with values of 0..100:
function set_motion_blur(newval) {
motion_blur=newval;

if(newval==0) {
// No blur; shut off the panel:
panel_motion_blur.visible=0;
camera.bmap = 0;
} else {
// Blur is positive:
panel_motion_blur.visible=1;
camera.bmap = bitmap_motion_blur;
}
}



We then change the panel's alpha value (call this once per frame) to account for framerate:

Code:
if(motion_blur) {
panel_motion_blur.alpha = 100 - pow( ((100-motion_blur)/100), (time/0.16) )*100 ;
}


Changing the amount of motion blur is, then, a simple call to motion_blur(<blur alpha 0..100>).

There are a number of problems with this approach; for example, any semi-transparent panels will appear slightly less transparent. (This is most noticable when motion_blur() is called with low values.) Also, it requires A6 Pro, since it uses the pelican rendering option.

However, it (somewhat) mitigates my largest concern, which is that without the constant re-evaluation of the panel's alpha value, the blurring varies wildly with framerate.

Any thoughts?

Re: Cheap, Faked Motion Blur (Pro Edition) [Re: Ichiro] #78706
06/20/06 20:05
06/20/06 20:05
Joined: Jun 2005
Posts: 656
G
Grafton Offline
User
Grafton  Offline
User
G

Joined: Jun 2005
Posts: 656
I just tried your approach and I think it works suprisingly well!

I wouldnt think the re-evaluation of the panels alpha while the blur is
enabled would be much of a problem, in fact it seems a good idea.

I havent experimented with other panels that have transparency, but if it
causes a noticable, bothersome problem on a prominent semi-transparent panel,
perhaps the affected panels' alpha transparency could be adjusted while the
blur is active?

I changed the set_motion_blur function in mine to fade the blur out when
you "turn it off" instead of it just ending abrubtly like this;

Code:

function set_motion_blur(newval)
{
motion_blur=newval;

if(newval==0)
{
// No blur; shut off the panel:
while(panel_motion_blur.alpha < 100)
{
panel_motion_blur.alpha += 3*time_step;
wait(1);
}
panel_motion_blur.visible=0;
camera.bmap = 0;
}
else
{
// Blur is positive:
panel_motion_blur.visible=1;
camera.bmap = bitmap_motion_blur;
}
}



You always come up with the most amazing stuff Ichiro! Thanks for sharing this.


Not two, not one.
Re: Cheap, Faked Motion Blur (Pro Edition) [Re: Ichiro] #78707
06/20/06 23:45
06/20/06 23:45
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
Very cool indeed !! Judging from your screenshots, the effect is pretty convincing . So all you use as render target is a fully black tga as transparent panel? Nice,

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: Cheap, Faked Motion Blur (Pro Edition) [Re: PHeMoX] #78708
06/21/06 02:15
06/21/06 02:15
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
Yeah, this effect looks very good. There is no problems with transparent panels solong their layers are higher than the blur panel. The only problem that I can find is that Spheres bloom effect doesn't work along with this. When you turn bloom on, the screen slowly turns white and multi-colored. Any ideas? This is great, i'd have it as a feature if it only works with bloom. Looks great with turboboosts. Thanks for sharing.


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/
Re: Cheap, Faked Motion Blur (Pro Edition) [Re: William] #78709
06/21/06 07:04
06/21/06 07:04
Joined: Sep 2003
Posts: 4,959
US
G
Grimber Offline
Expert
Grimber  Offline
Expert
G

Joined: Sep 2003
Posts: 4,959
US
you could try something similar with a 2nd view overlaying the first ( with an alpha transparentcy to teh view

i tried something similar a while back by placing 2 view cameras ( left and right of the center of view point) which thier views overlayed the main view. then all 3 views rotated to focus at one particular spot ( used a trace to simulate varing distant focal point)

rather like how our bifocal eyes work

you can even then tweak the bluring view arc for more distorted stretch

Re: Cheap, Faked Motion Blur (Pro Edition) [Re: Grimber] #78710
06/21/06 15:01
06/21/06 15:01
Joined: Aug 2002
Posts: 681
Massachusetts, USA
Ichiro Offline OP
User
Ichiro  Offline OP
User

Joined: Aug 2002
Posts: 681
Massachusetts, USA
I changed the set_motion_blur function in mine to fade the blur out when
you "turn it off" instead of it just ending abrubtly...


That's a good idea; in fact, I'll have to try having it slide around according to the player's speed and so forth as well.

So all you use as render target is a fully black tga as transparent panel?

Yep; though that brings up a good point -- what's the best bitmap format to use? I'll have to try 565, 888, and 8888.

When you turn bloom on, the screen slowly turns white and multi-colored. Any ideas?

I'm not familiar with Sphere, but perhaps overlaying the entire scene with a semi-transparent black bitmap?

you could try something similar with a 2nd view overlaying the first

I'll give that a try. I'd like to do that without having to render the view twice, though. I'll open a new thread on that.


Dejobaan Games - Bringing you quality video games for over 75 years.
Re: Cheap, Faked Motion Blur (Pro Edition) [Re: Ichiro] #78711
06/21/06 20:17
06/21/06 20:17
Joined: Mar 2006
Posts: 35
Sao Paulo, Brazil
EdMercer Offline
Newbie
EdMercer  Offline
Newbie

Joined: Mar 2006
Posts: 35
Sao Paulo, Brazil
Man, I've tried your 'temporal anti-alias' (since you don't like to call it a *real* motion blur) and it works wonders ! I've 'wired' the ammount of blur to the player speed and it gives a great illusion ! I'll try out some other formats as well to see if there's a big performance impact.

Keep it up !

Re: Cheap, Faked Motion Blur (Pro Edition) [Re: EdMercer] #78712
06/21/06 23:23
06/21/06 23:23
Joined: Aug 2002
Posts: 681
Massachusetts, USA
Ichiro Offline OP
User
Ichiro  Offline OP
User

Joined: Aug 2002
Posts: 681
Massachusetts, USA



I've 'wired' the ammount of blur to the player speed and it gives a great illusion !

That's a great idea; I gave that a try, and it's really neat to see everything blend together at high speeds.

I stuck a vid up here (38MB, XviD), for anyone interested. The compressed video is a bit blurry, so it makes it tough to tell when the in-engine blur is taking place(!)


Dejobaan Games - Bringing you quality video games for over 75 years.
Re: Cheap, Faked Motion Blur (Pro Edition) [Re: Ichiro] #78713
06/22/06 15:34
06/22/06 15:34
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
Hhaha! Very nice movie, I think that gameplay seemed pretty interesting too by the way.

I don't know why, but the movement physics reminded me a bit of the good 'ol Battlezone, must be because of the cool gravity. Anyways, yeah the blur effect is hard to see in the movie, but when the player reaches the level's edge, you'll see it... When everything goes like it should, I'll be having pro within a week or so, and I can't wait already to experiment with this code!

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: Cheap, Faked Motion Blur (Pro Edition) [Re: PHeMoX] #78714
06/23/06 22:16
06/23/06 22:16
Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
XNASorcerer Offline
Expert
XNASorcerer  Offline
Expert

Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
Yes, really nice effect!

Page 1 of 3 1 2 3

Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1