Converting GLSL shaders for use in Jitter

laserpilot's icon

Hey all,

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.

582.td.analogglitch.jxs
jxs
Rob Ramirez's icon

can you post an example patch?

laserpilot's icon

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

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

attached is an image of what things look like in QC

587.proper_distortion.png
png
Rob Ramirez's icon

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.

laserpilot's icon

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...

593.td.analogglitch.jxs
jxs
Rob Ramirez's icon

orange book and lighthouse tutorials are good places to start.
http://www.lighthouse3d.com/opengl/glsl/index.php?intro

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.

efe's icon

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).

vade's icon

Hey that looks familiar... :)

efe's icon

hehehe, indeed