GLSL shader and programming

kundi's picture

Hello,

I'd like to learn more about QC GLSL shader and programming with it..

Where can I read any documentation about programing in QC and GLSL shaders?

Thannks for help

Comment viewing options

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

laserpilot's picture
Re: GLSL shader and programming

points at some of tonebursts work

http://machinesdontcare.wordpress.com/

if you peek around there for a while you'll see some great laid out examples

and this is the oft referenced way to start learning basics: http://www.lighthouse3d.com/opengl/glsl/

i don't actually know glsl at all..I have tried to crack it for myself many times but haven't worked hard enough to get a break through yet...so the experts here will probably have many more suggestions..although this is a common question here

psonice's picture
Re: GLSL shader and programming

Learn the core image filter stuff first. It's more or less just stripped-down glsl, so you can get to learn how pixel effects work without worrying about the vertex shader and confusing coordinate systems etc.

Then move up to glsl, and read the lighthouse tutorials (and get used to referring to the glsl docs on khronos.org).

idlefon's picture
Re: GLSL shader and programming

As psonic said, start with CI filters. they work a lot like the fragment shaders (they're a subset actually).

After the lighthouse3d tutorials, these can be helpful:

http://www.geeks3d.com/demos/ (good examples)

http://www.falloutsoftware.com/tutorials/gl/gl8.htm (lighting and GLSL)

and of course the Orange book :)

http://www.amazon.com/OpenGL-Shading-Language-Randi-Rost/dp/0321637631/r...

gtoledo3's picture
Re: GLSL shader and programming

Mild disagree...

I'd look at the GLSL references pointed out, as well as the GLSL sample compositions that are on Apple's ADC site, and that are also in Quartz Composer Developer samples.

My disagree is on the CI comment, because while it is a subset, I think it's not as well documented, and it's kind of weird figuring out the differences in a slangy subset, when all you really have to fall back on is the well documented GLSL spec. It's not crazily hard to setup a GLSL shader to just do nothing to the verts, and work only on the pixels either.... and if you want to pass it on, you can render to texture, and send it to another shader. I'm not saying that I personally avoid CI, or do GLSL-render to texture-to another GLSL regularly, only that I think that's potentially a better starting point for learning shader language, as well as offering richer functionality save for there not being a bunch of pre-loaded stuff.

CI language didn't make complete sense to me until I understood GLSL better. Also, CI is much more inferior in it's completeness, performance machine to machine, lack of it working consistently in different domains (QC vs. out of QC) and arbitrary nature of max/min/ and defaults for parameters (yeah, this is my knee-jerk little whiny jag about CI...)

psonice's picture
Re: GLSL shader and programming

I found CI pretty easy to get into. There are docs (admittedly not great, but compared to the openGL docs they're at least understandable for a beginner), and it removes a lot of the complexity.

Stuff that makes it easier to learn: - Coordinates measured in pixels, rather than GLSL's choice of 2 texture2D functions (plus all the variants!) with different coordinate systems. - Limited number of functions. Yes, so it's limited, but it means there's a lot less to learn, making it easier to get into. You can get a lot done with the functions it does provide, and the functions match up with the glsl equivalents nicely giving you a good start on that. - No normals, funky texture coordinates and stuff. Removing a lot of superfluous stuff keeps it nice and simple. Nothing worse than spending ages debugging a shader only to find it's something relating to whatever mesh you're using..

Random list of useful docs for CI:

http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Re... http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Co... http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Co... http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Re...