Preventing Out-Door dust particles from entering inside buildings

Started by
7 comments, last by Medo Mex 11 years, 3 months ago
Lets say we are in a dust weather, I use the particle engine to create some dust smoke out-door, however it's getting inside the buildings which is not realistic.

Same apply to rain and snow, of course you don't enter a building and see it's raining inside it.

How can I prevent the dust/rain/snow particles from getting inside buildings?
Advertisement

Use clipping planes corresponding to the outside walls of the building when you draw the particles. A pixel should be discarded if it lies on the wrong side for ALL the planes, (not just one)

@hupsilardee: I thought I could have a boundary box around each building, but I don't know how I can know if the particles are inside the box so I can discard it.

Cheat.

It's always easier to cheat. You're trying to solve slightly the wrong problem; You're trying to figure out how to run a system where you make random rain and then work out how to not have it enter the buildings.

It's much easier to do this in your level design. Make it "rain" in boxes. The raindrops start at the top and fall down (you can do this in the vertex shaders fairly easily). When they get to the bottom of the box they get recycled at the top.

You plonk these down in your level... at ground level in the streets, at roof level over the buildings. You should also then be able to cull them fast -- if the view is indoors, it can't see up anyway, so the overhead rainboxes are never rendered. (You can get away with the rain sequence repeating as well. You can also get away with using the same rain positions for all the boxes... add some distance fogging and no-one will ever spot the rain tiling :-)

Likewise your dust -- it lives in boxes. The player moves through the box, dust is generated, it drifts back down.. job done. The dust is never made where there isn't a box -- like inside.

The goal of games development is to make something that's real enough that if the player co-operates with suspension of disbelief looks right. It doesn't actually have to solve all the annoying things for real if you can cheat...

Positive air pressure?

Sorry. Couldn't resist.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
@Katie: That's interesting idea.

For the rain/snow, do you mean I will create bunches of boxes following the player position, when those boxes detect collision with the building, the boxes Y position change to be over the building?

For the the dust, if the player is looking from a window inside the building, the player should still see the dust, so I will not stop generating the dust particles when the player is inside the building, I want it to be generated outside the building so the player can see it from the building window or door, I'm talking about a dusty weather, I found a screenshot that will let you know what I'm trying to accomplish, see the screenshot:
http://shots.ikbis.com/image/20894/large/Bad_Weather-_Tripoli_2006.jpg

"bunches of boxes following the player position"

They don't need to move -- you just put them in (say) the streets between the buildings.

Another possibility is to not exclude the particles from the room but the room from where the particles flow. You have to destroy particles anyway, but it may be too complex to define the volume where particles are allowed to live. Hence you can move the rooms outside the (simple) box where the particles live, and use portals to virtually re-connect the rooms.

@Katie: That would be a little bit complicated especially if I'm working on a large mission, adding thousands of boxes in a level design just for rain/snow is a waste of time, I'm trying to implement a way that has nothing to do with level design so I can just enable/disable rain in the level design without having to create thousands or hundreds of boxes.

This topic is closed to new replies.

Advertisement