#shader-toy #wgpu #integrate #able #uniform #mouse #audio #wgpu-shader

shady

A shadertoy-like library to be able to easily integrate shadertoy-like stuff in your applications

16 stable releases (7 major)

7.0.0 Mar 11, 2025
6.0.1 Mar 5, 2025
6.0.0 Feb 25, 2025
5.0.5 Feb 24, 2025
0.1.0 Feb 21, 2025

#228 in Graphics APIs

Download history 1/week @ 2025-05-16

1,140 downloads per month

GPL-3.0-or-later

57KB
1.5K SLoC

A shadertoy like library to be able to easily integrate shadertoy-like stuff in your applications. It provides functions to setup the following uniform buffers (which will be also called Resources within this doc):

  • iAudio: Contains frequency bars of an audio source.
  • iFrame: Contains the current frame count.
  • iMouse: Contains the coordinate points of the user's mouse.
  • iResolution: Contains the height and width of the surface which will be drawed on.
  • iTime: The playback time of the shader.

Note:

  • You should be familiar with wgpu code in order to be able to use this.
  • shady is not compatible with shadertoy's shaders so you can't simply copy+paste the fragment code from shadertoy to application which are using shady (but porting them should be very easy in general).

Feature flags

Each resource is behind a feature gate so if you don't want to use some of them, just disable their feature gate.

Example

An "mini" example can be seen here: https://github.com/TornaxO7/shady/blob/main/shady-lib/examples/mini-simple.rs I tried to make it as small as possible.

Just search after the string SHADY within the file and you'll see what you can/need to do to include it into your renderer.


shady-lib

The main library which takes care of the uniform/storage buffers, vertices and templates.

The idea is that other applications who wish to include shadertoy-like shaders into their application to use this library which takes care most of the data to be able to run those shaders.

State

It's useable, however I'm a bit unsure about the architecture because I don't really know what a good API looks like for a graphics-programmer.

Example

A simple example can be seen here: https://github.com/TornaxO7/shady/blob/main/shady-lib/examples/mini-simple.rs if you want to include it to your app. All relevant places where you have to "interact" with shady are annoted with the // SHADY comments.

Dependencies

~13–48MB
~701K SLoC