I just started using the slab shaders and had a question regarding the math shaders.
I understand how to call for an op.operation.jxs, but how would I do a multi-operation using these shaders? For instance, if I wanted to do a @op * * *, how would that look?
There is not currently a way to do multi-ops in jit.gl.slab, in the way that you are expecting. If you don’t mind digging into a little shader programming, it’s pretty trivial to create something that does what you need.
So if I wanted to do that, would I simply modify the op.multi.jxs file to say:
vec4 result = v0 * v1 * v1 *v1;
in line 54?
Or is it more complicated than that?
to assign different ops for each color channel it would be more like:
vec4 result = vec4(v0.r*v1.r,v0.g*v1.g,v0.b*v1.b,v0.a*v1.a);
There are 2 important things going on here. First, we’re constructing a vec4 using vec4(r,g,b,a). This vec4 is a pixel value RGBA, and is made out of 4 floating point numbers. The other thing is using the swizzle (‘v0.r’) notation to access different elements of the input vec4. This is kind of like using @planemap. Swizzle can be done using either my_vec4.rgba or my_vec4.xyzw notation.
C74 RSS Feed | © Copyright Cycling '74