Forums > Jitter

Converting GLSL shaders for use in Jitter

May 24, 2010 | 3:35 am

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.


May 24, 2010 | 8:33 pm

can you post an example patch?


May 24, 2010 | 11:23 pm

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

May 25, 2010 | 7:12 pm

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.


May 26, 2010 | 4:06 pm

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…


May 26, 2010 | 4:30 pm

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
May 26, 2010 | 6:35 pm

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


May 28, 2010 | 7:26 am

Hey that looks familiar… :)



efe
May 28, 2010 | 10:06 am

hehehe, indeed


Viewing 9 posts - 1 through 9 (of 9 total)