Author Topic: Motion Blur  (Read 5152 times)

v6v

  • Clever
  • Fanatic
  • ***
  • Posts: 500
  • Has renamed his project to Galaxy!
    • View Profile
    • My Developer Page!
    • Email
Motion Blur
« on: 2008-07-18, 08:22:27 PM »
Can I have some advice or code for motion blurs in Sonic games?

Jam0864

  • Contributor
  • Fanatic
  • **
  • Posts: 744
    • MSN Messenger - marmalade0864@hotmail.com
    • View Profile
    • Jam0864's Content Dump
    • Email
Re: Motion Blur
« Reply #1 on: 2008-07-18, 10:31:21 PM »
if your talking about how he spins when he's jumping, it's just done in the tilesets, the creator just drew the blur on the sprites in the tileset.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Motion Blur
« Reply #2 on: 2008-07-19, 05:50:10 AM »
However, if you're interested in other forms of motion blur, we stumbled across another means of creating motion blur accidentally in the sample project.  When the graphic equalizer was added in the background, the background's transparency was increased (it didn't used to be transparent at all) leaving some parts of the background that weren't entirely erased from the previous frame.  This caused motion blur.  The player sprite would be in one position for a frame, then move to another position, but when the background was re-painted, it didn't totally erase the old position because the tiles weren't totally opaque.  The drawback to this method is that it only works when the sprite is actually moving to a new location on the screen.  If the map is scrolling behind the sprite because the sprite is at the scroll margin and staying in the same place on the screen while the background scrolls, then you won't get any motion blur except for the blur left by animating the sprite to a different frame in the same place.

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: Motion Blur
« Reply #3 on: 2008-07-19, 08:01:38 AM »
another way i would try is you have the sprite's frameset (or tileset, i dont work much w/ sgdk2) and have it at 100% not transparent (i dont know what they call it), then 75%, 50%, 25% (or by 20s or 10s, if you want it more linear) then make a copy of each sprite with their different transparency levels and (in sgdk1 terms) follow the player sprite. that's my best guess on how to do that...then again, i dont usually work with SGDK2 much, (after RANAT ill start on it)
Looking to the skies.....

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Motion Blur
« Reply #4 on: 2008-07-19, 10:12:38 AM »
I think I understand what you're saying there, SmartBoy.  I'd try it out if I could, but alas, the SGDK2.1 IDE doesn't work with Mono (yet, it's another story) and I haven't got a copy of Windows around to dual-boot from.

In SGDK2 it would be quite simple, in fact, since you can create the same sprite and just change one tiny little attribute (Alpha) when placing them on the map.

You would need a real player sprite, then a fake player sprite who doesn't have any of the rules but has all the same states (or perhaps only the running states?)  You would need a rule to follow the player sprite, and a rule to change states when the player does.  Actually, you could even make the sprites dynamic, and not worry about that second part.

If (speed > 10) -> create a 128 (out of 255) transparent sprite that follows the player (facing the same direction as the player)
if (speed > 20) -> create a 64 transparent sprite that follows the 128 transparent sprite
if (speed > 30) -> create a 32 transparent sprite that follows the 64 sprite
etc.

Then each dynamic sprite can just disable itself if it ever comes within a few pixels of the sprite it's following.  Note that the following would have to be quite quick so that as the player moves perpendicular to the main axis of motion, the blur sprites don't start moving toward the player's position on a different path than how the player got there.  And of course you'd only want to create those dynamic sprites once rather than every frame that the speed is > 10 or whatever number.
Edward Dassmesser

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: Motion Blur
« Reply #5 on: 2008-07-19, 12:10:02 PM »
you

v6v

  • Clever
  • Fanatic
  • ***
  • Posts: 500
  • Has renamed his project to Galaxy!
    • View Profile
    • My Developer Page!
    • Email
Re: Motion Blur
« Reply #6 on: 2008-07-20, 04:20:08 PM »
I'm confused...

I think you guys are talking about (afterimages?)

http://www.youtube.com/watch?v=Y8SuCZqu6zY

Watch the beginning of this video- You'll see what I mean...


Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: Motion Blur
« Reply #7 on: 2008-07-21, 02:56:17 AM »
oh man!! why don`t you say you want SPEED LINES?? that

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Motion Blur
« Reply #8 on: 2008-07-21, 05:30:28 AM »
Are you talking about blurring the background?

v6v

  • Clever
  • Fanatic
  • ***
  • Posts: 500
  • Has renamed his project to Galaxy!
    • View Profile
    • My Developer Page!
    • Email
Re: Motion Blur
« Reply #9 on: 2008-07-21, 01:29:35 PM »
Ya! Blurring the background
(I think Blender might have a motion blur feature? Well, so I've heard...)
You think there can be source code for it, like the weather project?
Quote
oh man!! why don`t you say you want SPEED LINES?? that

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Motion Blur
« Reply #10 on: 2008-07-21, 05:04:59 PM »
Well, I bet if you make your whole background translucent, it will blur as one version draws over another without completely erasing it.

v6v

  • Clever
  • Fanatic
  • ***
  • Posts: 500
  • Has renamed his project to Galaxy!
    • View Profile
    • My Developer Page!
    • Email
Re: Motion Blur
« Reply #11 on: 2008-09-14, 07:36:17 PM »
Eh........
 >:(
Google up Sonic GL and go to the homepage...
Scroll down, you'll see what I'm talking about.
It's a 3D motion blur shader

Could something simular to that be implemented for a 2D game
( Or 2.5D for my game because all of the sprites are already pre rendered)