[FIXED] "filter.invert" with alpha

Hi there,

When using the “filter.invert” in a png file, its alpha channel is setted to 1. I’m trying to create a multi-pass shader combining “filter.invert” and “filter.chromaKey” [in order to erase the filled “alpha” channel] like this:

local kernel = {} kernel.name = "invertWithAlpha" kernel.language = "glsl" kernel.category = "filter" kernel.graph = {     nodes = {         horizontal = { effect = "filter.invert", input1 = "paint1" },         vertical = { effect = "filter.chromaKey", input1 = "horizontal" },    },    output = "horizontal", } graphics.defineEffect(kernel)

But when using it…

object.fill.effect = "filter.invertWithAlpha" object.fill.effect.vertical.color = { 1, 1, 1, 1 }

… displays an error: Attempt to index field ‘vertical’ (a nil value)

What am I missing?

Hi @roger23,

Try changing your “output” string value to the last key in the “nodes” table, in this case “vertical”. See if that does the trick. If not, I’ll try to debug it a bit more.

Best regards,

Brent

Hi Brent,

Yep, now it doesn’t crash, but still doesn’t work properly, because the entire image disappears, even if commenting this line or changing its parameters:

object.fill.effect.vertical.color = { 1, 1, 1, 1 }

Hi @roger23,

Did you try adjusting the other parameters of ChromaKey as well?

http://docs.coronalabs.com/guide/graphics/effects.html#filter.chromakey

Brent

Yep I did, but with or without modifying its parameters still disappears

Hi @roger23,

Since you have a clear intent on what this multi-pass filter should do, I assume it’s working in other graphical applications/environments? Can you post a screenshot of the image, and the expected result? Then I may show the engineers and figure out if this is a code issue, or something internally with the filter(s).

Thanks,

Brent

Hi Brent,

Sorry we couldn’t answer sooner. The first image is how it actually is, the second one is how it looks like when applying this custom filter, and the last one is how we expect to be

Thank you

Hi @roger23,

Try changing your “output” string value to the last key in the “nodes” table, in this case “vertical”. See if that does the trick. If not, I’ll try to debug it a bit more.

Best regards,

Brent

Hi Brent,

Yep, now it doesn’t crash, but still doesn’t work properly, because the entire image disappears, even if commenting this line or changing its parameters:

object.fill.effect.vertical.color = { 1, 1, 1, 1 }

Hi @roger23,

Did you try adjusting the other parameters of ChromaKey as well?

http://docs.coronalabs.com/guide/graphics/effects.html#filter.chromakey

Brent

Yep I did, but with or without modifying its parameters still disappears

Hi @roger23,

Since you have a clear intent on what this multi-pass filter should do, I assume it’s working in other graphical applications/environments? Can you post a screenshot of the image, and the expected result? Then I may show the engineers and figure out if this is a code issue, or something internally with the filter(s).

Thanks,

Brent

Hi Brent,

Sorry we couldn’t answer sooner. The first image is how it actually is, the second one is how it looks like when applying this custom filter, and the last one is how we expect to be

Thank you

Is there any new about this topic?

I fixed filter.invert to work properly with transparency. Please try tomorrow’s daily build and let us know if you have any further issues. Thanks!

Thank you, works like a charm!

Is there any new about this topic?

I fixed filter.invert to work properly with transparency. Please try tomorrow’s daily build and let us know if you have any further issues. Thanks!

Thank you, works like a charm!