Jump to content


Photo
- - - - -

Realistic Windy Snow With Motion Blur


  • Please log in to reply
27 replies to this topic

#1 petenka

petenka

    The Chosen One

  • New Member
  • 911 posts

Posted 27 December 2009 - 02:05 AM

  • Title: Realistic Windy Snow with Motion Blur
  • Description: An example of how to make windy snow that looks real by using motion blur and averaged randoms.
  • GM Version: 8
  • Registered: Yes
  • File Type: .gmk and .exe and .scr installer
  • File Size: 686 KB and 2.9 MB and 14.96 MB
  • File Link: .gmk and .exe and .scr installer
Additional Info
The movement is a combination of the following...
  • Gravity
  • Friction
  • Averaged directional changes
  • Double averaged wind changes
The averaged stuff is the most complex part and is the key to how the snowflakes move around realistically.

The motion blur is drawn by simply stretching the snowflake along it's path of travel and then lowering alpha to account for the larger snowflakes.

I apologize for making this gm8 pro only but I provided an exe for those who don't have gm8 pro. Maybe someone who isn't as lazy as me will port this to earlier versions of gm.

And now... The screenshot!
Posted Image

Edited by petenka, 09 November 2011 - 09:43 PM.

  • 0

#2 SolvedSnake

SolvedSnake

    GMC Member

  • New Member
  • 21 posts

Posted 28 December 2009 - 12:56 AM

This looks great!
The blur effect is just pure awesomeness!
When I look at it, it tickles my eyes ;)
Although it uses a bit much horsepower... I don't know if that could be improved a little :huh:

Edited by SolvedSnake, 28 December 2009 - 01:01 AM.

  • 0

#3 petenka

petenka

    The Chosen One

  • New Member
  • 911 posts

Posted 28 December 2009 - 12:59 AM

Although the speed could be improved a little bit ;)

Well, I couldn't use particle effects because they don't have the features needed to make snow like this.
Instead I used an object for each snowflake.
Granted, it's not very fast, but it's easier to make and understand.
Even so, it still runs at a decent 45 fps for me.
Perhaps someone who isn't as lazy as me will make this example use data structures instead of objects...

Edited by petenka, 28 December 2009 - 01:09 AM.

  • 0

#4 dadio

dadio

    I miss my cupcake

  • GMC Member
  • 1845 posts
  • Version:GM:Studio

Posted 28 December 2009 - 01:18 AM

Very nice! ;)
Really lovely realistic softness, movement & blurring.
Excellent example! (& very much in the "Christmas time" spirit) :huh:
Thanks for sharing!

Edited by dadio, 28 December 2009 - 01:20 AM.

  • 0

#5 Dylijn

Dylijn

    GMC Member

  • New Member
  • 553 posts

Posted 28 December 2009 - 11:31 AM

Dam, cant see it otherwise then the exe cuz I dont have GM8...
  • 0

#6 membrain

membrain

    GMC Member

  • New Member
  • 667 posts

Posted 28 December 2009 - 02:20 PM

wow that really does look cool.
good job on this one-
  • 0

#7 coolist

coolist

    The Coolist

  • New Member
  • 913 posts

Posted 28 December 2009 - 03:46 PM

Wow that looks nice.

(And who ever hosted that image also has a great free, fast, image/file hosting service *Cough* ;) )
  • 0

#8 Devilfromhost12

Devilfromhost12

    GMC Member

  • GMC Member
  • 735 posts

Posted 29 December 2009 - 02:01 AM

Very nice it looks great.
  • 0

#9 Newly Discovered

Newly Discovered

    Harmonious Genius

  • New Member
  • 2467 posts
  • Version:GM8

Posted 29 December 2009 - 07:37 AM

wow, that's purdy gorgeous!
I would absolutely love to see this in 3D space...you would be a god.
  • 0

#10 masterofhisowndomain

masterofhisowndomain

    The Designer

  • GMC Member
  • 3643 posts
  • Version:GM8.1

Posted 29 December 2009 - 08:36 PM

That is really quite exceptional snow, although I still think you should go the extra mile and use those data structures... :whistle:
  • 0

#11 petenka

petenka

    The Chosen One

  • New Member
  • 911 posts

Posted 29 December 2009 - 09:05 PM

Update

I modified the code which handles random directions so the snow looks much more real when the wind is calm.
I also simplified the averaged random code to make it easier to understand and modify.

@everyone - Thanks for all your support. Keep it up!

@Coolist - Thanks for the great file host. I don't use it to host the actual example though because it's easier to update it on my svn quickly from my computer.

P.S. The nearly empty object called snow is the beginning of my attempt to switch to datastructures.

Edited by petenka, 29 December 2009 - 09:26 PM.

  • 0

