Filter display overall?

I know you can apply a filter to a graphic “object”, but is there a way to apply a filter to the display screen “overall”, as in everything under it gets filtered? Wouldn’t this be less processor-intensive than applying multiple filters to lots of things underneath?

Advice/experience welcome. Specific code appreciated.

zane

Just throwing an idea out here without having too much knowledge about this topic: Maybe you could take a capture of the entire screen on every frame, position the capture on top of existing content and apply the filter effect to the capture? See: https://docs.coronalabs.com/api/library/display/captureScreen.html

Hi.

If there is any speed advantage, it probably won’t be spectacular if you’re both rendering the first time and then reusing the result. Fill rate plays a role here. The idea mentioned by @Markus_Ranner, which is basically the proper portable fallback, also does a `glReadPixels; I don’t expect much if any hardware doesn’t block the GPU bus here.

There are these PBO objects but I don’t know how well-supported they are. Some comments definitely suggest Android problems, but then it’s also a years-old post.

This fetch behavior is available on a lot of mobile hardware, but again, I doubt all. I’m not aware of desktop support.I do know something like it recurs in Vulkan (I’ve been doing a port). Either way, these only allow you to access the current pixel; perfect for deferred renderers but rules out a lot else.

I do have something in mind that’s along the lines of what you request, but it will be a while before I get to it, God willing. I imagine a Metal implementation would be similar; Android, web, etc. are hard cases, I expect.

All that said, here’s some stuff that I did quite a while ago and am using now: examples.zip (304.8 KB)

This involves a canvas plastered onto a full-screen rect to access a one-frame-late render of its contents. (I put it below the HUD and such.) The first example is probably harder to see, since it’s just distortion from the fire, but has moving objects; the second one is much more visible but, as is, could have been done without a canvas.

1 Like