| View previous topic :: View next topic |
| Author |
Message |
padam
Joined: 04 Feb 2009 Posts: 48 Location: Pokhra, Nepal
|
Posted: Wed Sep 02, 2009 5:54 am Post subject: rain effect ??? (rainy environment)... |
|
|
Hola everyone..
I want to use rain effect on one of my game level(it would be rainy environment). So i want to know has anybody used the rain effect on their game ?? How to do that efficiently ??? need just ideas and suggestion....
Gracias. |
|
| Back to top |
|
 |
rhino Regular
Joined: 05 Oct 2008 Posts: 173
|
Posted: Wed Sep 02, 2009 6:26 am Post subject: |
|
|
| A way to cheat would be an 'overlay' animation over the entire area. |
|
| Back to top |
|
 |
NateS Game Developer

Joined: 25 May 2008 Posts: 577
|
Posted: Wed Sep 02, 2009 7:08 am Post subject: |
|
|
http://tinyurl.com/l47pke
First result has link to a very good effect:
http://www.gamedev.net/community/forums/topic.asp?topic_id=193344
I doubt you need 3D rain though.
Write your own particle system. Each particle is a falling rain drop. Each frame, move the drops down at different speeds, possibly fading them out as they reach the ground, maybe making some of them twinkle occaisionally (just draw them in a brighter color for a frame or two). When a drop reaches the bottom, recycle it to the top.
There are many ways to optimize this, but only bother if you need the performance. You could manage the locations and colors in ByteBuffers and make the OpenGL calls yourself. This way one glDrawArrays call can draw them all. Or you could use point sprites. You could also possibly draw each drop multiple multiple times at different X locations on the screen.
It would be neat for a platform game to make the wind "blow" at an angle when moving the screen forward. _________________ SingSong Karaoke - http://singthegame.com |
|
| Back to top |
|
 |
padam
Joined: 04 Feb 2009 Posts: 48 Location: Pokhra, Nepal
|
Posted: Fri Sep 11, 2009 5:25 am Post subject: |
|
|
Gracias all.
I have created a decent rain effect for my 2d game. I have created a class called RainDrop which extends Polygon classs, and it has got properties like velocity,x,y,length. So i am initializing an array of say 100 rain drops(which are polygons) with their initilized properties and i am assigning their x and y positions randomly with random() function and i m making them fall with their given velocities. And when they reaches ground, i am reusing them.
Its looking pretty good with the nice background. Now i M goona put some wind factor also as nates suggested.
Gracias. |
|
| Back to top |
|
 |
Gilley55
Joined: 26 Sep 2009 Posts: 42
|
Posted: Tue Oct 27, 2009 1:53 pm Post subject: |
|
|
you don't mind sharing your wind and rain class do you?
i need something like that for my game and is it possible to get a preview of it in action? |
|
| Back to top |
|
 |
padam
Joined: 04 Feb 2009 Posts: 48 Location: Pokhra, Nepal
|
Posted: Fri Mar 05, 2010 5:40 am Post subject: |
|
|
I am sorry, I didnt checked this thread.
Yeah i have written a blog post on this. You can read it. But i haven't created a wind class, i am sure u can do it that. I am no experts on making fancy effects. This is very simple rain effect which does the job that i needed for my game. Alpha values can also be added to each drops for more good effect.
My code might not be efficient. You can download the demo here http://www.gaanza.com/demos/
http://www.gaanza.com/blog/2d-rain-effect/
Gracias. _________________ http://www.gaanza.com/blog |
|
| Back to top |
|
 |
|