Sign in to follow this  
the dodger uk

rain

Recommended Posts

i have been making an engine for a long time now , and now i want to put rain into it , i have seen a lot of tech demos which show you how to do rain , and i understand it .

via geometry shader.

 

i not want to make the whole enviroment do rain cause that would not be cost effiecent .

and this is my stumbling block at the moment , what the best way to do this

Share this post


Link to post
Share on other sites

Are you talking about rendering rain drops in the air? Or something else?

 

2d? 3d?

 

For rendering rain drops in a 3d engine, generally this could implemented with a "scrolling" cube of particles that is positioned to fill the current view frustum. There is a good article in ShaderX7 about this ("Dynamic Weather Effects").

Share this post


Link to post
Share on other sites

a recent idea i had was just a cone over the camera, say 10 feet across at the bottom, maybe 20 feet tall, with a random rain texture on it. the terminal velocity of rain is high enough that its very difficult to see individual drops in real life. i've done full 3d raindops in the past. then i heard about the trick with the random texture. it works amazingly well. right now i use it on a box around the camera. but i think a cone might give better results when you look up, more of a 3d perspective foreshortening effect.

 

and don't forget to turn it off when the player wallks under cover!

Share this post


Link to post
Share on other sites

Ugth, notice all those hacks personally, full particle for each raindrop with appropriated deferred lighting, use the normal and depth as a proxy for particle collision to get collision on each one. Then you have a (static) top down shadow map type (highly blurred) and instead of a shadowing a light you apply a texture/light/however you want to do it of tighter specular and darker albedo along with some nice water ripple like textures, which should transition between water running down something to puddling/ground depending on the angle. Oh and appropriate "bounce" particles once the rain hits, and make sure the water running affect takes into account a height map of the normal map (however you want to do that) so it puddles more at the bottom than at the top.

 

Or maybe that's overkill a little, but it's nice.

Share this post


Link to post
Share on other sites
There's a completely overkill look at rain effects over on Sebastien Lagarde's blog.

I've previously used a few approaches:
- one where you've got a cube-shaped particle emitter that moves with the camera, spawning billboard sprites that fall under gravity.
- another time I did the same thing but rendered the particles as line primitives, and traced each one individually for collision with the world.
- recently I had to do a cheap rain effect, where I made a full-screen post processing shader that ray-traced a few vertical planes in front of the camera that had a scrolling raindrop texture on them.

Share this post


Link to post
Share on other sites
http://www.youtube.com/watch?v=V4sGR32hPFA&feature=youtu.be&t=1m6s&hd=1

At Minigore 2 I did really cheap rain effect using couple hundred simulated particles which was each rendered as mesh that contained around dozen actual raindrops. This keep fillrate quite minimal. That reindrop bunddle Mesh was duplicated to same VBO 20 times so it was possible to render 20 particles with one rendercall. Each particle was frustum culled and tested against y = 0 plane. If collision to ground plane happened watersplash effect was spawned which used quite similar pseudo instancing trick. Particle was re-emitted after collision and emitter cube followed camera. Whole effect used around 10 render call without any dynamic geometry. Rain was added just before release so we didn't have that much time to fine tune the effect. It's actually even use snow flake texture and was vertex colored to hide this fact.

Edit: the effect start from 1m6s. Tried to link straight for it but did't quite nailed it. Edited by kalle_h

Share this post


Link to post
Share on other sites

There's a completely overkill look at rain effects over on Sebastien Lagarde's blog.

I've previously used a few approaches:
- one where you've got a cube-shaped particle emitter that moves with the camera, spawning billboard sprites that fall under gravity.
- another time I did the same thing but rendered the particles as line primitives, and traced each one individually for collision with the world.
- recently I had to do a cheap rain effect, where I made a full-screen post processing shader that ray-traced a few vertical planes in front of the camera that had a scrolling raindrop texture on them.

 

That really is a bit overkill blink.png Still, bookmarked it for future reference. Even if I disagree with some of the methods of implementation, in terms of and overview of what you might want to accomplish that's really comprehensive.

Share this post


Link to post
Share on other sites

http://www.youtube.com/watch?v=V4sGR32hPFA&feature=youtu.be&t=1m6s&hd=1

At Minigore 2 I did really cheap rain effect using couple hundred simulated particles which was each rendered as mesh that contained around dozen actual raindrops. This keep fillrate quite minimal. That reindrop bunddle Mesh was duplicated to same VBO 20 times so it was possible to render 20 particles with one rendercall. Each particle was frustum culled and tested against y = 0 plane. If collision to ground plane happened watersplash effect was spawned which used quite similar pseudo instancing trick. Particle was re-emitted after collision and emitter cube followed camera. Whole effect used around 10 render call without any dynamic geometry. Rain was added just before release so we didn't have that much time to fine tune the effect. It's actually even use snow flake texture and was vertex colored to hide this fact.

Edit: the effect start from 1m6s. Tried to link straight for it but did't quite nailed it.

That looks really awesome!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this