Cant see shaders

dr_casey's picture

Hello, i was trying some water stuff, and searching for; if it is possible to do it with shaders. I came across this I opened it like mentioned in the topic. But i can't see the code. Neither with text edit or shader builder. Is it precompiled or hidden somehow? if it is, how can i reach the shaders. I add a screen capture to illustrate. thanks :D

Picture 1.png
Picture 1.png294.09 KB

cybero's picture
Re: Cant see shaders

The code is to be found in the vertex and fragment editor panels within the Inspector panel for the GLSL Shader patch.

e.g - the vertex for Water Shader.

GLSL conversion of Michael Horsch water demo
Converted by Mars_999
varying vec4 waterTex0;
varying vec4 waterTex1;
varying vec4 waterTex2;
varying vec4 waterTex3;
varying vec4 waterTex4;
uniform vec4 viewpos, lightpos;
uniform float time, time2;
//unit 0 = water_reflection
//unit 1 = water_refraction
//unit 2 = water_normalmap
//unit 3 = water_dudvmap
//unit 4 = water_depthmap
void main(void)
    vec4 mpos, temp;
    vec4 tangent = vec4(1.0, 0.0, 0.0, 0.0);
    vec4 norm = vec4(0.0, 1.0, 0.0, 0.0);
    vec4 binormal = vec4(0.0, 0.0, 1.0, 0.0);
    mat4 mvp = gl_ModelViewProjectionMatrix;
    mat4 mtx = gl_TextureMatrix[0];
    temp = viewpos - gl_Vertex;
    waterTex4.x = dot(temp, tangent);
    waterTex4.y = dot(temp, binormal);
    waterTex4.z = dot(temp, norm);
    waterTex4.w = 0.0;
    temp = lightpos - gl_Vertex;
     waterTex0.x = dot(temp, tangent);
    waterTex0.y = dot(temp, binormal);
    waterTex0.z = dot(temp, norm);
    waterTex0.w = 0.0;
    mpos = mvp * gl_Vertex;
    vec4 t1 = vec4(0.0, -time, 0.0,0.0);
    vec4 t2 = vec4(0.0, -time2, 0.0,0.0);
    waterTex1 = gl_MultiTexCoord0 + t1;
    waterTex2 = gl_MultiTexCoord0 + t2;
    waterTex3 = mpos;
    gl_Position = ftransform();

hope that helps.

cwright's picture
Re: Cant see shaders

Cybero (posted above) is right regarding finding shaders from inspector panels.

That said, when you come across a .frag or .vert (or .vertex?) that looks like that (in your screen shot), it's almost certainly encrypted, so the author doesn't want you to use it.

dr_casey's picture
Re: Can't see shaders

Thank you, I understand that we write code or find code for shaders in GLSL Shader patch with QC, but since there is no QC file in the app and i can't open shaders with Text Edit or Shader Builder, how did Cybero get the code for shader. Maybe the author encrypted them after the topichave posted and Cybero got it before that, am I right? or is there another way of getting them. But if author does not want it to be used as i understand, it's ok. Thank you guys again :)

cybero's picture
Re: Can't see shaders

The code I presented you with is to be found within the Inspector panels for the GLSL Shader patch placed into water shader, dr casey :-)

What is somewhat clearer to me now is that you have been seeking to utilise a shader derived from within the package contents of some other application entirely.

cwright is absolutely right [no pun intended], the author has encrypted the shader you presented.

You ask where I got the code, I was beginning to wonder the same about the encrypted shader shown in your PNG screen grab, dr casey :-) .

There are shed loads of free open source examples of shaders that can be adapted, used and experimented with.

dust's picture
Re: Can't see shaders

i like to use ci filters for water but thats just me i guess that way i can use a shader for refraction of a jelly fish or something. it is a really simple technique to simulate water. take a particle render put it inside a render in image then attach you background pic to a glass distortion filter and use the particle as a texture. this method works really good. mess with the particle system to get the flow of the water you like. that how i made this. i used glsl refraction for the urchin even though urchins don't refract i though it looked cool. cwright has a really nice refraction glsl as well as the orange book has a refraction example that is good as well.

cybero's picture
Re: Can't see shaders

Pretty Thing.

Without tempting providence regards any future uploads from you, this is the most impressive work of yours that I've seen posted here.


dr_casey's picture
Re: Can't see shaders

Ohh i am really sorry Cybero :) it's my bad. When i see in the code, i get confused with ( bonzai, jungle all the botanics :) so i tought that it is the shader from the screensaver package. I did not fully read the topic I mentioned before. It all became clear after I read the bottom post. I tought that it was once open, but it was encrypted at first place. I am new to programming and quartz. And shader examples these were great to examine and play with, i am just learning and if it was open i tought that it would be great to have a look at :) again my bad, you guys are really helpful, thank you :) cheers.

