Archived

This topic is now archived and is closed to further replies.

X5-Programmer

Rain Particle Effect

Recommended Posts

hi, i have make an terrain in order to use to a game, and now i whant to put in some rain effect, can someone explain how to do it or post some links/tutorials were i can find some backup :]. thx,

Share this post


Link to post
Share on other sites
i would use particles, maybe large ones with many raindrops on it (i.e. a 32x32 quad with many little rain-like specks), since i think doing each drop as an individual particle would be slow.

Share this post


Link to post
Share on other sites
Give each of the drops a bluish white shade and exaggerate their size considerably. They should fall at a bit of an angle, but it really isn''t necessary for the angle to change.

The main problem to consider is that rain is generally an omnipresent thing. With a particle simulation you could have rather a lot of particles. Instead, it could be worthwhile to simple overlay a smaller 2D particle system on the display itself and disable or enable it as the player enters or leaves "rain areas". Or have the raincloud hover over the player But seriously, rain won''t add anything to the image beyond a certain range, so you don''t have to render all of it, just the bit around the player. This has an advantage over the 2D simulation in that you can actually show the drops hitting the ground.

Share this post


Link to post
Share on other sites
I used Vertex Buffers that have a fading alpha value based on there life and they fade to transparent.. I also made it so they fall then, once there life is gone it replaces them into a new location and reuses them for another raindrop, the raindrops are stored in an array of x raindrops.

I made it so the rain was relocated by a random value that was generated by the size of the rain box/cube (height width depth ect.), or area that the rain exists (falls in). The rain in the shape of a 3d diamond or 2 paramids connected at there base, (I forget the objects technical name).


Final effect but its kinda hard to tell in this screenshot is something like this:


[edited by - DevLiquidKnight on March 17, 2004 12:57:35 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
just make a particle system with billboarded partly transparent quads and then each time you create the new particle get the camera position and then do something like this:

particleList.x = (float(rand()%200)/100.0f) + cameraPos.x;
particleList[i].y = some_height_above_camera;
particleList[i].z = (float(rand()%200)/100.0f) + cameraPos.z;

//.... draw particles and decrement their height so they fall down

pretty much all thats doing is creating a 200x200 square centered above the player and starting the rain drops randomly in the square, you could make the particles cover the whole terrain but thats kind of a waste of CPU power and it wouldnt be very nice to your frame rate either.

Share this post


Link to post
Share on other sites
I always wondered about using lines for rain. You could have the "head" of the rain line with a high alpha value, and the "tail" with a low value, so it kind of fades out towards the end. It's not perfect (billboarded quads with tiny raindrop textures is the probably the best-looking solution), but it might overcome the problem that Promit pointed out with the other methods: rendering-wise, it's cheap, and you could have a lot of rain. I think this is the way rain is generated in Splinter Cell, and it looks pretty good...


Windows 95 - 32 bit extensions and a graphical shell for a 16 bit patch
to an 8 bit operating system originally coded for a 4 bit microprocessor,
written by a 2 bit company that can't stand 1 bit of competition.


[edited by - iNsAn1tY on March 18, 2004 10:08:07 AM]

Share this post


Link to post
Share on other sites
I orginally tried lines for rain but I personally didn't like it very much. However I added an enum type to allow me to specify which type of rain I want to use therefore I can still use the lines if ever deemed neccessary. It looked kinda good would be better though if I would have added in a splashing effect on the terrain once it collided with the ground but I haven't done enough 3D collsion detection yet, along with not enough 3D based physics, so I wouldn't know.

However an idea though would be to use point sprites for this, I converted mine to point sprites at one point of time but it lagged quite a bit; mainly because I wasn't able to figure out how to resize the point sprite when I orginally made it. Which I have improved since then, however it depends on what effect your planning to achieve.

The best way I have found to do it is to make a main class object that acts as a particle system manager; which basically "manages" all the types of partilce systems you wish to use throughout your project. Then have extended objects from that object such as a rain particle system, bullet trail particle system, smoke particle system, and other varities of particle systems.

Also if you want you can make some form of lightning effects if you are aiming to create some sort of weather system, a couple ways you could do this is have differnt shaped objects that are made from nothing more then a somewhat randomly generated jagged white alpha fading line, you could randomize this with a few variables and then make a 3D based sound system for it as well. So that you could put a lightling object somewhere in the sky at random, at the same spot you put the lightning you can also put the thunder sound at that location. Which will lead to some pretty intresting effects.

Also, if you can figure out a way make it so if the lightning is in front of the user the screen has a 30% alpha fading quad drawn across the view matrix which fades quickly this will lead to even more realistic effects. Then again you don't really need to check if its in front of the user its just an idea.

[edited by - DevLiquidKnight on March 18, 2004 5:37:39 PM]

Share this post


Link to post
Share on other sites
I would go for LOD...
use big falling quads textured with lots of rain drops far away (and if you look at a real strong rain, you don''t _see_ rain drops that are far away, you only see big fuzzy moving masses), then alpha weighted lines, then only for drops really close to the viewer, use a few textured billboards...

iNsAn1tY> that''s what NVIDIA uses for hair in their dawn and dusk demos. and using alpha (along with fsaa), is the only way I can think of to make lines not look bad...

DevLiquidKnight> actually, I saw a demo (on these forums I think), with rain modeled with lines, that didn''t look bad at all... it was in fact really nice. I think it used alpha, and used a variable line width, so nearby drops were rendered bigger than far away ones...

Share this post


Link to post
Share on other sites