#12 Devilfromhost12

Devilfromhost12

    GMC Member

  • GMC Member
  • 735 posts

Posted 31 December 2009 - 12:36 AM

Cool Snow. Nice example.
  • 0

#13 B Factory LLC

B Factory LLC

    We're awesome!!

  • New Member
  • 511 posts

Posted 31 December 2009 - 01:46 AM

Yeah, this is cool. Like the blur. Convert to 3D please, this would be useful in the mountain city of Invasion. (see sig.)
  • 0

#14 CrazyTM

CrazyTM

    GMC Member

  • New Member
  • 121 posts

Posted 31 December 2009 - 08:46 AM

Very nice! :whistle:
Really lovely realistic softness, movement & blurring.
Excellent example! (& very much in the "Christmas time" spirit) :)
Thanks for sharing!


yes i agree :D
i really like the effects (blurring , smooth wind..)..it makes it look more realistic.
  • 0

#15 Newly Discovered

Newly Discovered

    Harmonious Genius

  • New Member
  • 2467 posts
  • Version:GM8

Posted 02 January 2010 - 11:57 PM

I've finally been able to look at the source of this, and it's awesome. Ds_list would make a huge cpu difference, also, I added a star of lines in the center of your snowflake sprite, it added a bit more...snow flake-ness to it.
I really hope to see this in 3D...it would blow my mind.

Good luck!
  • 0

#16 petenka

petenka

    The Chosen One

  • New Member
  • 911 posts

Posted 03 January 2010 - 12:34 AM

I've actually been experimenting with this in c++ which is known for being super fast and yet, it barely runs faster than gm.
This evidence has led me to conclude that it's not the object overhead but rather just drawing a thousand alpha blended sprites.
When i moved all the snowflakes offscreen but still active, the fps jumped up enormously.
So, ds_lists won't give much of an improvement.
When I decide to work on a 3d game, I might convert this to 3d, but for now the depth system already provides enough 3dish goodness in 2d.

EDIT: UPDATE
After trying to implement my snow into my comp 5 game I realized it failed when it came to views so after some confusing work with views I finally got everything to work absolutely perfectly with views. The motion blur and depth all work perfectly.
Use the 4 arrow keys to move the view.

Also, if you noticed, each snowflake has a distance. When it is equal to 1 the snowflake moves relative to the player and his surroundings. When it's below 1 the snowflakes are in the foreground moving quickly and if it's greater than 1 they are in the background moving very slowly.
Feel free to utilize this distance variable to give each snowflake a depth, thereby drawing some behind the player and some in front for added realism.

Edited by petenka, 03 January 2010 - 03:26 AM.

  • 0

#17 Schyler

Schyler

    Noskcirderf Derf

  • GMC Member
  • 2445 posts
  • Version:GM8.1

Posted 13 January 2010 - 06:35 AM

This is very good. Keep up the good work.

Any chance of this working in 3D in the future? Render to a texture...?
  • 0

#18 DZiW

DZiW

    GMC Member

  • GMC Member
  • 727 posts

Posted 13 January 2010 - 01:16 PM

IMO using too many objects (for every flake) is rather lame approach.
How about sprite clustering and/or elements grouping so that one object/ sprite could refer to some 5 or 10 flakes?

Anyway looks pretty nice)
  • 0

#19 Topaze22

Topaze22

    GMC Member

  • GMC Member
  • 58 posts

Posted 13 January 2010 - 03:59 PM

With only 100 snows elements, it's stay very nice and not too heavy.
I will probably use it ^^ (and put you in the credit)
  • 0

#20 petenka

petenka

    The Chosen One

  • New Member
  • 911 posts

Posted 13 January 2010 - 07:43 PM

This is very good. Keep up the good work.

Any chance of this working in 3D in the future? Render to a texture...?

3D would be very different actually. Perspective would already handle depth for me, motion blur would involve some crazy 3d perspective calculations and so would wrapping the snowy region into the viewable area. Nonetheless, it can be done, you just need some good knowledge of perspective transformations. Yourself's 3d to 2d conversion scripts would come in handy here.
Rendering it to a texture would make it impossible to create motion blur using the technique that I use. And GM doesn't have shaders, so textures simply wouldn't work.

IMO using too many objects (for every flake) is rather lame approach.
How about sprite clustering and/or elements grouping so that one object/ sprite could refer to some 5 or 10 flakes?

Anyway looks pretty nice)


Just add a draw event with a bunch of draw_sprite_ext with different offsets so each snowflake draws itself multiple times. You can even randomize the offsets at snowflake creation to make it more random. This would give you a small speed boost. You can also try to make it use arrays or ds_lists instead of objects if you really want to optimize it.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users