Wednesday 10 April 2013

DirectX - Geometry Shader (Lot's of cubes and particles!)

Just posting a quick update for my geometry shader experiments. I managed to increase the particle count by a crazy amount to just above 450,000 ! The first program I made to do this created just plain old particles, billboarded towards the camera and with basic blending.
Be sure to click to view in HD
This was pretty cool and I easily managed to get above the 450,000 target. At this amount the system runs smoothly and gets a nice steady 52 FPS. This is at fullscreen 1920*1080 resolution.
Look at those pretty particles!
 After this I played about with multiple emitters and pumping up the emission rate but none of these gave me any satisfaction. Then I remembered  the geometry shader isn't just for particles, I could create any geometry from a single point, so what about cubes? I then did some jiggery pokery inside the shader, spent far too long working out how to create a cube using a triangle strip and voila, the cube demo was born.
Over 450,000 of the finest cubes known to man
Now for this system you would think it would run 6 times slower due to the extra faces, dropping from 52 to about 9 fps. You'd be wrong though, with this system the application still manages an impressive 28 FPS at fullscreen 1920*1080, this is all without any form of instancing, culling or other optimization techniques.
For a bunch of cubes they sure are colourful
Although this program isn't a significant achievement in the realms of computer technology it goes to demonstrate the significant power of the Geometry Shader as well as the GPU. This level of geometry would simply not be possible on the CPU in real time. Anyways, check out some realtime videos of this stuff below, be sure to watch in full HD for the best quality!  Due to the way youtube compresses videos down I had to alter the brightness which is why there is a colour difference with the screenshots above. I really should modify this in shader but that would be sensible.
Also check out some random cool patterns I made below.


Email : markmmiller@hotmail.co.uk
Xbox Live : Dr Death MK 2
Steam : 7thsanctum