methods for drawing rain

Started by
36 comments, last by Burnt_Fyr 9 years, 12 months ago

are there any _realistic_ looking methods for drawing rain?

i've tried all kinds of different things, including particles:

* 100 2d billboards in a 20x20 area around the camera. looks great til you look up or down.

* a "rain cone" around the camera (like a skybox). works great, til you look down.

* a "rain box" consisting of two cones pointing up and down, with a circular section between them. works great, until the ground clips the bottom cone.

* a "tall rain box " 10x10x1000 tall, made from 10x10 quads. similar to the cone, with just a small gap whne you look up, but again, clipped by the ground. mapmaps had to be tuned off to get the correct effect, without a noticeable change where mip levels changed.

* a particle system - looks great, you can see rain falling past you when you look down. but it looks like i'd need something like 10,000 to 100,000 particles visible onscreen at once. i kicked the render queque up to as high as 5000 entries for testing, using 4000 for rain, and reserving 1000 for normal uses. but for a true implementation, i'd need to reserve 3000 entries for normal uses. granted, i can draw whatever is in the queue, clear it, draw the rain, clear it again, then continue as normal, but the large number of particles is a concern. even if i bypass the queue.

i'm thinking that a combo of "rain skybox" and particle system may be the way to go.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Advertisement

What about a full screen texture with many rain drops pre-drawn, then just scroll the texture in a downward direction. Apply a dozen such layers at different speeds and distances?


What about a full screen texture with many rain drops pre-drawn, then just scroll the texture in a downward direction. Apply a dozen such layers at different speeds and distances?

this gives an effect similar to the "random 2d billboards" method (the first one listed above). works great til you look up or down. turns out, you don't need to scroll the texture. rain falls so fast, the eye can only track it for a split second. so using scrolling or particles to get a "falling" effect are unnecessary. multiple randomly animated textures, or a randomly jittered single texture works just fine.

if the effect is implemented as a single quad in front of the camera, when you look up, rain falls forward, not down. and when you look down, rain falls backward, not down.

in general, a non-particle method works ok if the quads surround the camera, and are close enough and tall enough that the gap at the top is small when you look up.

or a cone can be used instead to "close the top". but all such methods have issues where the rain quad (or cone or box) is clipped by the ground, resulting in a patch of dry ground under the camera.

apparently, only a particle system will draw rain falling down when you look down.

another downside of textured quads is its harder to add wind effects. it requires textures with rain at different falling angles, and the quads have to be turned in the correct direction, so the rain "blows" the correct way as it falls. with particles, you just add some x,z velocity based on windspeed and direction.

has anyone ever seen a game where you could look up and down, and had 1st person and 3rd person views, and had real looking rain? not just a few particles to give the impression of rain, which seems to be the common approach.

other things i've considered:

* supplementing the vertical rain quads with horizontal rain quads with just dots for the rain texture, as though you were looking at the rain head on, not from the side. this may help with the look up / look down issue.

* a combo of rain quads and particle system.

* particles that are a "cloud of rain" made from multiple mutually perpendicular quads. say 4 horizontal, 4 vertical in xy, and 4 vertical in xz. with rain texture on the vertical ones, and the rain dot texture on the horizontal ones.

good looking rain is one of the last thing left to do for the game's graphics. rain, snow, and alpha blended flames are the only graphics left to do . everything else is done. i even made an Acacia Tortilis tree model from scratch for use in tropical savanna terrain. So graphics is down to a few special effects, and perhaps some minor tweaking if room for improvement is noticed during playtesting.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php


are there any _realistic_ looking methods for drawing rain?

Mr. Barrows, check your PM, please.


rain falls so fast, the eye can only track it for a split second. so using scrolling or particles to get a "falling" effect are unnecessary. multiple randomly animated textures, or a randomly jittered single texture works just fine.

Then why not have a texture atlas of different sized raindrops. And use the ones depending on the viewing angle?

One approach is to draw lines instead of droplets. You can place them in 3D so it looks reasonable when you look up into the sky. Here's a random photo to show roughly what you're going for, although you can get away with less of them. Having said that most of the time if you look outside when it's raining you probably won't actually see it falling at all as you need the lighting to be just right to see it, so one option is not to bother at all with rendering falling rain drops.

What you will see is splashes on the floor where the rain lands, you get different splashes depending on the surface it lands on. These don't really have to be connected to the falling drops, but you do want to avoid drawing rain underneath solid objects.

Wet surfaces also change to a darker colour, and gain extra specular reflections. This wants simulating if the rain can stop and start in the same location. It's not too hard to do that in a shader. The tricky bit is working out where to apply it.

Another effect you can implement is to simulate rain drops on the camera lens.

Take a look at http://blogs.msdn.com/b/shawnhar/archive/2009/04/01/motogp-wet-weather-effects.aspx for some more ideas.

See "Dynamic Weather Effects" in the book Shader X7.

But this is basically the last choice in your list in your original post. I'm sure you could get something that looks good with 10,000 particles (and that really shouldn't be much of a performance issue).

The good attempts that I've seen have used lots of particles. You should check out the Rain sample from the Nvidia SDK. I also noticed in that in the recent Assassin's Creed 4 GDC presentation there were some slides about their rain.


Then why not have a texture atlas of different sized raindrops. And use the ones depending on the viewing angle?

something like this was mentioned somewhere online. as i recall, they did a particle system, then behind it they did a screen space effect, with textures generated on the fly (i think) to make the rain "tilt" the right way depending on camera angle, wind etc.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php


One approach is to draw lines instead of droplets.

i really didn't get as far as worrying about the complexity of the particle's mesh. even with a single triangle as a 2d billboard with a rain "line" (or more likely, multiple raindrop "lines") just the sheer number of particles had me worrying. I went as high as 4000 visible onscreen at once. and it was looking like i'd need one or two more orders of magnitude above and beyond that for a decent effect.


Having said that most of the time if you look outside when it's raining you probably won't actually see it falling at all as you need the lighting to be just right to see it, so one option is not to bother at all with rendering falling rain drops.

What you will see is splashes on the floor where the rain lands, you get different splashes depending on the surface it lands on.

for the moment, i'm just working on the falling rain part. after all, falling rain is not invisible. but as you say, its almost more of a fog than particle effect.


These don't really have to be connected to the falling drops, but you do want to avoid drawing rain underneath solid objects.

Already done. : )

Fortunately, rock shelters are the only "overhang" in the game which should block precipitation. So there's separate draw rain and draw snow routines for outside, and drawing precipitation outside but not inside a rock shelter, IE draw rain, draw snow, draw rain outside of rock shelter, and draw snow outside of rock shelter. the game uses the player's location to determine if they are under the overhang, and which drawing routine to use. getting the transition right took a bit of tweaking. but it works great, in first or 3rd person view. As i recall, skyrim (like oblivion) still doesn't do this.


Another effect you can implement is to simulate rain drops on the camera lens.

Paleolithic setting - thus no lens effects. I've been thinking about playing around with the FOV some more, to try to get a more "true-eye" projection going. humans have a stereoscopic field of view of about 90 degrees horizontal, but a peripheral field of view of 120 to 150 degrees horizontal. vertical stereo and peripheral FOVs are both about 90 degrees. the aspect ratio is about 3:1, depending on the shape of the face around the eye. anyone know if directx can do something like this? perhaps with letter boxing to get the desired aspect ratio, once the FOVs are correct?

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

This topic is closed to new replies.

Advertisement