A 64KB demoscene submission for the API8 64K track, written in C and GLSL.
鏡花水月 is a real-time raytraced demo. It features a custom N-body gravitational physics simulation that choreographs the motion of spheres across a serene moonlit lake surrounded by procedural Shan Shui style mountains, tumbling cherry blossoms, and glowing fireflies.
The entire visual pipeline is driven by a single fragment shader (raytrace.fs), while the physics and camera direction are handled on the CPU.
- N-body Physics: Symplectic Euler integration handling gravity, collisions, and water surface impacts.
- Raytracing: Realistic metallic spheres and water surfaces.
- Procedural Generation: The moon's craters, starfield, water ripples, distant mountain ranges, cherry blossoms, and volumetric fireflies are all procedurally generated within the 64KB constraint, without external textures.
To build and run the demo, you need a Linux environment with the following dependencies:
- Build Tools:
gcc,make,strip,upx - Libraries:
OpenGLSDL2,SDL2_mixer,SDL2_ttf,SDL2_imageGL4Dummies(framework)
- Runtime Assets:
- A CJK font (e.g.,
noto-fonts-cjk) for the title rendering. - A SoundFont (e.g.,
fluid-soundfont-gm) for MIDI playback.
- A CJK font (e.g.,
Compile and pack the demo:
make clean
makeRun the demo:
./demo- Code & Visuals: Gregorio Silvestri
- Music: "32 Cogwork Dancers" by Criminal (licensed under Creative Commons) - https://soundcloud.com/turkeybaconclub/32-cogwork-dancers-32