p5.js: Shader API

I’m currently working on a JavaScript -> GLSL compiler to be released with p5.js 2.0. The API allows you to inject shader code into premade shaders, building from the experimental Shader Hooks API.

myShader = baseMaterialShader().modify(() => {
    const color = uniformVec4(1, 0, 0, 1);
    
    getFinalColor((col) => {
        col *= color;
        return col;
    });
})

I am writing a full tutorial for the p5.js website for its release. I will do a writeup on this page once that’s complete.