React Bits background shaders remade from scratch in DirectX 11 (HLSL) for C++ ImGui
12 animated HLSL background shaders for DirectX 11 ImGui applications. Each shader renders into its own offscreen FBO and outputs an ID3D11ShaderResourceView ready for ImGui::Image(). All shaders are self-contained header files with no external dependencies beyond D3D11 and ImGui.
| Shader | Preview (Video) | Mouse |
|---|---|---|
ColorBends |
0:00 | ✓ |
Galaxy |
0:07 | ✓ |
Light Rays |
0:15 | ✓ |
Lightning |
0:23 | |
LineWaves |
0:29 | ✓ |
LiquidChrome |
0:40 | ✓ |
LiquidEther |
0:50 | ✓ |
Particles |
1:01 | ✓ |
PixelSnow |
1:09 | |
Plasma |
1:14 | ✓ |
Prism |
1:24 | |
PrismaticBurst |
1:31 | ✓ |
#include "shaders/LiquidChrome.h"
// in your render loop:
static shader::LiquidChrome s_shader;
ImVec2 size = ImGui::GetContentRegionAvail();
ImVec2 pos = ImGui::GetCursorScreenPos();
s_shader.Update(ImGui::GetIO().DeltaTime, size, pos);
ImGui::Image((ImTextureID)s_shader.outputFBO.srv, size);┌──────────────────────────────────────┐
│ // Call │
│ static ShaderClass s_shader; │
│ s_shader.Update(dt, size, pos); │
│ ImGui::Image( │
│ s_shader.outputFBO.srv, size); │
└──────────────────┬───────────────────┘
│
▼
┌──────────────────────────────────────┐
│ Update() │
│ Init on first call │
│ Resize FBO if window changed │
│ Write props → GPU constant buffer │
└──────────┬───────────────────────────┘
│
▼
┌──────────────────────────────────────┐
│ cbuffer (b0) │
│ iResolution · iTime · uHue │
│ uSpeed · uIntensity · uSize │
└──────────┬───────────────────────────┘
│
┌─────┴─────┐
▼ ▼
┌─────────┐ ┌────────────────────────┐
│ VS │ │ PS │
│ 3 verts │ │ effect math │
│ no VB │─▶ → float4 RGBA │
└─────────┘ └──────────┬─────────────┘
│
▼
┌────────────────┐
│ outputFBO.srv │
└────────────────┘
LiquidEther is the exception — it runs a multi-pass Navier-Stokes simulation (advection → external force → viscosity → divergence → pressure → color) across several internal FBOs before writing the final output. Auto-animates after 3 seconds of no mouse input.
- Windows x64
- DirectX 11
- ImGui (any recent version)
- Shader globals exposed:
g_pd3dDevice,g_pd3dDeviceContext