I often see visual experiments with computational shaders (or other methods) done in Unity such as these: https://twitter.com/psychobiotik/status/1144917665477062656 https://twitter.com/ziyangwen/status/1223209856124870657 https://twitter.com/andyduboc/status/1144994197621153792

This effect is often referred to as reaction diffusion, and here is a tutorial of how it works, using Photoshop:

It's a recursive operation so each iteration needs to be based on the result of the previous iteration. I am probably jumping way ahead of my knowledge considering I'm just a beginner, but I was wondering if this is feasible to do in Godot, and how would people approach it.

Godot currently doesn't support compute shaders (as of 3.2), but there will be a compute shader API in Godot 4.0.

A compute shader isn't really required. Something like this is possible with a simple chain of ping pong rendertargets. So this is definitely doable in Godot 3.2.

Thanks for the replies! Great to know comput shaders are coming with Godot 4.

@SIsilicon28 is there such an example of how to achieve a recursive shader? Can I use a shader's previous output as input in e.g. the VisualShader?

@SimonTheSorcerer said: @SIsilicon28 is there an example of how to achieve this? Can I use a shader's previous output as input in e.g. the VisualShader?

You can indeed feed a shader's previous output into itself. You'll need at least two viewports to achieve that though, hence the ping-ponging. Something like this. Main - Viewport - - ColorRect(does the shading) - Viewport2 - - ColorRect(same thing)

The second Viewport uses the first viewport's texture when rendering and vice versa. On the first frame the first viewport needs to be initialized. After which all it needs to do is use the second viewport's texture.