Download: https://horman.net/avisynth/
ShaderToyVK is a GPU compute/graphics pipeline interface using the Vulkan API. It generates RGB output from user-provided GLSL code, following the example of (but not affiliated to or endorsed by) shadertoy.com.
Many ShaderToy shaders (those without external inputs or buffer images) will work without modification.
| Parameter | Description | Default value |
|---|---|---|
| clip [optional] | An input clip to provide clip parameters or audio | |
| string "shader" | GLSL code, or filename for GLSL code file, confirming to ShaderToy requirements | |
| int "width" | Output video width | |
| int "height" | Output video height | |
| int "length" | Output video length, in frames | |
| int "fps_num" | FPS numerator | |
| int "fps_den" | FPS denominator | |
| string "pixel_type" | Any Avisynth+ RGB colourspace name | |
| bool "top_left" | Origin at top left (instead of ShaderToy's/WebGL's bottom left) | false |
| bool "srgb" | Convert linear output of shader to sRGB colourspace | false |
| string "pipeline" | Vulkan pipeline type | compute |
| string "gpu" | Select GPU by partial name match | |
| bool "debug" | Superimpose GPU list and enable Vulkan validation layers | false |
If an input clip is provided, output video properties (but deliberately not frame properties) will be taken from it, as well any audio. If it is not an RGB clip, an RGB colourspace will need to be specified in pixel_type.
If an input clip is not provided, the output clip will default to 640×480, 1000 frames, RGB32, at 60fps.
This parameter either takes inline GLSL code, or the filename of a file containing GLSL code, which produces the output. At minimum, the code must have a function matching the following name and signature:
void mainImage(out vec4 rgba, vec2 fragCoord) {…}
The parameters may be renamed.
The function should write RGB (and, optionally, alpha) values to the rgba for the pixel centered at the coordinate specified by fragCoord.
The following global variables are provided:
| Variable | Description |
|---|---|
| vec4 iMouse | Provided for compatibility as many ShaderToy shaders use it. Emulates no mouse input. |
| vec3 iResolution | Three-dimensional resolution of output video (width × height × 1) |
| float iFrameRate | Video frame rate |
| float iTimeDelta | Provided for compatibility (equal to 1.0 / iFrameRate) |
| int iFrame | Current frame number |
| float iTime | Time of current frame in seconds |
| GLSL | Output |
|---|---|
| A simple colour field (with srgb = true for correct display):
ShaderToyVK("""
void mainImage(out vec4 o, vec2 fragCoord) {
vec2 uv = fragCoord / iResolution.xy;
o = vec4(1.0 - uv, uv.x * uv.y, 1.0);
}
""", srgb = true)
Dividing fragCoord by iResolution.xy normalises the coordinates to the range [0,1]. | |
| A rotating square, with built-in sRGB approximation, so srgb should be false.
ShaderToyVK("""
void mainImage(out vec4 o, vec2 fragCoord) {
// center and normalise
vec2 uv = (fragCoord - iResolution.xy * 0.5) / iResolution.y;
// rotate
float s = sin(iTime);
float c = cos(iTime);
uv *= mat2(
vec2(s, c),
vec2(c, -s)
);
// square
vec2 abs_uv = abs(uv);
float len = max(abs_uv.x, abs_uv.y);
float col = (0.25 - len) * iResolution.y; // convert distance to pixel-width edge
// set output (sqrt acts as sRGB transfer function approximation)
o = vec4(vec3(sqrt(col)), 1.0);
}
""")
|
These parameters override the corresponding clip properties. You can set fps_num alone to specify an integer frameerate.
The name of any Avisynth+ RGB colourspace.
RGB32 is the fastest 8-bit colourspace, and RGB64 the fastest >8-bit colourspace, as their internal formats match those of the corresponding GPU image.
WebGL defaults to a bottom-left origin (the bottom left pixel has coordinates [0.5, 0.5]).
Vulkan defaults to a top-left origin, so if your shader expects this, set this parameter to true.
All ShaderToy shaders make approxmations for (or just ignore) the non-linear sRGB transfer function for display.
If you want to output only raw linear RGB from your GLSL code, and have it converted for display (or if your output just looks too dark) set this parameter to true.
ShaderToyVK defaults to the Vulkan compute pipeline to create the output image, avoiding rasterisation.
To use the full graphics pipeline instead (vertex shader → rasterisation → fragment shader), set this parameter to graphics.
This may be useful in debugging, but should otherwise be left as default.
Specifying this parameter will cause ShaderToyVK to select the first GPU whose system name contains the parameter value as a substring (case insensitive). E.g., gpu = "nvidia" will select the first NVIDIA GPU.
If unspecified, ShaderToyVK will choose the first discrete GPU it finds, falling back to the first integrated GPU if there are no discrete GPUs.
ShaderToy allows shaders to read external inputs and generate off-screen buffer images. ShaderToyVK doesn't support either of these, but most self-contained shaders that don't use these features should work without modification.
WebGL automatically initialises variables to zero. In Vulkan, this must be done explictly, and failing to do so may lead to unexpected behaviour. For example, the variable declaration float x; should be replaced with float x = 0;, unless it is initialised elsewhere before use.
© wonkey_monkey 2026