rain?

Started by
10 comments, last by tasseloff 19 years, 4 months ago
Alright.... i got to a good point with my water simulation...i think i got the reflections right, the waves seem not bad...i haven't touched fresnel refractions yet because i think i need to focus on the main goal of my project first and that is to create a simulation of rainfall, however, even tho i can simulate the wave that a raindrop will do on my water surface, i don't know how to actually program a visual rain drop falling from the sky onto my water surface and then creating the wave.... any suggestions would be greatly appreciated as im really not sure where to start...i could always create many many small spheres falling down at a certain speed i guess....i really doN't know :/
Advertisement
I am by no means experienced with much of anything graphical, but here's an idea that I had as I read your post.

Have a sphere or a box like you were saying fall down to your water surface. You could texture it in a water texture having transparency or whatever you like, then just test for an intersection of the boxes with the water surface to trigger a ripple/wave going? Again, i'm not experienced with this sort of thing, just seemed like something that might work. Good luck.
yeah this sounds not bad....its actually the only way i can imagine to do it...im just afraid this is gonna really slow down my simulation tho....it would mean a heck of a lot of small sphere falling down from the sky at the same time...

but i guess unless someone else has a better idea ill have to go in that direction...
tks for the reply
Generally, the way it would be done is with a particle system. It is a little more complicated in your case, since you want to also collide the particles with the water to make ripples.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Why couldn't you just use texture effects? Blend a texture onto the location of the water where the drop hit, with the ripples moving outward, until they fade past the edge of the texture.

I'm not a 3D graphics person, can anyone tell? :-)
=========================Buildium. Codium. Fragium.http://www.aklabs.net/=========================
What you're actually looking at here is two effects, possibly three:
(a) Raindrops
(b) Raindrop impact effects on water/ground
(c) Raindrop impact effects on camera

The water/ground stuff you can do with texturing. The camera stuff you could also do with texturing, though you might want to look into a refraction system or something.

The raindrops themselves are usually just rendered as a line list and handled as particles - but bear in mind that if you were to render a whole field of rain, you'd basically just end up rendering a solid block of colour across the screen. What you want to do instead is to just have rain for the first X metres away from the camera, and move the rain 'with' the camera (while you're inside the rain field, of course), accounting for the direction the camera's looking in so that the rain is always falling straight down. That way the amount of rain you render is only dependent on the 'density' of the rain, rather than the area covered.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

You can do something like this:
http://www.geocities.com/opengladiator/imagenes/LLUVIA.zip

The camera always is into a box, something like a skybox, where drops are falling over and over again(particle system). For example you can have 1000 drops. Each drop falls from the top of the box to the bottom, when it reaches the bottom it is restarted in a new position on the top. You can draw the drop as a line or textured box, spheres,...

In the demo the rain box is always in the same position.

I don't know if this is a bad solution, but you can try it.

Sorry but the code of the demo is very bad and the speed is dependant of the CPU speed. I was very young when I wrote it.

I Hope this helps you
============================== Videoman Library Project
hmm ok
tks for all your answers....
i guess im gonna try to look into a particle system, i just hope it won't me too complex to implement.
Actually you could do it without particles (at least the rain you could, anyway) - so long as you didn't need to know precisely where each drop was hitting.

Make 3 polygons big enough to fill the camera, and use the same rain texture on all 3 of them (just a semi-transparent (or fully transparent, your bag) dark blue/grey texture with raindrops falling straight down). Depending on the density of the rain, make the texture size larger or smaller, and change the velocity of the texture. Then set the polys at just in front of the camera, at the limit of the drawn scene, and again in the middle. This way you've created the effect of a dense rain field, but you've done it really easy without using a particle system. And as for the water on water effect, you could just randomly generate a number of places on the water to do that each frame, and have them ripple until their lifespan was over; and only have xx alive at a given time.

It would be a good placeholder until you got a particle system up and running, if nothing else.
=========================Buildium. Codium. Fragium.http://www.aklabs.net/=========================
hmm yeah....but i think im gonna have to go with the particle system anyway unless i really run out of time because i was actually trying to build a simulation so that would be a bit too far from my original goal

This topic is closed to new replies.

Advertisement