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 making a game in that game I want a rain effect. I am little bit far from this right now. I am creating the rain effect like below:

particleSystem.addParticleInitializer(new ColorInitializer(1, 1, 1));
particleSystem.addParticleInitializer(new AlphaInitializer(0));
particleSystem.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
particleSystem.addParticleInitializer(new VelocityInitializer(2, 2, 20, 10));
particleSystem.addParticleInitializer(new RotationInitializer(0.0f, 30.0f));

particleSystem.addParticleModifier(new ScaleModifier(1.0f, 2.0f, 0, 150));
particleSystem.addParticleModifier(new ColorModifier(1, 1, 1, 1f, 1, 1, 1, 3));
particleSystem.addParticleModifier(new ColorModifier(1, 1, 1f, 1, 1, 1, 1, 6));
particleSystem.addParticleModifier(new AlphaModifier(0, 1, 0, 3));
particleSystem.addParticleModifier(new AlphaModifier(1, 0, 1, 125));
particleSystem.addParticleModifier(new ExpireModifier(50, 50));

scene.attachChild(particleSystem);

But it looks like snowfall! What changes can I do for it to look more like rain?

EDIT Here is a screenshot:

enter image description here

share|improve this question
3  
Unfortunately I can't parse these lines of codes into an image inside my head ;). If you can show us an image or video I'm sure we can give you some tips. –  Roy T. Jun 16 '12 at 6:59
    
its only a blank screen and its show particle like snow i just want particle show like rain effect @RoyT. –  Nikhil Lamba Jun 16 '12 at 7:21
1  
@NikhilLamba Upload it to imgur then link to it. See the formatting help for how to create links. You can't add images into your posts yet since you haven't unlocked that privilege - so for now just go with a link. –  Jonathan Hobbs Jun 16 '12 at 8:14
3  
You should try making the rain sprites more blue and more long stretched. Use this (ridingwiththeriver.files.wordpress.com/2010/09/… ) as a reference image. –  Roy T. Jun 16 '12 at 11:12
1  
+1 Nikhil, a nice improvement on your last question. –  Byte56 Jun 16 '12 at 15:13
show 6 more comments

4 Answers

up vote 13 down vote accepted

Fundamentally, it looks like snow because the particles are round and they don't convey motion in any way. Rain drops are typically seen as elongated droplets, even to the point at which they are lines rather than particles. Think of a scene where you are looking out of a window at a rainstorm: you're not seeing individual drops suspended in the air, you're seeing the streak of the path they follow.

You could try stretching the particles out along one axis, but I think you're not going to be able to get a rain-like effect with particles like these.

share|improve this answer
    
Here's an example of such a rain effect in a 2D game: youtube.com/… Though I must admit it looked better in my memory. :-) –  Eric Jun 16 '12 at 10:35
1  
Here's an example of rain: youtube.com/watch?v=e9GOB6DSMZs –  Pubby Jun 17 '12 at 6:38
    
@MrCranky : Thanx a lot for ur answer , as u said "but I think you're not going to be able to get a rain-like effect with particles like these" then how can we do ? –  Nikhil Lamba Jun 18 '12 at 5:22
    
@Eric : Thanx for youtube Link :) –  Nikhil Lamba Jun 18 '12 at 5:23
    
@Pubby : thanx for Link :) –  Nikhil Lamba Jun 18 '12 at 5:23
show 3 more comments

Also, aside from what MrCranky said, rain does not really have a color, it more just deforms the world around it, so to get accurate rain you really need to be using shaders. That said, you can fake it using long streaks (like what MrCranky said) that are all in line with eachother

share|improve this answer
    
Thanx a lot for your answer , But as u said "that are all in line with eachother" as i am using a Sprite as a rain partilce how can i use line attach with each other –  Nikhil Lamba Jun 18 '12 at 5:27
    
well i mean just use the same angle for the streaks (it should be like a line) –  CobaltHex Jun 18 '12 at 21:22
add comment

Snow "Flutters like a Feather" and Rain "Falls with a Flop"

Simple solution may simply be to increase the gravity so rain drops falls faster and less "snow like"

Making snow versus rain has the following characteristics

  • Snow is basically a solid round thing that doesn't deform
  • Snow has air resistance / drag so it falls slowly and gracefully with a relatively low maximum velocity
  • Snow is easily affected by air turbulence (example, a wind affector) and zigs and zags as it descends ... and event ascends for that realistic feel of a passing breeze

Rain is pretty much the opposite of the above Snow

  • Rain deforms as it falls
    • easiest visual change is to stretch the rain drop sprite based on the speed of the raindrop
    • this gives the impression of motion and speed
  • Rain is less affected by wind or air resistence
    • a strong wind affector can nudge the path of descent but only mildly (and really only worth accounting for this if more realism is the goal)

So ...

  • As the others suggest, use a sprite sheet to animate the drops as they fall
    • sprite sheet of event two sub-sprites is useful ... example: "drop" and "splash"
  • Stretch the texture to give motion
    • scaled relative to a min/max velocity range (eg, normalize 0..1 and scale "drop" accordingly when you paint the texture)
  • stronger gravity
    • potentially "substantially" more than your environment's normal gravity to make rain have a good "look and feel"
share|improve this answer
add comment

You're only going to be able to get so far with just changing the graphics. I'd personally start with long blue rectangles and stylize it from there. Look at how Minecraft does raindrops.

What's really going to make it feel like rain is the sound you use. Find a free rain ambient track somewhere on the internet and loop it. As long as there are enough particles and they're moving fast enough downwards your mind will make the connection to rain.

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.