Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shadertoy-to-scr

C++20 CMake

Turn a Shadertoy-style fragment shader into a Windows screensaver (.scr).

Download

You can download the current nightly build from GitHub Releases, or build it yourself from source.

All release archives include a GitHub artifact attestation. To verify a downloaded archive:

gh attestation verify .\shadertoy-to-scr-nightly.zip --repo Z1xus/shadertoy-to-scr

Build

Requirements:

  • Windows
  • CMake 3.24+
  • C++20 compiler
  • OpenGL-capable graphics driver
cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failure

The Windows build creates:

  • stscr_packager.exe
  • stscr_runtime.exe
  • stscr_runtime.scr

Package a Shader

Shaders need the usual Shadertoy entry point:

void mainImage(out vec4 fragColor, in vec2 fragCoord)

Build a .scr:

.\build\stscr_packager.exe .\examples\minimal.frag

By default, the packager looks for stscr_runtime.exe next to stscr_packager.exe and writes output next to the shader with a .scr extension. You can still override either path:

.\build\stscr_packager.exe `
  --shader .\examples\minimal.frag `
  --runtime .\build\stscr_runtime.exe `
  --output .\build\minimal.scr

Frame rate syncs to the display by default. Package a fixed cap or unlock rendering with:

.\build\stscr_packager.exe .\examples\minimal.frag --fps 30
.\build\stscr_packager.exe .\examples\minimal.frag --unlock-fps

The generated screensaver exits on keyboard input, mouse button input, mouse wheel input, or real mouse movement.

Run it:

.\examples\minimal.scr /s

To install it, copy the generated .scr somewhere Windows can load screensavers from, then select it in Windows screensaver settings.

Supported So Far

  • mainImage(out vec4 fragColor, in vec2 fragCoord)
  • iResolution
  • iTime
  • iTimeDelta
  • iFrame
  • iMouse
  • iDate
  • iSampleRate
  • iChannelTime[4]
  • iChannelResolution[4]
  • iChannel0 through iChannel3

The channel samplers are currently bound to neutral 1x1 fallback textures. That means shaders that reference channels can compile, but real Shadertoy texture/video/cubemap inputs still need package metadata and loader support.

Buffers, audio shaders, keyboard input, real cubemap assets, real channel assets, and multipass rendering are not implemented yet.