Fireflies - Scalable Ambient Effects

Scalable Ambient Effects (Fireflies)

Fireflies is a tech sample demonstrating a scalable ambient effect. In this sample, the ambient effect is a swarm of fireflies that scatter and reform into a walking character. Using Intel TBB, the firefly flight trajectory calculations performed per frame are distributed across multiple threads. By changing the number of simulated fireflies programmatically the ambient effect can be scaled to better match the performance of the platform it is running on.

Download Source Code

Download Binaries

Fireflies Video (larger screen)

Scalable Ambient Effects
Blog Post: Multithreaded, Man Explodes Into Fireflies!

Video & Screenshots


Fireflies flock to form a walking character


Fireflies scatter and flock


The sample can run in multithreaded as well as serial mode to better see the performance benefit of multithreading an ambient effect.

What is it?

System Requirements

  1. CPU: Dual core or better (Intel® Core™ i5 or better suggested)
  2. GFX: DX9c capable graphics card
  3. OS: Microsoft Windows Vista* or Microsoft Windows 7*
  4. MEM: 2 GB of RAM or better
  5. Software:
    1. DirectX SDK (June 2010 release or later)
    2. Build with Microsoft Visual Studio 2008* w/SP1 or Visual Studio 2010*

* Other names and brands may be claimed as the property of others.

Additional Code Samples

Intel Visual Adrenaline

A Scalable 3D Particle System

Download PDF

Benefits of SIMD

Download PDF

Visual Adrenaline

Download PDF

Intel Tools for Unreal Developers
TBB for Unreal Engine

Related Links

Visual Computing Home

Intel® Technologies

Sandy Bridge
Parallel Programming

Focus Areas

Game Development



For more complete information about compiler optimizations, see our Optimization Notice.


dark_sylinc's picture

"The program can't start because d3dx9d_43.dll" is missing from your computer (...)"

Looks like someone compiled the binary versions with the _debug_ libraries of D3DX

Matias N. Goldberg Intel Havok Physics Innovation Contest Winner * Most Innovative Use of Physics in a Game (2nd Place) * Best Physics Knowledge Base Entry (2nd Place)
Paul Lindberg (Intel)'s picture

Whoops! Sure enough, the release build had the debug dependencies. :-( We'll have a fix up soon. Thanks for reporting it!

dark_sylinc's picture

By the time being, it's still not fixed.

Anyway, as a workaround (besides having latest DX SDK installed) is go find D3DX9_43.dll & d3dx11_43.dll in your Windows system folders (under SysWOW64 if using x64 Windows) and copy them in the Firfelies' executable folder, and rename them to D3DX9d_43.dll & d3dx11d_43.dll respectively.

Nice demo. Really beautiful, and it's really neat to see 500.000 at 60fps in my machine ;-)

Not the point of the demo, but I wonder how the walking fireman would look with HDR on, using a Gaussian filter with big radius.

Matias N. Goldberg Intel Havok Physics Innovation Contest Winner * Most Innovative Use of Physics in a Game (2nd Place) * Best Physics Knowledge Base Entry (2nd Place)
Paul Lindberg (Intel)'s picture

Updated source and installer are on their way, should be posted tomorrow. Glad you're enjoying it!

Paul Lindberg (Intel)'s picture

Files have been updated - enjoy!


Andrey Karpov's picture

I checked the FireFlies project using the PVS-Studio static code analyzer. I just glanced through the code but managed to find a few obviously odd fragments. Below I will cite the analyzer-generated messages I have studied and the corresponding code fragments. I hope this will help to improve the project a bit. You may review other odd fragments by downloading PVS-Studio from here:

I can also give you a registration key for some time. You are welcome to ask questions here:

V560 A part of conditional expression is always true: embedded_block != first_block. Fireflies concurrent_hash_map.h 1299

static size_type const embedded_block = 1;
static size_type const first_block = 8;

template<typename Key, typename T, typename HashCompare, typename A>
void concurrent_hash_map<Key,T,HashCompare,A>::clear() {
else if( s == embedded_block && embedded_block != first_block )
V501 There are identical sub-expressions 'm_GamePad [iUserIndex].sThumbLX' to the left and to the right of the '||' operator. DXUTOpt dxutcamera.cpp 482

void CBaseCamera::GetInput(...)
if( m_GamePad[iUserIndex].wButtons ||
m_GamePad[iUserIndex].sThumbLX || m_GamePad[iUserIndex].sThumbLX ||
m_GamePad[iUserIndex].sThumbRX || m_GamePad[iUserIndex].sThumbRY ||
m_GamePad[iUserIndex].bLeftTrigger || m_GamePad[iUserIndex].bRightTrigger )

m_GamePad[iUserIndex].sThumbLX || m_GamePad[iUserIndex].sThumbLY ||
V519 The 'm_pDialog' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 3470, 3481. DXUTOpt dxutgui.cpp 3481

CDXUTControl::CDXUTControl( CDXUTDialog* pDialog )
m_pDialog = pDialog;
m_pDialog = NULL;

Orion Granatir (Intel)'s picture

Hey Andrey,
Thanks for the info! I'll have to take a closer look. I imagine the compiler removes these redundant assignments and conditionals but these issues are worth investigating (at least from a code maintenance point-of-view). The second one looks like a real bug.