Animation Fractal

Pure Nim score 16/100 · last commit 2024-05-19 · 6 stars · tests present · no docs generated

Summary

Latest Version Unknown
License Unknown
CI Status Failing
Stars 6
Forks 0
Open Issues 0
Last Commit 2024-05-19
Downloads 0
Last Indexed 2026-09-06 06:05

Installation

nimble install Animation Fractal
choosenim install Animation Fractal
git clone https://gitlab.com/TristanCacqueray/animation-fractal

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
Animation Fractal - - - - - - -

README

Animation Fractal

Note that this is a work in progress, please get in touch if you are interested.

Introduction blog post and demo: https://tristancacqueray.github.io/blog/introducing-animation-fractal

Overview and scope

The primary goal of this project is to produce visualisations akin to demoscene. The secondary goal is to demonstrate that Haskell is great at computer graphics.

The user provides:

  • A shadertoy (fullscreen fragment), e.g. an IFS or SDF ray marching.
  • Uniform parameters, e.g. complex seeds, zoom, orbits location.
  • Input modulations, to animate the parameters.

The project enables:

  • Running the animation in real time, with dear-imgui controller to adjust the parameters.
  • Render pre-recorded inputs into frame perfect high quality video.
graph LR
  subgraph "Main Engine"
    INP(Collect Input) --> MOD(Modulation Matrix)
    UI(Controller) --> MOD
    MOD --> UBO(Update scene)
    UBO --> DRAW(Draw)
  end
  subgraph "Animation"
    Scene(Play input) --> MOD
    DRAW --> Record
  end

Features

The current implemention is a work in progress, here is a tentative roadmap:

  • Engine:
  • [x] Render shader offscreen and present texture fullscreen.
  • [ ] Render "map" shader to adjust julia seed location.
  • [x] Hot reload the SPIRV code on change.
  • [x] Take screenshot.
  • [x] Render final video.
  • Shader:
  • [x] Normalized UV for IFS, based on window resolution and aspect ratio.
  • [ ] Generate glsl code using external process (see hy2glsl).
  • [ ] Support FIR code.
  • User interface:
  • [x] IFS center on click and zoom on scroll.
  • [x] Add params save and restore.
  • [ ] Ray march camera position.
  • [x] Fine grain sliders to adjust the parameters.
  • Inputs:
  • [x] Simple trigger.
  • [x] Midi events.
  • [ ] Audio frequencies.
  • Modulations:
  • [x] Easing function, e.g. to handle smooth input jumps.
  • [x] Second order dynamics, based on Giving Personality to Procedural Animations using Math.

History

Previous implementation are available:

The python implementations are fast to reload, but hard to compose, and processing audio inputs in realtime often cause segfaults. The fir examples are ideal because the dear-imgui controllers are defined in the shader code, but the display engine is too low-level. This new project is based on the keid engine.

Usage

Run a demo: cabal run animation-fractal -- --help

Watch shader code: ghcid -W --test 'AnimationFractal.compile "demo-name"'

Grab vulkan wrapper: NIXPKGS_ALLOW_UNFREE=1 nix shell --impure github:nix-community/nixGL#nixVulkanNvidia