The other day I came across a very cool XNA demo, Michael Hoffman’s ‘How to Generate Shockingly Good 2D Lightning Effects’ .
I needed to redo this in my current favourite UI stack XAML/SharpDx/C# .
1 hour later i was done, thanks to the SharpDx toolkit it’s a breeze to bring across demos like this.
Here is the video of the Win8 lightning demo app :
1. SharpDx Toolkit – this is built ontop of SharpDx and it helps abstract out some of the hard concepts that can confuse new starters in the directx space. It shares a lot of ideas with XNA (Game/GraphicsDevice/Content Pipeline etc).
2. XAML – Using a Swap Chain Background Panel to render the Dx content
4. WinRT – this is a modern app, uses the new API’s from the Windows team.
1. Making SpriteFonts – I used MakeSpriteFont from the DirectX Toolkit to create the Lightning Font used in the Lightning Text.
2. SpriteFont to Point– the demo makes use of SpriteFonts, and getting the point information from a sprite and rendering each point as a lightning position. There are about 1000+ points created from the word “Lightning”, and its these points that are rendered in 3D using the Lightning technique.
3. 2 render targets to render the Lightning Text. The demo shows creating 2 render targets (currentFrame, lastFrame) that are used to push the 1000+ points and lightning textures on. We then push the currentFrame into the backbuffer of the device for rendering..
can be found on Skydrive
Final words …
I highly recommend looking at some of the techniques employed in this demo. Its a pretty cool lightning effect Michael came up with..
Have fun …