Game Development Community

Precipitation for TSE

by Tom Spilman · 02/28/2006 (1:01 am) · 23 comments

www.sickheadgames.com/images/shbug_03.pngSo 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.


www.sickheadgames.com/stuff/garagegamesimages/precip3t.png
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.

www.sickheadgames.com/stuff/garagegamesimages/precip1t.pngAfter 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:
www.sickheadgames.com/stuff/garagegamesimages/precip2t.png www.sickheadgames.com/stuff/garagegamesimages/precip4t.png

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.

About the author

Tom is a programmer and co-owner of Sickhead Games, LLC.

Page«First 1 2 Next»
#21
11/13/2008 (2:10 pm)
@Tom - This code was already folded into TGEA.
#22
11/17/2008 (9:55 am)
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
#23
11/17/2008 (2:04 pm)
@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.
Page«First 1 2 Next»