Git Product home page Git Product logo

ofxpostprocessing's Introduction

ofxPostProcessing

This openFrameworks addon gives you an easy way of putting together a chain of GLSL post-processing effects.

www.neilmendoza.com/ofxpostprocessing

NB This addon uses the branch setup as OF itself, the stable branch corresponds to the most recent release (i.e. the version that is downloadable from the OF site) and the master branch is the develop branch. If you have downloaded from the website, the you will want to use the stable branch...

https://github.com/neilmendoza/ofxPostProcessing/tree/stable

Features

At the moment, it comes with the following effects (some ported from other sources and some original) that I'll gradually add to over time:

  • Bloom
  • Convolution (Blur)
  • Depth of field (with bokeh)
  • Depth of field alternative (more features but heavier)
  • Frei-Chen Edge Detector
  • FXAA anti-aliasing
  • Kaleidoscope
  • Noise warp
  • Pixelate
  • SSAO
  • Toon
  • Godrays
  • Tilt shift
  • Fake subsurface scattering
  • Many others, please see src directory

Usage

In your OF app declare an instance of ofxPostProcessing...

ofxPostProcessing post;

In your setup() function initialise the post-processing class and then add some effects...

post.init(ofGetWidth(), ofGetHeight());
post.createPass<FxaaPass>();
post.createPass<BloomPass>();

Call post.begin() and post.end() around the the scene that you want to render...

post.begin();
<RENDERING CODE>
post.end();

If you are using an ofCamera pass this to post.begin() and it takes care of the rest for you...

post.begin(cam);
<RENDERING CODE>
post.end();

TODO

  • Add support for ofGLProgrammableRenderer with version 150 shaders
  • More FX
  • OpenGL ES, it's based around power of two textures so it should be fairly quick to get working.

ofxpostprocessing's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofxpostprocessing's Issues

Bloom shader seems to have no effect

I assume this isn't updated anymore but I've been messing with this and I can't seem to get the bloom shader to work, but all the other shaders work.

Nothing happens at all when it's enabled as far as I can tell.

I am using 0.9.0.

Provide getters for width and height

Could you provide getters for the postprocessing width and height ?

In a project I'm working on, my team found out that if the window is resized, the scene rendering (and thus postprocessing) stays within the original size of the window, the scene doesn't fill all the new space. ofxPostProcessing seems to be the culprit.

We found an easy fix : having a variable ofxPostProcessing post in the app, we found that setting post.width = windowWidth; and post.height = windowHeight; in the OF windowResized function does the trick.

However, these attributes are private and we had to tweak PostProcessing.h in the addon to make them public (that's ugly). I was a little astounded there was no getters for that.

Thank you for the awesome work 👍

EDIT : sorry that's an non-issue, I just checked the most up-to-date version and they are here. I guess we used an old version...

SSAOPass produces black screen

Why could it be that with the SSAO filter I get just a black screen? I tried playing with the uniforms but still nothing.

Other filters like DOF and Bloom work fine.

broken in 10.1

Hello Neil, thanks for your addon. Some fixes to get it working with 10.1:
this
raw.begin(ofFboBeginMode::NoDefaults);
In PostProcessing.cpp no longer works. It needs to be:
raw.begin(OF_FBOMODE_NODEFAULTS);

And in RenderPass.h these two lines are needed.

#include "ofMain.h"
using namespace std;

After these small changes it works. Tell me if it is better to open a PR.
bye ;)

ofParameters

Make all fx parameters ofParameters and have and public ofParameterGroup that can be queried for each one.

Upside-down video with ofVideoGrabber

I'm attempting to use an unmodified fork for your ofxPostProcessing addon with video and for some reason when I add the post-processing transformation the video is vertically mirrored. Here's the code I'm using in my testApp.cpp.

#include "testApp.h"

