Friday, August 22, 2014

3DS Particle Demo


    Particle Demo is a particle demo for the 3DS (creative, I know). There two versions, a multi-threaded version and a single-threaded version.

    The multi-threaded version utilizes two threads where it updates the main application in one thread and the particles in the other. This allows the main thread to run at about 60 fps even when particle thread begins to lag. While this does mean the two threads are constantly out of sync, it causes the multi-threaded version to have a pseudo alpha blending effect where some particles appear to be a darker color than others. This is due to the particle thread continuing to draw particles after the frame buffer started to be copied from the GSP heap to VRAM. Since the top left frame buffer is copied to first, more particles are rendered to the GSP heap by the time it is copied to the top right frame buffer. When 3D is diabled, the 3DS renders the left and right frame buffers on alternating frames. This, in addition to some particles just not rendering on certain frames because the thread isn't updating fast enough, tricks your eyes into thinking certain particles are darker when they are really flashing on and off the screen multiple times per second.

     The single-threaded version just updates all 4096 particles in the main application thread. Otherwise it works the same as the multi-threaded version but with inferior performance. It lacks the pseudo-alpha blending effect and the text on the upper screen starts spazzing out when the frame rate drops to low (caused by increasing the particle size to much).

    Only use the single-threaded version for performance comparison. If you want to play around with it use the multi-threaded version. Both are stable from my testing but the multi-threaded demo just runs better.

Video:


Download :
Particle Demo (Multithread) Download
Particle Demo (Singlethread) Download
Github

Controls:

  • D-pad - move particle source
  • Touch screen - change particle RGB color values
  • A/B - increase/decrease particle size
  • X - toggle gravity on/off
  • Circle-pad - change particle source direction
  • Start - pause particle generation



No comments:

Post a Comment