Frostlight
An animated winter wallpaper for Windows that draws underneath the desktop icons and reacts to windows, icons and the cursor. Native C++20 and Direct3D 11 with no dependencies and no image files; the whole scene is computed in shaders.
Project facts
- Size
- 15,721 lines in 109 source files, of which 13,229 are C++ and 2,458 HLSL. Two compute shaders
- Dependencies
- None beyond Windows itself. No image assets
- Measured on
- One PC with an NVIDIA RTX 5080, at 5120 × 2160
- Version
- 0.2.0
- Built with
- C++20, Win32, Direct3D 11, DirectComposition, HLSL
- When
- Nov 2026 to now
- Status
- In progress
- Page updated

Why it is on a robotics site
Most of my robot code is Python. This is the C++ I can show: a small real-time system with a render thread, shared state between threads, strict timing against the display, and a hard rule that it must never stall the program it lives inside.
The hard part: living inside the desktop
A live wallpaper has to draw underneath the desktop icons, inside a window that belongs to Windows Explorer.
- It creates a click-through child window inside Explorer’s desktop window, directly below the icon view, and hands its frames to the Windows compositor through DirectComposition, with one swap chain per monitor.
- The window’s thread does nothing but pump messages. Rendering runs on its own thread, which owns the graphics device and takes commands from a queue, so a slow frame can never block Explorer.
- A controller thread handles the tray icon, locates the desktop window, and checks the wallpaper’s health every 2 seconds.
- If the graphics device is lost, the renderer rebuilds itself and backs off between attempts.
Attaching to the desktop relies on an undocumented Windows message, so it can break with a Windows update. A self-test checks the attachment on the machine it runs on.
Timing and power
- Frame pacing. A high-resolution timer wakes the render thread half a refresh period before every N-th vertical blank reported by the compositor, where N is the display’s refresh rate divided by the target frame rate.
- Doing nothing when nobody is looking. Rendering pauses when the desktop is locked, the display is off, a full-screen program is running, or less than 0.3 % of the desktop is visible. It drops to 30 frames per second when less than 10 % is visible, in energy saver, or after 5 minutes idle.
- Protecting an OLED panel. A compute shader measures the average brightness of each frame and holds it down, the final pass maps dark tones to exact black and dithers only lit pixels, and the image shifts by a few pixels over time.
The scene
Every frame runs a compute shader for the snow, with one GPU thread per flake: fall, sway, wind, turbulence, a swirl around the cursor, a push from up to 16 moving windows, and landing on the tops of windows. Then the sky, five landscape layers, the effects around windows and icons, a five-level bloom, the brightness governor and the final pass.
Measurements
All on one PC, from offscreen renders at 5120 × 2160, not from the live desktop.
| What | Result |
|---|---|
| Desktop self-test | Pass: 140 of 140 free desktop points and 24 of 24 on-screen points matched |
| Occlusion test | 7 of 7 steps, including pausing when covered |
| Average displayed brightness | About 1 % of full brightness |
| Pixels that are exactly black | 36 to 41 % |
| Scene size | 7,896 snowflakes and 583 trees |
Limits
- One machine, one Windows version. A fallback path for older Windows exists but has no test results.
- There is no unit-test suite. The program carries its own checks: a desktop self-test, an occlusion test, an effects test and a layout check.
- “Costs nothing when hidden” is true of the render thread, which waits without a timeout. I have not measured the process’s CPU use when paused.
- It is not published yet, and has no licence file.