8
\$\begingroup\$

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!

\$\endgroup\$
0

4 Answers 4

11
\$\begingroup\$

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)

\$\endgroup\$
0
5
\$\begingroup\$

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.

\$\endgroup\$
2
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ What kind of animation do you mean exactly? Thank You for answering :). \$\endgroup\$
    – user19495
    Sep 1, 2012 at 20:39
  • \$\begingroup\$ 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 \$\endgroup\$
    – Ali1S232
    Sep 1, 2012 at 21:59
2
\$\begingroup\$

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;
    }
    }
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .