AntiAlising + Shaders

Hello everyone!
Im using shaders to fill shapes, but i cant avoid this uggly effect when i rotate the camera or shapes:

(is more visible if you zoom in)

how can resolve it? Im trying to adding more samples in the fbo where im drawing:

    settings.internalformat = GL_RGBA;
    settings.numSamples = 8;

but nothing happens. Also try to using functions in the shader, but the problem still exist, in the moment when i make rotations or change the point of view (irregular angles)…

Any clue??

Hi @pxt,

Not entirely sure what’s going on but there are a few things you could check.

First and foremost, have you enabled multisampling by calling ofEnableAntiAliasing()? Then, check if multisampling is supported -> i.e. add ofSetLogLevel("ofFbo", OF_LOG_VERBOSE); to setup and take a look at the console. Also double check your graphics card settings and make sure anti-aliasing can be controlled from your app.


Hi @pxt,
First try what @lshoek suggests. If that does not work I would go through the shader’s code.
Try not to use “hard” cordinional rules for setting the color of each pixel, rather use something like smoothstep
I recommend you to take a look at the Signed Distance Functions (SDF) way of handling this which should will not give this kind of artifacts.