Environmental effects in OpenGL

Many next generation games are now including environmental effects such as rain, snow, etc. The new Metal Gear Solid for PS2 has an extremely impressive environmental engine (see http://ps2.ign.com/previews/14538.html and http://ps2movies.ign.com/media/previews/video/mgs2/mgs2dvd_3.mov for examples of some of the effects).

In the above movies of Metal Gear there are several scenes of pouring (and bouncing) rain (and some snow). My question is, does anyone have an idea of how these (realtime?) animations are generated (and how one could do it in OpenGL)?? I know that it could be done using particle systems, but this seems like a large number of particles especially if collisions (for the bouncing rain) must be computed.

Any ideas?


At the end of this (FANTASTIC !) OpenGL demo, there is some pouring rain in a “final fantasy” like scene.
So some nice rain fx are feasible in OpenGL.

It is very convincingly faked. If you look at the movie in your second link, near the beginning, look very closely at the stairs handrail. You can see how there is a “cloud of splattering rain” (almost like a cloud of smoke) around the railing. The splatering off the surface is done in that manner. How they determine where to have this splatting occur, I dont know. They could hard code it into the world, or they could examine the geometry at runtime and create the “clouds of splattering rain” whereever the dot product of the surface normal and up vector is greater than zero. And they could even scale it so that the spattering effect grows as the surface gets more horizontal. Alternatively, instead of using the up vector in the calculation, they could also use the rain velocity vector.

I tend to think that for the world, the splattering is precalculated, because you only see it in certain areas (the handrailing has it, but the steps dont). But for the player, it looks to be dynamically calculated (perhaps with the dot product method), because as his body moves, the splattering occurs in different spots.

As far as the falling rain, that is very easily done with a large poly with a mostly transparent texture. Unreal Tournament had a simple form of this in the “Dreary Outpost” board. You could see rain out the windows, but it was just 1 or 2 polys with a rain texture and the texture coords were just being offset slightly each frame (like sliding the texture along the polygon). Of course with only a few rain polys, you lose the effect if you walk through them (which is why they were places outside the window). However, give modern graphics speed, you could easily put a few hundred rain planes all at slightly different distances from the camera, some parallel, some at angles, etc. This (with a bit of care) should be quite convincing. And as the camera moves, you either move the rain planes with it, or you remove planes that go behind the camera and enable some new rain planes farther away. You can also use animated textures, so that you can make it look like the rain is being driven by gusts of wind (that video looks like it did this). Or you could also achieve that same effect by varying the number and/or transparency of the rain planes rahter than using an animated texture.

Thats my take on it

P.S. Metal Gear Solid 2 is the only reason I have even considered getting a PS2. It seems just incredible.

Originally posted by LordKronos:
Metal Gear Solid 2 is the only reason I have even considered getting a PS2. It seems just incredible.

Gran Turismo 3 might be another very good reason !

By the way, do you know of any PS2 developer on this board ? I remember there was an advert for OpenGL on PS2 some months ago in the headlines…

I’d be curious to benchmark PS2 against PC using OpenGL (although I doubt GLUT has been ported on PS2 !).




Definetly a great demo! But, after reading over the Popsy Team website, and each of the members home pages, all of their programmers say they use DirectX. Is there any documentation with the invitation that says that OpenGL is used? Just curious, as that I really liked the rain effects and wanted to investigate how it was done.


I looked the vip2.exe file with ExeScope (which shows the dlls used).
Here is what i got :

Import, OPENGL32.dll
Ordinal Name
0063 glFogf
0114 glTexCoord2fv
0151 glVertex4fv
002C glColor4f
006A glGenTextures
0135 glTexImage2D
0136 glTexParameterf
0043 glDeleteTextures
002D glColor4fv
0148 glVertex3f
0008 glAlphaFunc
012A glTexEnvf
0052 glEnd
000B glBegin
000C glBindTexture
000E glBlendFunc
00F5 glReadPixels
0013 glClearColor
0014 glClearDepth
0011 glClear
0061 glFinish
015C wglDeleteContext
007D glGetString
0164 wglGetProcAddress
015A wglCreateContext
0165 wglMakeCurrent
0045 glDepthMask
0044 glDepthFunc
0050 glEnable
00B6 glMatrixMode
00A5 glLoadIdentity
00C5 glOrtho
0088 glHint
00A3 glLineWidth
0065 glFogi
0047 glDisable

And no DirectX import so i guess it’s OpenGL

First note : Those guys don’t use glTranslate or glRotate, so i assume they do their matrix stuff on their own …

[This message has been edited by paddy (edited 02-01-2001).]


I just ran the demo on my NT 4.0 box… Works like a charm (DX under NT is DX 3 or 4).

This is definitely OpenGL stuff !

Very good stuff !



Makes me say “Whoa!”…

I’ll be studying that one more carefully. Thanks for the link again Paddy. Scene.org seemed, for a long time, to be only 2d art and little 3d programming. I’ll be paying closer attention to it now.


What’s really interesting about that VIP2 demo is that it uses an orthographic projection! There is no glLoadMatrix anywhere either. Makes me suspect they do all the transforms and simply pass projected polys. That’s not TnL friendly is it?

I am glad I took a look at this posting… man that demo is friggin awesome!

Downloading now…


Oh my… that was quite a demo :O)


Anyone know if it is possible to get source code or hints as to how parts of this demo were done?? I’m sure many people would be interested in this!

ps2, xbox etc are for those people who can not afford a good pc. All 3d cards/boxes are more or less the same, with different performance.

Heheh new to the scene guys ?

If you really want to see something astonishing look at “Please The cookie thing” from AARDBEI (can’t remember wich party won) and look what they managed to put in just 64kb ;D

Another one to give a look is “Lapsus” by MATURE FURK (try to anagram the name of the group and…) who won ASSEMBLY2000 demo competition. (That’s much better than VIP Invitation)

For rain effects I thinks the best way to implement it is particles with a good phisics managment, there should be a good tutorial on Fatech and on Gamedev (I belive the one on fatech is better, but PORTOGUESE only).


rIO http://www.spinningkids.org/umine

Originally posted by rIO:
For rain effects I thinks the best way to implement it is particles with a good phisics managment

Now, nothing is impossible, but I sure as heck wouldnt even want to think about implementing realistic rain (like the MGS2 movie) via particles in any real time engine. At least not on any current hardware.

rIO :
Lapsus may be a beautiful demo, but as many “badly” coded scene stuff it won’t run in Win2K/NT because of illegal memory accesses… Too Bad !
At least VIP2 is clean coded.

I’m no so new to the scene … if you remember the Amiga Wild Copper demos, you may also remember me … names have changed but people stay

Hey, good old Amiga :wink: Thats what I grew up with… making demo’s for Amiga (and C64 before). We always dreamed of things we can see in demos now, and thought, they will be possible maybe in 20 years…

You s**k big ones !

Atari ST and Falcon have always been far superior to those Commodore things…


P.S.: just reminds me of good old wars !