Skip to content

Repository files navigation

鏡花水月 (Flower in the mirror, moon in the water)

A 64KB demoscene submission for the API8 64K track, written in C and GLSL.

Overview

鏡花水月 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.

Technical Features

  • 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.

Requirements

To build and run the demo, you need a Linux environment with the following dependencies:

  • Build Tools: gcc, make, strip, upx
  • Libraries:
    • OpenGL
    • SDL2, SDL2_mixer, SDL2_ttf, SDL2_image
    • GL4Dummies (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.

Building and Running

Compile and pack the demo:

make clean
make

Run the demo:

./demo

Credits

About

A 64KB demoscene submission for the API8 64K track, written in C and GLSL.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages