P5.js Using Shaders with FrameBuffers

Hi all!

I’m trying to use p5.js framebuffers with shaders. I have had success with other shaders but this threshold shader and a few other similar ones I have only work for a moment and then the screen fades to black. I can’t tell if it’s an issue on the shader side or something else.

Here’s a link to the sketch

Any help would be greatly appreciated!

Add a resetShader(); after the rect();. The shader is still in effect the next time you draw the layer which is (somehow) causing the problem.

2 Likes

Thank you so much, I’ve been banging my head against the wall for 4 days. I couldn’t for the life of me figure out why the sampler seemed to change over time. I tried so many things, thank you. I really have no idea why certain shaders are affected or what the underlying interaction is that makes this happen.

Ping @davepagurek for shader wisdom :slight_smile: