shaderToy to spark sl conversion

I need help converting this shader from shadertoy to sparksl I tried but it didn’t work for me.

fire-pilot.arexport (34.4 KB)

1 Like

You actually only need one delay frame for this - and it’s just used for storing the frame, not mixing it with another texture like you were doing in your original. The idea is to keep the frame in memory and then read the pixels when the next frame renders.

The biggest thing to note is that this shader is using some chromakey to get rid of the greenscreen in the demo video. You probably don’t want that since we can use person segmentation in spark.

vec2 uv = fragment(getVertexTexCoord());
vec4 tex = maincamera.sample(uv);
// float newG = min(tex.g,max(tex.r, tex.b));
// float d = abs(tex.g - newG);
// tex.g = newG * 0.9;
float d = 1. - tex.a; // just use the alpha channel instead of chromakey

Also, there is a line that is determining the pixel size for the effect. You could determine this with some spark SL methods (x/std::getRenderTargetSize()), but I added an input so you can tweak it in patches. Here’s what the graph looks like.

And since the “image” shader is just doing some simple compositing, I left that out and did the compositing step in patches just so you get more visual feedback and control in the patch graph.

fire-pilot-v140-fixed.arprojpkg (23.9 KB)


Thanks sir it solved!

1 Like