Jump to content
  • Advertisement
Sign in to follow this  
domok

3D Rain Particle System

This topic is 2496 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

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?

Share this post


Link to post
Share on other sites
Advertisement

[font=arial,helvetica,sans-serif]Would depend on your engine, but I'd try [/font]

[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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!