Shadertoy: how to use multipass shaders

OK, I promised this one.
I implemented as PyPlugs, and pushed to natron-plugins:

  • a 3-pass Circular Bokeh blur inspired by Shader - Shadertoy BETA (available as Community/GLSL/BokehCircular_GL in natron-plugins)
  • a 4-pass Octagonal Bokeh blur inspired by Shader - Shadertoy BETA (available as Community/GLSL/BokehOctagon_GL in natron-plugins)

The principle is very simple: since multipass cannot be done using a single Shadertoy, use several Shadertoy nodes, route the textures between them, and link the parameters.

In the natron-plugins repo (natron-plugins/GLSL/Blur/BokehCircular_GL at master · NatronGitHub/natron-plugins · GitHub and natron-plugins/GLSL/Blur/BokehOctagon_GL at master · NatronGitHub/natron-plugins · GitHub) I also put the individual shader sources for each Shadertoy, as well as the original shader sources from shadertoy.com. You can learn from these two examples.

The only multipass effects that can not be implemented are the shaders that read back the content of a buffer to compute that same buffer, because compositing graphs cannot have loops (the execution of such a graph would cause an infinite recursion). One example is Shader - Shadertoy BETA

6 Likes