And any examples and documents or websites to read about glsl shaders would be great :)

dr_casey's picture
Re: Can't see shaders

Dust, this really looks great. I tried the technique you mentioned. I saw it in the book of zugakousaku (sure you guys know him, may be the link can help another newbie like me :) ) What I am trying to create is some kind of interactive water. I used it inside an iterator and patched it with tuio patch and used CCV to track blobs . But when track points disappear ( for example if someone moves out of cam's sight fast) iterator stops because structure count goes zero. So the ripples stop at once. It looks unrealistic. Maybe I can offset it with patch time? but that may cause latency for all particles :)

dust's picture
Re: Can't see shaders

here is some interactive water. you going to want to make some sort of logic gate and connect it to the life time of the particle based on velocity or something to add some slow decay to the water ripples. this example i made real quick and only hooked up for one finger on the tuio protocol. ill think about the decay for a bit i got to go teach my kid how to ride a bike but maybe later i will see about getting you a better fall off. this example is surprising realistic for being fake.

tuioWaterInteractive.qtz4.36 MB

dr_casey's picture
Re: Can't see shaders

Thanks, have a great time with your kid :)'s picture
Re: Can't see shaders

This is excellent, dust. On ya, man.

dust's picture
Re: Can't see shaders

thanks bro wouldn't have figured that out if it where not for the GT man i don't have the QC book.

gtoledo3's picture
Re: Can't see shaders

This is too cool... I bet it's a bunch of sprite stuff too!? When you get pre-prepared art and start using QC for the setup and bells and whistles (like treating the images with filters), it can come into it's own in a really different way than from using the program itself to generate the imagery.

What I find so excellent about this is the color choice, and the fact everything looks totally intentional and very well considered.

The gregorian chant is kind of bringing me back to a different decade. WHAT chemicals were being pumped into the environment that would make Gregorian chant an actual fad music?

dust's picture
Re: Can't see shaders

there was actually only one sprite in the source for this. i needed a pic for the refraction to work so i added a coral reef pic which i could have totally made in maya then dropped in a render in image but that would have been a lot more prep work. the source is in the ribbon thread if anybody wants a copy. entirely simple for how beautiful it really looks to me. i can't get it to work as a screen saver but its really just model with a little ripple added to it then i added cwrights glsl refraction to the model and dropped a pic for the background refraction then put the whole thing in a render in image and ran it through the glass distortion with a particle to create the under water effect. in regards to the music i usually make electro and i just clipped a break down from one of my tracks in a haste to make the vimeo. i needed some smooth audio which i could have arpegiated with a synth but i really like the latin chants and never use them really so it seemed to fit. got to love the garage band jam packs for having some great vocal chants. they are pretty good cause they are keyed out so you can use them or transpose them to fit songs. i know what you mean though it gives you that late 80 early 90's enya feeling i guess. lol

gtoledo3's picture
Re: Can't see shaders

Oh, that's the Garage Band jam pack? Not bad.

I remember when Roland came out with this thing that would let you sample vocals, and then map to a keyboard and make a multi-timbral synth patch basically, doing the correct stuff to the formants. Jimmy Jam and Terry Lewis used to use it a great deal after it came out.

I remember having one on loan and being in heaven. It has been made pretty obsolete by the pitch shift and looping capabilities that have become so standardly bundled in DAW's, as well as by Antares Autotune, and Melodyne, but there was something so AWESOME about the way that piece of hardware worked. It was a vp9000 come to think of it. It was so ridiculous in features, but definitely with a "real" pro studio price at the time. I would love to pick one up now; it would have to be at a reasonable price I would think. Hearing that clip brought back a few memories of that gear even though it was achieved differently.

Speaking of Enya, "Harry's Game" that was recorded by Richard Dodd is a REAL standout for me when it comes to that style. If you haven't heard it, check it out. It really benefits from a good stereo, and the "non data compressed audio" real version. (Richard Dodd is a killer audio engineer.)

So... the moving sea plant is actually a 3D object? I was so thinking it was an iterator sprite thing.

dust's picture
Re: Can't see shaders - UnderWater Source

yeah k3d man. here is the source have a look if you like. change it around mash it, i don't care. i wouldn't have been able to solidify the look with out your water example from a few months ago.

underWater.zip946.59 KB

gtoledo3's picture
Re: Can't see shaders - UnderWater Source

Man, I will have to post cooler version of that, I've made several twists on that concept. I remember getting a desktop screensaver thing from Useless Creations that really had me hyped about water stuff.

Using glass distortion for that is a pretty old technique, and it pops up in a ton of programs besides QC. I have an ultra simple Windows image editing program that does the exact same thing (though I haven't used it in years).

I remember a zuga had some kind of example at one point, but there being something weird about it, or maybe I was used to the way my typical setup looked. I tend to add in some accumulator nowdays.