Hi all
This is a small tutorial on how you can import shaders from the
https://www.shadertoy.com website to the Shader2LCD tool.
First a search for a perfect shader is advisable with does only has one shader program like this one for example
https://www.shadertoy.com/view/4tlSzl, shaders with multible programs have more then one tab on top of the text editor
( see
https://www.shadertoy.com/view/lsK3D1 ), they are not supported, however you can generate a video of a more complex shader by simply press on the record button on the preview window of the shadertoy website
and playback it with mplayer.
Ok back to our
Combustible Voronoi algorithm shader, first we create a new text document in the shader folder and name it
voronoi.f.glsl
, then we copy the contains of the shader input from the shadertoy website
to the new created file, after that we change the main function to look like this:
from
void mainImage( out vec4 fragColor, in vec2 fragCoord )
to
void main()
then we change all occurrences of:
iResolution
to
resolution
iTime
to
time
fragCoord
to
gl_FragCoord.xy
--> depending on the implementation fragCoord.x or y to gl_FragCoord.x or y
fragColor
to
gl_FragColor
on top of the document (first line) you place this:
Code: Select all
#ifdef GL_ES
precision highp float;
#endif
uniform vec2 resolution;
uniform float time;
uniform sampler2D tex0;
uniform sampler2D tex1;
vec4 iMouse = vec4(0., 0., 0., 0.);
The shader should be renderable now
Have fun
P.S.: to download textures from the shadertoy website please follow this tutorial
https://nvoid.gitbooks.io/introduction- ... ertoy.html
PP.S.: next tools will be gpio daemon which can start shell script when button is pressed and OSD Messages from shell script, maybe a videoplayer too like mplayer, we will see
