A few years ago, I wrote an example on how to port GLSL shader code from Shadertoy.com to Processing. Since then, Shadertoy has changed quite a lot (adding a lot of new uniforms and input methods) so an update was long overdue.
You can find it here: https://github.com/SableRaf/Shadertoy2Processing
There is still work to be done, but it should be a good starting point for anyone wanting to learn about shaders from the great material available at Shadertoy, and experiment with it in Processing.
I hope that will be helpful to some of you
Hi Raph Nice work!
In the TODO I see “supporting multipass shaders”. The PixelFlow library does that somehow. Maybe it can be useful to study how it works there. See https://github.com/diwi/PixelFlow/tree/master/examples/Shadertoy (Expansive Reaction Diffusion).
Very interesting! Thanks hamoid.
In the TODO, I want to know how to do “input Sound”. I have a project about “music visualization”. Help
I suspect the only way would be using one of the Processing audio libraries (like Sound, Minim, Beads or something else). With such libraries you can load a sound file, play it, get the FFT analysis, and send the FFT values to the shader as a uniform.
But: you could use p5.js, access the Soundcloud API, get the FFT, and forward the data to a shader, everything in the browser (unfortunately without using @sableRaph’s library).
I’ve been working on the sound input example. You can follow this issue on the repository for updates:
@hamoid And here it is. Not “expansive” though
How exactly did you copy the Shadertoy and make a .glsl file? I thought I could just make a .txt file and replicate what you had and save it as a .glsl file but that did not work. So how do I save as .glsl files?
Hi Spenc and welcome to the forums
You will have to remove text formatting from your file or (better) use a dedicated text editor such as SublimeText, Atom, Brackets, or any of the many text editors designed for code. Copy the glsl code inside the editor, make your changes, and save it directly as a .glsl file. There is no need to go through a .txt step.