#applications #able #shaders #integrate #wgpu #template #shadertoy

shady

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

15 stable releases (6 major)

new 6.0.1 Mar 5, 2025
6.0.0 Feb 25, 2025
5.0.5 Feb 24, 2025
4.0.0 Feb 24, 2025
0.1.0 Feb 21, 2025

#113 in Graphics APIs

Download history 267/week @ 2025-02-15 888/week @ 2025-02-22 237/week @ 2025-03-01

1,392 downloads per month

GPL-3.0-or-later

55KB
1.5K SLoC

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.


lib.rs:

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.

Dependencies

~12–47MB
~682K SLoC