How are you doing?!
Has anyone watched the movie Sin City?
There is an awesome shot where the camera points to the sky and you can see the actual raindrops falling in cone perspective towards the camera.
I want to do that.
However I have already tried with a particle system but havent’ gotten good results for rain. I am working with a point sprite particle system which works great for snow, but for rain I have no idea what texture should I use. With all the textures that I have tried, It doesn’t look like rain at all.
Any suggestions?! Are point sprites appropiate?! I am totally lost, and haven’t found any 3d real-time rain simulation tutorial or article…
Thanks in advance,
Check out ATIs GDC 2006 presentations about their “Toy Shop” demo. There they explain how they did rain effects.
Point sprites coupled with motion blur should look good. Otherwise, if you can add support for lines (Texture mapped polygons should be great ), that should do the trick.
I would also suggest looking at ATI GDC 2006 presentations. They have a nice rainy night demo with pretty decent/convincing rain effects.
two posts exactly at the same time… What a coincidence
Hi guys! Thanks for answering!
Seems you two got telephaty!
The demo is awesome! It’s something absolutely unbelivable (at least for me). However I didn’t find the explanation… Maybe I missed some links?!
Although I did learn that they use particles made of lines…
Any more data?
Ohhh… I found the paper!
…This seems hard!
However they aren’t using particle systems, so that means rain cannot be viewed from top.
You say motion blur would do the trick?
I’ve done a rain vertex shader, which animates a cloud of line segments falling down and being blown by the wind, wrapping them round at all 6 edges of the frustum so you see every line that is being processed at once. You can fly infinitely through the cloud in any direction, look up, look down, whatever you want. The only CPU work is a single uniform update per frame.
But then, I’m a genius.
and modest to boot.
ive just read the pdf’s (great ati use them now instead of the ppt they once used)
the actual rain technique looks pretty basic (though the other effects like rain on windows etc look great)
ild do it differently.
ild use particles for the closest 100,000 drops or so (even though in reality rain moves faster that u cant see the indivual drops, i have a feeling thisll look better from an asetic point)
hmmm i might implement this myself.
Zed, my CPU already gets slow at 5000 particles,
I don’t think 100,000 particles is possible…
at least with point sprites. What do you think?
I already implemented my rain with a particle system, and I tried using a texture that contains three white lines with glow that simulate rain (aka three rain drops). The rain looks ok from front, although it looks akward if viewed from bottom to top (I see lines instead of drops because of the automatic billboarding of point sprites). And if I apply wind, or particles move more randomly, the fact that the rain drop lines are static, and they don’t follow the actual movement line makes them look real bad.
If instead I use a single water drop texture (round drop, instead of line), it doesn’t look like real rain, it looks like cheap water balls falling from the sky.
Any suggestions on how to handle the texture?!
Knackered… or Mr.Genius (and very modest ), could you explain yourself better?
Man alive, I’m no genius - that was sarcasm - it’s easy to implement what I described.
You shouldn’t be doing any CPU work at all. You shouldn’t even need to use any branching in the vertex shader. It’s all linear arithmetic. Unfortunately I can’t explain how it’s done, as all my work is owned by the company I work for, but what I can say is it’s simple and looks amazingly cool and renders amazingly fast…obviously if you’re going to be using consumer cards you’ll have to address the lack of decent line drawing support.
Originally posted by knackered:
it’s easy to implement what I described.
You shouldn’t be doing any CPU work at all. You shouldn’t even need to use any branching in the vertex shader. It’s all linear arithmetic. Unfortunately I can’t explain how it’s done…
I am not that experienced enough to catch up what knacekered explained about the vertex shader… anybody more experienced than me (and that doesn’t have legal concerns ) could explain me in simpler words the idea he meant to transmit?
Knackered: do you work in a big company? And do they use this effect in a game?
You submit to the vertex shader a set of initial positions for the rain, and you maintain a velocity and time variable for the vertex shader. Animate the rain by using initial position + velocity * time, and wrap the coordinates so that they stay on screen. You could do this in either 2d or 3d…try different coordinate systems to see which one fits what you need (does the rain track camera rotation, movement, etc.)
You can fade out distant rain by using blending and altering color values based on distance, and if lines aren’t giving you good quality then you can try thin screen aligned quads, perhaps even texture mapped with blending to give it a smooth look.
Thanks guys! I am trying to get a better idea now.
And for the aligned mapped quads with blending approach, which textures should I use?
Should I approach for textures that have multiple lines, a single line, or textures that have drawn a single drop and then use motion blur?
P.S: Zed: my particle system does use collision detection. That may be the cause of why 5000 is already slow…
u mentioned looking up into the rain, now i assume the fullscreen quad approach doesnt work attempting this, whereas with particles it does (ill upload a simple rain test i made if u wish)
get here u will need sdl installed,
speed will depend on cpu speed (take a minute to startup)
s to turn off splashs
First of all, thanks!
But I installed SDL and the program does not run because it says “Error 38- No options.txt”. There is no such file in the zip.
Should I create that file and fill it with what?!
Thanks so much!!! :eek: )
Ohhh the problem is another!!!
My graphics card doesnt not have the necessary capabilities! Are you using anything special rather than vertex shaders? Or is it just that my card doesn’t support vertex shaders? Reading the error log i think it has to do with an extension coded as “AltiVec” (???). Is this essential for the rain simulation?
couldn't create the_log_file.log
couldn't create the_errorlog_file.log
Saturday 15 April 2006 02:50:48
.. starting program
.. initializing SDL video
SDL window initialized
setting up game options
**ERROR** no options.txt file
.. initializing bogus SDL openGL window
.. freeing sdl surface
------ CPU info ----------
.. initializing SDL window
.. video mem: 250MB
asking for videomode 1024x768@32
.. compiled with SDL version 1:2:9
.. running with SDL version 1:2:7
resizing window from (1024,768) to (1024,768)
.. initializing rendermanager
-- unsupported opengl extensions --
the graphics card doesnt have the necessary capabilitys
sorry try this
note youll get errors and such since ive removed stuff to make the download small (eg a 220mb terrain file