# Quick frustum wrapping Q

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

## Recommended Posts

So im working on my rain system (decided to go particles unless you can convince me otherwise ;p), and I need to know how to 'wrap' particles from one frustum plain to another. Im using the code found here... http://crownandcutlass.com/features/technicaldetails/frustum.html ...so I know which plain a particle has gone 'behind'. Now I want to wrap a particle to the oposite plain (if it crosses the left plain, wrap it to the right plain, ect) so that particles are only inside the view frustum. Can anyone tell me what the math for that would look like?

Nobody knows?

##### Share on other sites
Well, telling if it's crossed the left plane is easy assuming you know what the plane is. Any plane can be written as r.n = c, where n is the normal vector to that plane and c is a constant. Just calculate p.n for a point p; if it's bigger than c it's on one side, smaller then the other. Moving it to the other side is a little trickier because it demands that you know where to place it on the other plane; I'd suggest at the same depth ('camera Y', depends on your view direction) and Z (vertical) co-ordinates.

##### Share on other sites
Quote:
 Original post by ZealousEngineNobody knows?
I would imagine there are some standard approaches to rendering rain; I don't know what they are, but a google search might be informative (if you haven't done it already).

As for your question, here's what comes to mind:

1. Intersect the line segment representing the particle displacement with the frustum
2. If a frustum plane is intersected...
3. Store the intersection point
4. Project the particle velocity vector onto the ground plane (just drop the component corresponding to height)
5. Create a ray with the intersection point as origin and the above vector as direction
6. Intersect this ray with the frustum, excluding the plane that was already hit from the test
7. Move the particle to the intersection point resulting from this test

This would all be done in world space, and of course would not apply to rain that was falling straight down. The generality is intended to allow for any view orientation (looking straight up, rolled to one side, and so on). The above is just off the top of my head, and may not generate the desired results (or may simply be incorrect).

[Edit: A google for 'rendering rain' turned up some good hits; depending on what effect you're after, there may be other approaches that might be worth investigating.]

1. 1
2. 2
Rutin
22
3. 3
4. 4
frob
18
5. 5

• 33
• 13
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
632566
• Total Posts
3007107

×