Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am developing a 2d android strategy game, it runs on SurfaceView, so I can't(or can I?) use LibGdx's particle system. And I would like to make a raining effect, I am aiming for something like this( http://ridingwiththeriver.files.wordpress.com/2010/09/rain-fall-animation.gif ), I don't need the splash effect in the end (although that would be superb, but probably would take up a lot of system resources). How could I achieve that raining effect? Any ideas?

Thank You a lot in advance!

share|improve this question
add comment

4 Answers

Conserve your precious CPU/GPU cycles! You can inexpensively approximate rain (and rain splats) without using particles. The rain drops and splats don't even have to move or be aligned! Basically, randomly draw a bunch of the following sprites onto the screen:

enter image description here

Source: bulletproofoutlaws.com (There's also a video of the final effect)

share|improve this answer
    
(Y) Thanks a lot!:D –  user19495 Sep 2 '12 at 10:47
add comment

I made a rain shader for 3D without using any particles at all (Video) but instead using three layers of the same texture scrolling by at different speeds at different scales as described in the article Rendering Falling Rain and Snow.

For 2D you obviously would not want a double cone to project your rain textures on but can use a plane instead. You can however use the effects with twisting a little (I think, haven't tested it) to create a feeling for velocity left or right. For back or forward you could just scale a little along the y-axis.

share|improve this answer
add comment

since it's a 2D game, I don't think you'll need a complete particle system to create beautiful rain. here is an idea : just create a rain animation and tile that all over the screen.

share|improve this answer
    
What kind of animation do you mean exactly? Thank You for answering :). –  user19495 Sep 1 '12 at 20:39
    
I can't find something I like right now, but the idea is simple. animation should be only rain drops moving down, also it should be repeatable, and tile-able. every other pixel in each frame is completely transparent –  Ali.S Sep 1 '12 at 21:59
add comment

Somehow, very primitive Java example without using shaders.

    class ParticleSystem
    {
    int maxParicles=10000;
    float ParticleMaxLifeTimeMS=5000;
    particle[] Particles;
    emitter Emitter;
    billboard BillBoard;
    public void Emitt()
    {//emission code goes here}
    public void Evolve()
    {//explosion code goes here}
    class particle
    {
    float SpawnTime;
    float CurrentLife
    float x,y;
    float Vx,Vy;
    float r,g,b,a;
    float mass;
    float scale;
    }

    class emitter
    {
    float x,y;
    float EmissionRate;
    }

    class billboard
    {
    int materail_handler;
    float height,width;
    }
    }
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.