//--------------------------------------------------------------
void testApp::setup(){

    camWidth        = ofGetWidth(); // try to grab at this size.
    camHeight       = ofGetHeight();

    // set up video grabber
    vidGrabber.setDeviceID(0);
    vidGrabber.setDesiredFrameRate(24);
    vidGrabber.initGrabber(camWidth,camHeight);

    // set up shader post-processing
    post.init(camWidth, camHeight);
    post.createPass<RimHighlightingPass>()->setEnabled(true);
}

//--------------------------------------------------------------
void testApp::update(){

    ofBackground(100,100,100);
    vidGrabber.update();
}

//--------------------------------------------------------------
void testApp::draw(){

    // copy enable part of gl state
    glPushAttrib(GL_ENABLE_BIT);

    // setup gl state
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);


    // begin scene to post process
    post.begin();

    vidGrabber.draw(0,0);

    // end scene and draw
    post.end();

    // set gl state back to original
    glPopAttrib();
}

Won't compile in 0.9.8

This commit uses ofFboBeginMode, an enum which isn't introduced in the latest OF public versioned release. That means end users have to be working off the development branch, and many newcomers to OF will download your addon only to find it doesn't compile.

I just thought I should point that out, I'm not sure what you could do about it. Maybe put the dev version stuff in a dev branch, or add a note to the readme that this addon is for advanced users only..?

EdgePass.cpp ostringstream oss error ( 10.1 , osx )

I got this error when compiling on xcode, of10.1
Implicit instantiation of undefined template 'std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >'

This seems to be present others file.

NoiseWarp parameters

Hi there,
I'd love to use the noiseWarpPass and be able to tweak the parameters. Everything seems to be there in the class but I can't seem to figure out how to access e.g. setFrequency and getFrequency. I tried to call them statically and I tried new'ing an object but no luck. If you could write an example including how to use createPass the parameters of noiseWarpPass I would be very grateful...

Console shows error or warning

The effects seem to work, though some of them are subtle (like BleachBypassPass) so I'm not sure if they're being affected by the warning messages I'm getting:

[warning] ofShader: GL_FRAGMENT_SHADER, offending line 1 : 1 uniform float opacity; uniform sampler2D tDiffuse; void main() { vec2 vUv = gl_TexCoord[0].st; vec4 base = texture2D( tDiffuse, vUv ); vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 ); float lum = dot( lumCoeff, base.rgb ); vec3 blend = vec3( lum ); float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) ); vec3 result1 = 2.0 * base.rgb * blend; vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb ); vec3 newColor = mix( result1, result2, L ); float A2 = opacity * base.a; vec3 mixRGB = A2 * newColor.rgb; mixRGB += ( ( 1.0 - A2 ) * base.rgb ); gl_FragColor = vec4( mixRGB, base.a ); }

Using Visual Studio 2019 on Windows 10. Tried replacing ofSetupOpenGL(1024,768,OF_WINDOW); with

ofGLWindowSettings settings;
	settings.setGLVersion(3, 2);
	ofCreateWindow(settings);

because I was told to do this in other tutorial videos when using shaders, but this turns the warning into an error and nothing is displayed.

DofAltPass cannot get Ptr

fixed by changing the header for DofAltPass

namespace itg
{
    /*
     * @see http://blenderartists.org/forum/showthread.php?237488-GLSL-depth-of-field-with-bokeh-v2-4-(update)
     */
    using namespace tr1;
    class DofAltPass : public RenderPass
    {
    public:
        typedef shared_ptr<DofAltPass> Ptr;
       ...

license

hey, thanks for this addon. I'm wondering what kind of license you're publishing this in...? I've been using it tons of times and would like to once know for sure what your opinion about this is..

thanks already :)

yours,
marcel

trying to load a .cube LUT on runtime

hi, I loaded a .cube LUT and it works.
But I must hardcode the path into the addon class like this:

    LUTPass::LUTPass(const ofVec2f& aspect, bool arb) : RenderPass(aspect, arb, "lut"), lut_tex(0)
    {
		loadLUT("6.cube");
    } 

It's possible to load LUTs on the fly? Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.