Sign in to follow this  

Rain in WoW

This topic is 3606 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The particle rain system in WoW looks amazing, I want to implement something similar however I could not figure out how they did their water splatter; After some careful examination it seems to me that they had collision detection of every rain particle with the arbitary shaped terrain geometry. It seems to me that this collision detection is computationally prohibitive.. Could anybody give me some insight into how they did their water splatter with their rain? Any suggestion on how I can implement this is welcome thanks guys :)

Share this post


Link to post
Share on other sites
I havent examined the rain in WoW to any mentionable degree beyond just seeing it but I bet you could create the illusion of rain very easily:

1. Have a few transparent billboards in front of the user to render the falling rain. Basically, these billboards would just show a falling rain animation

2. Superimpose a splattering animation on the surfaces which rain can hit.

It wont be necessarily true that you could follow a droplet to its splatter, but who cares? It's probably good enough and it's not computationally expensive.

Share this post


Link to post
Share on other sites
I don't know how they do it (I don't personally play WoW), but if it was me, I'd probably just cheat and have two seperate particle effects:

-falling rain
-rain splatters

The two wouldn't be necessarily related really, but you could trick the user since there would be so many rain drops that identifying whether or not the splatter is correct would be difficult/impossible.

If you really want to do accurate stuff then I guess using a heightmap's value is easier than doing actual collision detection.

Share this post


Link to post
Share on other sites

Hi,

about the collision detection, there are ways to come around it. I didn't check if the water splatting actually occured on building or so, but anyway here's a simplified idea:

Instead of doing vector-terrain collision test, why not just get a random 2d-point at random radius from the view point and then fetch the terrain height at that point. So this works basically backwards. You'll start up by knowing the point of intersection.

From the end point you'll just trace up the rain particle path at a constant speed (the rain drop should have it's maximum speed so close to the ground) for few seconds. Each particle has a time to live counter which you'll decrease every frame update, and when it reaches zero, you'll just draw the splat at the calculated end point.

Handling buildings and other terrain objects will make the system more complicated, but it is doable.

Best regards!

Share this post


Link to post
Share on other sites
Hi,
Just to clarify some things for people wanted to help the Op :)

- The rain in WoW is handled drop by drop. I mean each particle is only 1 droplet. The advantage is that when you travel fast, the rain doesn't continue to fall vertically, like it would do with a billboard with animated texture.

- And for the impacts on the ground, I'm 99% sure it does collision detection, since buildings and stuff like that are handled (the rain collide with the roof, or any "collidable" surface and stops there)


Now, they also display the strict minimum amount of particles. If you look carefully, you won't see that many particles. Then the emitter always follow the user (stand still in the game, and jump and you'll see what I mean :)

And since the trajectory of the particles are a simple ray, I assume each time a particle is created, a simple ray against mesh / terrain is done to get the point where the droplet touch the ground. Knowing the time of impact and the location, it's not hard to create a little effect (maybe another particle system)
The point is : ray intersection is really cheap, and you only need to do it once for each new particle created.

Share this post


Link to post
Share on other sites
Personally I don't think they're doing collision detection for the rain.

Even if the buildings have splatters it's not difficult to do without collision detection. For most fx I've seen that deal directly with surfaces a surface flag is created say something like #define FX_RAIN 0x02 or something like that.

When a building is created, a modeler can apply a shader to the building with FX_RAIN defined on for the surface so when the game detects its time for rain to start, the splatter animation begins on all surfaces flagged for FX_RAIN. This lets the content creators define which objects are affected by rain easily.

The falling rain animation is probably just overlaid across the users view so the rain effect is controlled on the client-side rather than server. The server most likely just tosses a message to clients saying "hey it's raining" and the client goes "oh ok Ill draw rain"

Share this post


Link to post
Share on other sites
I personally see no reason why each raindrop couldn't be using collision detection.. it's not exactly as ray-testing once for each raindrop is a lot of stress on the cpu, not since there's probably only 300-400 drops going on at any given time.

If you combine various sizes and speeds the illusion of dense rain can quite easily be achieved.

/Robert

Share this post


