# 3D Rain Particle System

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

## Recommended Posts

Hi

I'm working on a 3d rain particle system. Till now I have used billboards (with ID3DXSprite) but this doesn't look nice if you look up to the sky because then the rain drops (they are more like lines) still look the same. The lines can't always show the camera but I don't know how to make it look real.
Another problem with billboards is that you can't make diagonal rain (or I haven't found out how...).
The rain can't just be a 2D overlay because it interacts with the terrain.

What is the best way to draw real looking and always correctly oriented rain drops?

### [font=arial,helvetica,sans-serif]Geometry Instancing[/font] to use real rain drop shapes.http://http.develope..._chapter03.html But billboards are still fine for slower machines, not sure what options DX9 gives you on controlling them, cant you rotate them? can you maybe shift the lower UVs to move the line to match the fall direction? can you lock a rotation so it wont look directly at the camera but still follow it position. Anyway Good luck !

##### Share on other sites
The problem with rotating the billboards is that the rotation depends on the position of the camera.

If the drops fall down with a vector (1, -1, 0) and your view direction is parallel to the yz-plane then the lines should be diagonal but if your view is parallel to the xy-plane the lines should be straight down.

I'd like to have them fall straight down correctly first. I disabled billboarding and the result was much better, but now if you watch from a certain angle, you can see almost no drops, because the quads are parallel to the view direction.

What I need to have is billboarding that only affects the y-axis. Is that what you meant with:

can you lock a rotation so it wont look directly at the camera but still follow it position.[/quote]

Anyway I don't know if I can, I probably do but I don't know how...?

##### Share on other sites
Ok it was easier than I thought.

You just calculate the angle between the view direction (with y = 0) and the vector (0, 0, 1), then create a rotation matrix around y-axis with this angle.

I think I'll find out the rest with diagonal rain

Thanks!

##### Share on other sites
Here's how to build a matrix that keeps it vertical and facing the camera (taken from http://www.gamedev.net/topic/546352-billboard-rotating-along-one-axis/ ):

One axis is fixed, 'up' is always (0,1,0)
'Forward' will obviously be (cameraPosition - raindropPosition) normalized.
'Right' is the cross product of 'up' and 'forward'
'forward' needs to be made orthogonal by another cross product of 'right' and 'up'

The columns of the transformation matrix are 'right'|'up'|'forward'|'position'

##### Share on other sites
Wow nice this works great! Thanks

##### Share on other sites
yeah, Adam_42 is right on the money..

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 13
• 30
• 9
• 16
• 12