GLSL Shaders, What are they?

m4rkei's picture

Hello kineme peoples. I love the forum and the excitement I've been picking up on this wonderful application.

I'm a visualist thats moving from mixing all video clips to more generative based visualizations.

I've been trying to piece together a few things and I think maybe someone here can help me on how to use GLSL shaders.

I've gotten to the point where I have vertex and fragment shader code that i'd like to use. I create an empty composition, then paste the code to the info, however i do not see the shader being built. I'm still really new to this and trying to figure out where I am going wrong. i know there propbably needs to be some sort of controller plugged into it to tell it how big to be, etc. i just dont know where to start. i really only need to use QC for this as all my other effects are done in after effects. i see some cool possibilites with this software in generative real time 3d. thats what im interested in.

thanks in advance for any help you guys and gals can give me. im totally lost, so forgive me if im not even asking the appropriate questions.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cybero's picture
Re: GLSL Shaders, What are they?

Firstly, you'll have to have the Developer Tools installed and you'll find the default QC GLSL example compositions in the Patches folder.

If you are running 10.6.x, you'll find that folder in /Developer/Library/Examples/Quartz Composer/Patches.

All the examples are named with GLSL appended, so if you just search in Spotlight it will raise these and other examples, just search by File Name in Finder.

There are loads of great places to look on the web for GLSL examples, although you will find that some have to carefully ported into QC.

You speak of pasting the code into the Info. Don't rightly know what you mean by that, but what I do is to type up in a text editor , like Text Wrangler and then copy and paste the code into the appropriate Vertex or Fragment panel in the GLSL shader.

Vertex Code panel

Fragment Code panel

Thereafter everything should be plain sailing.

The inputs you have to work with depend entirely upon what variables, colours, textures, etc that the shader code calls upon when processed.

GLSL0.png117.52 KB
GLSL1Vertex.png62.55 KB
GLSL2Fragment.png63.1 KB

dust's picture
Re: GLSL Shaders, What are they?

once i found QC i gave up after effects as a lot of AE style effects can be accomplished in QC without waiting for the render. if you prefer video clip style visualizations then you can use quartz crystal to render out QC comps into clips. although you can use a comp as a clip sometimes depending on the composition its best to render offline and bring into QC as video clip when frame rates are important.

Also in your HD>Developer>Applications>Graphics folder there is a OpenGL Shader Builder that helps debug your codes and what not. Primarily if it will run in the builder you can copy and past to QC but not always. Even though the specification and syntax of GLSL is relatively small I still find some things baffling and wish to put some more time into exploring it further.

Its more or less like building a shader network in any 3d software but you do it programmatically and its on a per pixel basis or pixel by pixel basis. It has some handy built in functions that would be complex to do otherwise in QC. I think understanding CL kernels might help a lot with understanding GLSL as they have a very similar context.

There are some peeps on here that are GLSL wizards and i'm sure they can answer any question you have, given it is phrased right etc..