Converting GLSL shaders for use in Jitter

May 24, 2010 at 3:35am

Converting GLSL shaders for use in Jitter

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.

#50528
May 24, 2010 at 8:33pm

can you post an example patch?

#181265
May 24, 2010 at 11:23pm

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

– Pasted Max Patch, click to expand. –

[attachment=133236,587]

Attachments:
  1. proper_distortion.png
#181266
May 25, 2010 at 7:12pm

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.

#181267
May 26, 2010 at 4:06pm

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…

#181268
May 26, 2010 at 4:30pm

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.

#181269
May 26, 2010 at 6:35pm

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

#181270
May 28, 2010 at 7:26am

Hey that looks familiar… :)

#181271
May 28, 2010 at 10:06am

hehehe, indeed

#181272

You must be logged in to reply to this topic.