Link to post
Share on other sites
Quote:
Original post by Rasmadrak
I personally see no reason why each raindrop couldn't be using collision detection.. it's not exactly as ray-testing once for each raindrop is a lot of stress on the cpu, not since there's probably only 300-400 drops going on at any given time.

If you combine various sizes and speeds the illusion of dense rain can quite easily be achieved.

/Robert


I'd say even 300 at a time is pushing it. Collision detection is completely feasible.

Share this post


Link to post
Share on other sites
Back when a Pentum3 600mhz was a good CPU I added a rain particle system to Half-Life 1, which used the HL1 engine's collision detection system to simulate between 500 and 3000 "rain-drops" with full collisions. The CPU handled that fine.

It all depends on how fast your ray-tests are...

Share this post


Link to post
Share on other sites
I don't think it's so much as "it's too intense on the processor to do collision detection for rain drops" as it is "it's a waste of cycles doing collision detection for rain drops".

Those are just my thoughts though :) The only for-sure way of figuring the rain system out is actually talking with one of Blizzard's programmers.

Share this post


Link to post
Share on other sites
Very rare drops you car draw on surrounding faces with density based on face area. Very dense drops you car distribute uniformly on 2d area and take Z from faces around you (kinda collision detection, but optimised).

PS and it is not a question, how blizz do it. It is question - how all do that.

Share this post


Link to post
Share on other sites
Thank you guys for your valuable comments, I think by finding the intersection point first then I don't need to do collision detection for every particle every frame, so I guess this is very feasible, thanks :)

Share this post


Link to post
Share on other sites
You want good rain? Check out ATI's Toyshop demo. Pure pwnage [grin]

There's a presentation online somewhere that explains how they did the effects (plus the actual demo if you want to run it). It uses a ton of DX10 features, such as hardware particles, geometry shader effects, etc. But I'm sure you can do a lot of the effects in DX9.

Share this post


Link to post
Share on other sites
Yes, I saw that demo its very good! :D but it has some limitations that is problematic in my case, the ATI implementation overlays a rain layer in front of the camera, so when you turn your camera up the rain will actually feel like raining in the wrong direction, the ATI demo just limits the camera freedom to avoid this problem..

Share this post


Link to post
Share on other sites
For very intense rain you could probably randomize splashes all over the place.. Noone is going to follow the drops througout the screen and see where they land

Share this post


Link to post
Share on other sites
Quote:
Original post by Rasmadrak
I personally see no reason why each raindrop couldn't be using collision detection.. it's not exactly as ray-testing once for each raindrop is a lot of stress on the cpu, not since there's probably only 300-400 drops going on at any given time.


It's even better than that. There's no memory overhead (flagging the triangles that can be splashed); there's no additional human workload (it's automatic).

And I must point out that you only need to do a ray-cast when the rain drop is spawned, not every frame. So all that matters is in average how many rain drops are created every frame.

Y.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ysaneya
Quote:
Original post by Rasmadrak
I personally see no reason why each raindrop couldn't be using collision detection.. it's not exactly as ray-testing once for each raindrop is a lot of stress on the cpu, not since there's probably only 300-400 drops going on at any given time.


It's even better than that. There's no memory overhead (flagging the triangles that can be splashed); there's no additional human workload (it's automatic).

And I must point out that you only need to do a ray-cast when the rain drop is spawned, not every frame. So all that matters is in average how many rain drops are created every frame.


Adding onto that for static objects, you can add a minimum height value to the particle. The raycasts will be done against static entities only when particles spawn giving the minimum height for static objects.

Then if you choose to perform collision on moving objects you can use spatial partitioning to find if any moving objects need to be tested. A trivial distance equation can be done which costs nothing (as long as you don't use square root). If the distance is greater than the velocity of the rain drop and the object then it's impossible for a collision to occur.

Performing this in conjunction with spatial partitioning makes testing for moving or static entities extremely cheap. Even cheaper if you use grid spatial partitioning and just do 3DDDA then it's almost free (store the 3DDDA variables in the particle and you'll see why).

Share this post


Link to post
Share on other sites

This topic is 3606 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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