Interactive OF port of Shader Exam


A little while back I ported this project to openFrameworks -

It contains the answers to an exam that Leon Denise made for his students. The shaders are for the most part very short and simple and include some fun post processing effects. I thought it would be nice to share the code on here for people who are new to shaders and OF. I think it is particularly useful as a demonstration of how to use ofFbo correctly since this is something that can be a little confusing if you haven’t done it before.

I have endeavoured to make the code as simple and clear as possible. There are three branches on github. The simple branch is the most stripped down version. The master branch abstracts the rendering code and the post processing code away into two separate classes which makes the use of the FBO very clear. The tessellation branch shows you how to set up simple tessellation shaders and is intended to demonstrate how tessellation can improve results when displacing the vertices of the mesh. This is important with this project for the chubbiness effect where the vertices are displaced along their normal. This branch is still a work in progress, however, since I haven’t yet worked out how to calculate the normals correctly in the tessellation evaluation shader. With the other versions I have used Blender to increase the number of triangles.

Here’s a little video of the application in action -

And here is the code -

Hope someone finds this helpful!