Previous Blog Next Blog
Prev/Next Blog
by date

Precipitation for TSE

Precipitation for TSE
Name:Tom Spilman
Date Posted:Feb 28, 2006
Rating:5.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Tom Spilman

Blog post
So over the last few months when i wasn't working on Torsion i've been poking at the TGE Precipitation object to TSE-ize it.


Originally i started with the intention to completely replace Precipitation. I looked at the few alternative methods, but in the end each had serious limitations. Most lacked collision which would have been a huge step backwards for anything but flight sim type games. The original TGE Precipitation system was really pretty darn good and really just needed some additional features and optimizations.


The first thing done was to move it all over to vertex buffers. It now uses an "optimally sized" volatile VB in a fill-render-fill pattern until all the particles are drawn. This is very optimal as we're sending lots of big batches to the card and not holding on to one fat exclusive VB. This means high performance and little video card resource usage.

Next i looked at what could be done with a shader. Again i looked at all the techniques out there and ended up with a widely compatible conservative approach. I reduced the vertex format to just a position and uv set and moved vertex coloring and alpha fade to the shader.

Still the really cool shader tricks are yet to come. With DX10 level cards you'll be able to process a VB and have it output new VB with more verts. In this way you could pass just the position, velocity, and camera pos up to the video card and have it build the particle completely. Also features like texture fetching from a vertex buffer would allow Precip to pass z buffer of the scene rendered from the averaged velocity vector to detect collision. This is the future of million particle systems running purely on the GPU.

After fixing a few bugs i turned my focus to new features and improvements:
  • Both drops and splashes can be animated or not.
  • Finally you can set the drops/splashes per side in the datablock.
  • The simulation stops when the object is zoned away or not in the view frustum.
  • Optional tinting of the particle by the ambient sun light.
  • You can pass precip thru the glow buffer.
  • Have the precip reflect in water or other dynamic reflective surfaces.
  • Moved the mWindEffectsPrecipitation out of Sky.
  • Options for precip to collide with players and vehicle types.
  • Can now set a fade distance for precip particles.
  • New setTurbulence() script function which works like modifyStorm.

A big new feature is volumetric precipitation. By disabling the followCam property you are free to position and rotate the precip object anywhere you want. This means you can put glowing rain flowing upwards inside a room or have a precip object attached to a moving shape:




Still i'm not done with Precipitation. As soon as the 1.4 and MBU merges are done i want to make another pass tuning performance on the system. I've also got a few more features i'd like to see:
  • Ripple particles.
  • Shadows and lights effect particle color.
  • Add randomized gusts sky wind system.

Anyway... i'm 26 hours without sleep now. How about a demo for you to play with:

Download TSE Precipitation Demo
(Select the walkthru from the menu and hit ALT+C to get the free camera to fly around)


PS. We've started a new contract TSE project yesterday. We'll be looking for 3 other individuals with specific skills to fill out some lucrative contract positions. I'll post a new plan on that later this week, but keep an eye on the help wanted forum.

Recent Blog Posts
List:03/03/07 - Sickhead is hiring!
05/31/06 - Torsion Update
04/03/06 - Torsion Update & TelnetDebugger Fix
03/21/06 - Torsion Updated!
02/28/06 - Precipitation for TSE
07/18/05 - Plan for Tom Spilman
05/26/05 - Plan for Tom Spilman
05/21/05 - Plan for Tom Spilman

Submit ResourceSubmit your own resources!

Phil Carlisle   (Feb 28, 2006 at 09:40 GMT)
Nice one Tom. Is this done on a bounty btw? or just for yourself? I'd love to try it in Air Ace see how it works.

I could also then use it as a basis for a cloud renderer (an essential part of Air Ace platform really, so I better get to it sometime soon).

Phil.

Tom Spilman   (Feb 28, 2006 at 09:52 GMT)   Resource Rating: 5
@Phil - Thanks. Yea it's for a TSE bounty. A zip with the source code is posted up on the mantis bounty page.

Phil Carlisle   (Feb 28, 2006 at 10:45 GMT)
Thanks Tom, did you do two versions btw? Just wondering why there are 2 zips in there, or did someone else implement a version already?

Phil.

fireVein   (Feb 28, 2006 at 11:22 GMT)
Hell yes. This is freakin awsome. Amazing work, Tom.

-Jase

Chris \"C2\" Byars   (Feb 28, 2006 at 11:49 GMT)
Oh yes, great job Tom!

