A program to run and develop your shadertoy shaders locally!
The project is under active development. It is possible to run shadertoy shaders, but iChannels are currently not supported.
I am adding them in future.
You need to have
rust
installed.
Clone this repository and run
cargo install --path .
After the installation, the shadertoy
command should be available (make sure, cargo binaries are available in $PATH
).
Run a shader with the command
shadertoy -s shader.glsl
Like mentioned above, shaders are compatible with the shadertoy.com
style. This project supports live reloading. Happy coding!
Get to know the GLSL Website. This is the ground truth to know about, but in my opinion not the most efficient way to learn shader programming.
I recommend to follow this blog and use shadertoy.com for writing your first shaders. You can also use this program to run your shadertoy shaders locally and use your favourite development environment for it.
// Frag Color is the color to paint the pixel in, fragCoord is the coordinate of the pixel to paint
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
// Just paint every pixel green
fragColor = vec4(vec3(0., 1., 0.), 1.);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
// Normalized pixel coordinates (from 0 to 1)
vec2 uv = fragCoord/iResolution.xy;
// Time varying pixel color
vec3 col = 0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));
// Output to screen
fragColor = vec4(col,1.0);
}
iResolution
: Avec2
for the window width and heightiTime
: A floating point number which holds the time the program runs in secondsiMouse
: Avec4
which holds the x and y coordinates of the mouse in the first two dimensions when clickediFrame
: Holds the count of the frame that will be displayed (integer)iFrameRate
: Holds the frame rate of the window (float)