Converting GLSL shaders for use in Jitter
Trying to get into some of my own shader work, but first trying to convert some of Vade’s quartz composer glsl shaders for use in jitter. I’m really close with his ‘analog glitch’ effect, but I’m missing something crucial. It seems like I may be sampling only a single pixel instead of every pixel or something..but I’m not sure what variable name I didn’t crossover correctly..most of the effect appears to work in terms of creating scanlines, but the spatial distortion isn’t quite what it is in quartz.
Attached is the shader that I’m working on..it compiles fine and does do most of the effects, but should be doing a sort of strange spatial distortion as well..anyone have some suggestions? I’ve been checking the tutorials (ie tutorial 43: a slab of your very own) but I’m not sure how to zero in on the problem.
can you post an example patch?
soitenly…as you can see with grab..if you reach into the upper left corner, it will shift the colors and brightness..but i assume that is from the sampler standing still and not getting each pixel..in restrospect this has happened to me before when trying to make opengl stuff in QC..so I'm missing something about how to properly sample
attached is an image of what things look like in QC
----------begin_max5_patcher---------- 1698.3oc0assbaaCD8Y4uBNZ5iNZHtwK4o1eg9P6CcxjARDVlNTjJjTI1MSl oeK8SqeIE.KksrhjE.HHEyXORFjRf6dvtm8Bf+1Mylur5QQy7f2G7WAyl8sa lMSeI0El0Md17M7GWUvazer42UTUtay7agacWUYaS9eKT2BgVvRYnj3t6ssV zHJa4s4UkerVrpEdLLZ3hvaCPjT0agcuD7gtukbxyKKDs5mFZ+TwaWced45y NML8.7QST0t18yDt6p4YZsnZ4CuCmbnVTx2n0h4+VcNuX+cfYn8osB3opTed 67aClujWtddvGTerueyMpWt0PDbinoguVr+QzJdTqRykvUUwNEZE7Kn9.vXM jfhRtL.ieC.9USSbrdPxYAXzI.3TG.X2vTOXUhzpIyGFkvr3jMIYZYSdeySk q5o4HAbTCodwbDlFlKliQil434fyUEUMhdfkDBQo2QrdAkuZVHINfj3Iniso 9nTrViYDW8QiBuN9nC.TPgE+PmigxRmV7UK40MboLW1ZHoko9LTvmIQ6yj3f OCK4py97EKHyMGW.lXfFgE4.vD+yLYBsKIImi3ynSKOnr7l1pZKxB0XKEpFi Po5.3wTGrTHilkRo3qxm3O.NxvxaEkYAa40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Go9K8kHxjmb3LpBZKPjhtPb2SsMMo9VAihU pnRsRPoQgIG9WtnfuKRalKKd7.kjFyrRKil7Kiztcbi47RICcnRp+d5D9N5+ G.8CWc8Wq4MU6pWs2+eeupBd4wmIZZyK0mf0C9PpFDevG5kMsZu7sIOaakjN oSHNCohoxjpaqdWlHRFC19yBn5j6zMnuxJdBheTSjIYZBAnInLMd3DCO8joi VVNsLoNgTinLgPSObRs2wdWlXnTEs.oaqZARB8HerpdIoUcBTFSKsTCjoibQ FbYxnnQoiqLEMAwIhI3TznJSDSrmNxscvYILxuabiNSoC.W.MMRwUQwGxbQw 8m4hh5ypJ5LRqrtMEyZHjkOb3xe8HbBr8q.irdTeihYh84QoCO3YfHeZ3KIR VFDKRiXHnsAXxyC7fndw7RhFczKzynWecWLIVw3l7lQzMiZs.DCknQDjLoR. KoFPHFPxE10368C5qrF5eYsuhjIqnnwMEIiX6G2rQhMPjF2baMI01wsVSlQL niakRLxzqB.V7DTlRldxTjIrkrQNqOip7tO9cxAe+l+G80zgz -----------end_max5_patcher-----------
in the fragment shader you are improperly declaring your texdim0 variable as a uniform.
change it to:
varying vec2 texdim0;
this way it will get the correct values from the vertex shader.
i’m surprised that didn’t produce an error. go figure.
Yep, that worked, thanks!
It is a bit difficult to debug things live in jitter with minimal error messages…It’s too bad the glsl object in Quartz composer also doesn’t seem to work as advertised a lot of the time, I’ve been trying to take jitter patches and bring them into QC as well but with little luck.
Is there a book that you would recommend for getting more out of shader creation? Is the orange book the one to get? It’s hard for me to find a comprehensive place online to even fully understand the difference between varying and uniform
Fixed shader is attached for anyone who wants it, but all credit goes to vade.
Now to try another one…
orange book and lighthouse tutorials are good places to start.
briefly, varying means it’s a variable that’s passed from the vertex to fragment shader. therefore it must be declared in both shaders.
uniform means it’s passed from the application to either vertex or fragment shader. therefore it must be also declared and bound in the jxs file.
As rob said the orange book is the best source. On the other hand porting between qtz and jitter is more than possible. Most of the time I design my shaders ‘there’ and then take them ‘here’. However, I have noticed that the bottleneck is the texture management in jitter(i was never able to make a shadow map work).
Hey that looks familiar… :)