Skip navigation

I posted the following on the Card Kingdom development blog.

Deferred Particles

As with other parts of the engine, the entire particle system was updated to use a similar deferred rendering method as the regular geometry. This really improves the look of the particles, in particular smoke and dust, as it gives them a more “volumetric” look. All the particles now interact with the lights in the scene just as the regular geometry does.

One interesting thing about deferred particles that sets it apart from the regular deferred rendering pipeline is how normals are calculated. In the regular deferred rendering stage, normal data is “alpha blended” together such that the values in the normal g-buffer are replaced with the new normal from the current geometry. For deferred particles, this is not optimal as it gives “hard edges” to your normals and makes each particle blatantly stand out as an individual piece of geometry. So, instead of “alpha blending” normals together, you would “additively blend” the normals. This removes the edges from the normals where they overlap and makes things more “round,” as normals that point to the right will point more toward the right when blended together, etc. This gives smoke and dust more of a “puffy” look.

Another neat trick we’re doing with deferred particles is making them soft deferred particles, as in they fade out when they clip other geometry in the scene. This just worked out because we have to combine the two final images, geometry and particles, and we have two depth buffers to play with. By comparing the depth values at the current pixel between the geometry and the particles, we can fade them out when the depths start to get close.

Lightning

Along with all these cools things, one completely new effect that came up while designing the final boss fight was lightning. And not just any-old lightning, purple lightning. Well, the color really doesn’t matter. It’s all about the effect and making it as realistic as possible because why not. If it’s worth doing, it’s worth overdoing I say.

After searching a bit with some help from other team members, we found this great tutorial that produces even better lightning. When done right, as in the videos in the tutorial, the effect is incredibly amazing. One twist that I have to put on it is to make it work in 3D. My solution for this is as follows:

  • Create the lightning lines as per the tutorial (it’s straight forward and I won’t go into detail)
  • Pass the lines to the graphics card as a line list
  • Using the Geometry Shader, “explode” (make new geometry) the line into two intersecting planes centered along that line
  • Pad the ends of each plane so they overlap to eliminate spaces in the lines
  • Use a texture stretched along the length of the planes to give it “volume”

Here is a video of where I am with this effect after a few days of work. It’s a little dark, but it shows that it can be done.

http://youtu.be/dYonm6LJ37o