Timothy Aste   (Feb 28, 2006 at 12:13 GMT)   Resource Rating: 5
We got our hands on this a few days ago, and let me tell you, it's rocking. Way to go Tom!

Nick Zafiris   (Feb 28, 2006 at 12:33 GMT)   Resource Rating: 5
Great work Tom!

Joseph Euan   (Feb 28, 2006 at 13:42 GMT)
wow that looks cool... nice job Tom!

Tom Spilman   (Feb 28, 2006 at 17:21 GMT)   Resource Rating: 5
Thanks everyone!

@Phil - No the second zip is a newer version of it.
Edited on Feb 28, 2006 17:25 GMT

Todd Pickens   (Feb 28, 2006 at 17:34 GMT)
Very Nice, I was recently playing around with precipitation, and I can think of all sorts of ways to make use of this.

Robert Stewart   (Feb 28, 2006 at 18:04 GMT)
Hey Tom, I'm also waiting on DX10, first thing I thought of when I heard about DX10 was WOW I cant wait to start playing with particles. If I knew about this bounty page I woulda been working on some of this stuff.

Jeff Gran   (Feb 28, 2006 at 19:35 GMT)
Supa sweet.

As a nitpick cause it seems like you're going for perfection, I noticed that from underwater everything gets refracted except the particles....

Chris Calef   (Feb 28, 2006 at 19:42 GMT)
Wow!! Nice work, man.

Only thing that caught my eye in your above description was a very nitpicky realism check: on a rainy day in actual reality I've never seen water smooth enough to be reflective. (Grew up in Oregon == rain expert). :-)

Great work though!! Damn!

Tom Spilman   (Feb 28, 2006 at 19:45 GMT)   Resource Rating: 5
@Jeff - The issue is that the scene graph inherited from TGE is rather inflexible for cases like this. It has a fixed order for rendering and that means either transparent objects are rendered before or after the reflection pass is done. Each case causes something to break, so i left it alone for now. I believe GG has an overhaul of the scene graph planned and i hope that addresses the need for flexible render ordering.

Josh Moore   (Feb 28, 2006 at 23:26 GMT)
Wow this is cool. Great work!

Edit: This code can handle *tons* of rain. Really kick ass way of rendering everything. Now all we need is to get the particle engine doing something similar, as ATM it can't run alot of particles.
Edited on Mar 01, 2006 00:28 GMT

Robert Blanchet Jr.   (Mar 01, 2006 at 00:36 GMT)
DX 10 isn't going to do much good unless your running Windows Vista AND have a DX 10 compatible card, fyi.

Tom Spilman   (Mar 01, 2006 at 08:39 GMT)   Resource Rating: 5
Exactly Robert. I forgot to mention it, but it will be at least 2 years before you can count on DX10 features being present in the majority of systems. A lot rides on how many people decide it's worth upgrading to Vista.

Still a Vista optimized rendering path could be made for the various TSE particle systems.

BrokeAss Games   (Mar 01, 2006 at 12:15 GMT)
This reminds me of one of the few little miracles I have seen in real life.
I was standing ontop of a hill looking down into a valley during sunset.
Slowly it began to sprinkle and the rain started to catch the sunlight.
It looked as if the valley was filled with gold flecks, it's something I'll never forget.
Killer work!

Ari

Christian Weber   (Mar 09, 2006 at 15:52 GMT)   Resource Rating: 5
This is really awesome! Nice work, we can definantly need this for our game project. thank you so much :)

Tom   (Nov 13, 2008 at 19:34 GMT)
is there any pogress on this? or is it close now?

or would there be a way for me to implement your glow participation?

above people speak about 2 zip files, but they are no longer avaialbe

so i was just wondering what ever happened to this awesome idea

Tom Spilman   (Nov 13, 2008 at 22:10 GMT)   Resource Rating: 5
@Tom - This code was already folded into TGEA.

Tom   (Nov 17, 2008 at 17:55 GMT)
oh, ic, so how would i for instance make heavy snow precipitation glow using the glow buffer?

i tried the "glow = ture;" setting int he precipitation block but it had no effect

im guessing i need a costum material, but how would u map that? since the precipitation block takes a texture not a material

Tom Spilman   (Nov 17, 2008 at 22:04 GMT)   Resource Rating: 5
@Tom - How glow works in TGEA has changed since then and it seems Precipitation no longer supports it. To fix it you would have to add support for ObjectRenderInst type rendering to RenderGlowMgr.

You must be a member and be logged in to either append comments or rate this resource.