Strange "ghosting" on background

Hi everybody!
I’m making my first steps into the openframeworks world, but I still got my roots deeply planted in processing and p5js… :grin:
While converting some p5 sketches from Nature of Code, I found a strange behaviour on OF: my background seems to be not perfectly “cleaned”. I don’t know if from the pic it can be seen clearly, but it seems almost as my background was a little bit transparent, since I can see some elements behind the OF app (in the screenshot you can see a bit of the openframeworks website)!

It is very subtle, but maybe you can notice if you open the image at fullscreen.

I’m just using ofBackground(51), is it just me or there’s something strange?
Also, I see some “ghosting” on my boids like they’re half transparent for a frame, but when I take a screenshot this disappears… I made a video (https://www.youtube.com/watch?v=-q1q6f0MqTA ) about this… anybody knows anything?

I’m on macOS 10.11.5.
Thanks

Hi there!

This behaviour is expected because, for compatibility reasons, the default OF render buffer is non floating point.

If you want to check this, and learn on how to improve it, please check the gl/fboTrailsExample example that comes with OF.

Any questions, and you know where to find us! :smiley:

1 Like

Thanks!
So I should learn how to create a floating point FBO, like showed in the example?
(it’s a feature, not a bug? :grin: )

I don’t think you are clearing with alpha so there shouldn’t be any ghosting…

are you talking about when the triangles flicker when the boids are close or something else? I don’t see any ghosting in the video…

I looked at your screenshot and even tried adjusting the levels in photoshop but it just looks solid to me.

1 Like

You’re right, zach!
Crazy enough, I just found that is a bug on this machine, like it’s not clearing correctly the buffer!
Maybe it’s fault of the video card… :astonished:
(I looked at the screenshot on my macbook pro and it seemed ok)

But for the triangles you got it right again, I was talking about the flickering effect… what could be the cause?

You should, because they are quite useful. In Processing they also available: it’s called PGraphics. It’s less used/talked because it’s a bit more advanced topic.

It’s not a bug, it’s just a setting. If you have left info (depth) per pixel, then it gets a bit harder to do some “cleaning” on the GPU.

The same happens in P5, or at least it used to. Everything you do in OF (and P5) goes to an FBO. It’s simply hidden from you. :slight_smile:

1 Like

I think when the triangles are moving slowly, the vel (difference between the prev position and current position) is very small, but you are using that to control angle so very small changes are having a big impact visually because you are flickering as the objects shift around You might want to smooth out the angle somehow when the velocity is tiny…

1 Like

Thank you so much!
I was able to fix the flickering thanks to a global var that limits the vel vector.
(the only strange thing is that I ported exactly a sketch from p5js, but in OF I had to lower this maxSpeed limiting constant… maybe js was doing different algebra behind the scenes? Or maybe it did run slower and I couldn’t notice it…)
By the way, still thanks a lot! :smile:
:slight_smile: