How does shader work ?


All of my newbie question is in the title…

How does ofShader work ?
Is there a good book/tutorial/examples to learn shader coding ?
Does it could be the same way to code shading in OF, in vvvv, and all others creative code using openGL ?

Thx in advance to all of world champions who will take time to answer and help me.


yes, OF just takes the shader, compiles it and uploads it to the graphics card, so no matter what tool you use the shader will be the same


Thx for reactivity
My question was also about advices on shader coding, tutorials websites…
and also good books to learn shading behind fireplace drinking 30years whiskey :slight_smile:

I put also another question/advice request in the post.
If my graphic designs are mainly simple shapes, vectors designs and 2D forms, does it relevant to use shader ?
Shader coding is powerful to have beautiful visual effects (blur, shine and so on), but does it work well with 2D approach, is it better to work directly on pixels arrays ?


shaders are useful tools also when handling 2d/video: they can be used to create “effects” (blurring, filtering, etc) or to create a paticular rendering style.

the bad news is that I never found a beginner tutorial that was really easy for a beginner; the standard readings on the subject are and the orange book

There aren’t a ton of good tutorials on learning shaders, but there are some neat tools out there for playing with in an easy way, espeically some WebGL ones, that should help you understand what a shader is and how it works.

Even though a lot of this is based on webGL/javascript, the parts that actually explain shaders and their syntax are quite good:

This is awesome, but quite complex too:

Some good OF shader projects here:

Hmm, I put up some links to WebGL resources that I guess got flagged as spam and weren’t accepted (too many links perhaps?). The one I was thinking was a pretty nice intro resource was:

Also (apparently I can’t link to them) if you search for “webgl shader toy” you’ll find some live-time, relatively easy to use toys that will help you learn a little more about how fragment and vert shaders work without needing to run an OF program each time. The underlying tech is really different, but GLSL is the same.

@josh, just unflagged your message, it was caught by the spam filter