a simple shadertoy

Guillaume's icon

Hey I'm learning how to port a shadertoy shader to jit.gl.pix
I'm trying with this simple example https://www.shadertoy.com/view/lslyRH

This is my patch, but nothing happen, can I know what I did wrong?

quantum-178.maxpat
text/plain 7.18 KB

and this is the code inside my jit.gl.pix I did :

R=dim;
u=cell-R/2;
a=0.32;
b=0.2;
d=1.0125/32;
c=159*d;
fi=atan(u.x,u.y);
col=vec(0.,0.,1.);

for(i=0;i<pi;i+=pi/16)
{
    temp1=i+c*fi-iTime;
    temp2=i+d*fi+iTime;
    col+=0.0005/abs(a+b*sin(temp1)*sin(temp2)-length(u)/(R.y/1.15));
}
    out=vec(col,1.0);

Thank you very much!

Federico-AmazingMaxStuff's icon

Hi Guillame! Just two things:
- You mismatched the name of the context assigned to jit.gl.pix, there was a typo
- in the codebox, atan must be replaced by atan2, since the behaviour of atan in gen is different

Here's the correct patch:

Max Patch
Copy patch and select New From Clipboard in Max.

Cheers!