Unity shaders (or post processing stack shaders) on oF?

#1

Has anyone tried using Unity shaders in oF? How would I go about modifying a Unity shader to use as a standard fragment shader to add effects to an FBO? Any clue?

(I’m not too familiar with shader code, I understand the basics, but the Unity shaders seem to have a lot more going on.) For example: https://github.com/staffantan/unity-vhsglitch/blob/master/Shaders/VHSPostProcessEffect.shader

#2

Were you able to figure it out?

#3

Unity shaders are written in cg/HLSL, while shaders in openframeworks are written in GLSL.

So you can’t just plug them in.
Afaik there should be some converters available, but I never used them. Probably it’s better to convert them by hand.

If you want to learn more about unity shaders, this might be interesting:

Otherwise google for differences between cg/HLSL and GLSL, then try to convert a simple shader by hand.

Good luck!

#4

Not exactly, no, but I ended up writing shaders either by hand or through modifying existing GLSL shaders. This might be a good starting point: https://github.com/neilmendoza/ofxPostProcessing