Marko Srdanovic (mas++at++swl.msd.ray.com)
Mon, 3 Feb 1997 17:03:08 -0500
To implement rain, I took the suggestion from Dennis Pierce in the archive
ftp://sgigate.sgi.com/pub/Performer/selected-topics/atmospheric-fx for
implementing rain. He suggested using a 2d grid and placing "drops" randomly
along the top row and moving them down each frame. I used OpenGL in a postdraw
callback to implement this. I ended up using GL_LINES for the drops.
Basically, the line gets moved down by one row each frame.
This worked well, but wasn't quite right because it was too rigid. I decided
to get rid of the columns and created the lines in a random position along the
screen and moved them down one row each frame. This was better, but still too
rigid. Basically, I ended up dumping the grid and created lines of random
length, randomly along the top row. Then, I move each line down the screen at
a rate proportional to its length (ie., longer lines "fall" faster than shorter
ones). All the drops are kept in a list and removed from the list when they
reach the bottom of the screen. The random length and rate sort of gives the
rainfall some sense of depth. It's not perfect, and a ton of random numbers
get generated, but it seems to work well.
I haven't tried creating geosets of PFGS_LINES but still think this might have
better results since drops drawn in the postdraw callback never seem to
"disappear" behind objects in the scene.
Good luck.
--
-----------------------------------------------------------------------
Marko Srdanovic mailto:mas++at++swl.msd.ray.com
Raytheon Electronic Systems voice: (508) 858-5680
Mailstop: T3MR8 fax: (508) 858-4336
50 Apple Hill Drive, Tewksbury, MA 01876 #include <std/disclaimer.h>
-----------------------------------------------------------------------
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:54:35 PDT