Multi-pass shader error -- please help

Hello. This is my first time trying to implement two shaders to an object. All I want to do is apply the blur filter and the brightness filter.

I followed the tutorial here:

http://www.sdknews.com/cross-platform/corona/tutorial-multi-pass-shaders-in-graphics-2-0

Code from main.lua

local effect = require( “kernel_filter_myGlow” )
graphics.defineEffect( effect )

Code from kernel_filter_myGlow.lua

local kernel = {}
kernel.language = “glsl”
kernel.category = “filter”
kernel.name = “myGlow”
kernel.graph =
{
        nodes = {
                blurPass      =       { effect=“filter.blur”, input1=“paint1” },
                brightnessPass        =       { effect=“filter.brightness”, input1=“blurPass” },
        },
        output = “brightnessPass”,
}
return kernel

Code from level.lua (where the image is displayed)

coinGlow[i] = display.newSprite( foregroundGroup, coinSheet, coinSequenceData )
        coinGlow[i]:play()
        coinGlow[i].fill.effect = “filter.myGlow”

The object is a sprite, but I’ve tested the effect on a png with no animation.

I get this error: “ERROR: Could not find or load shader (filter.myGlow).”

I don’t think the error is in the main.lua code. Please help.

BTW, I don’t know enough to understand Corona’s Custom Shader Effects guide here:

https://docs.coronalabs.com/guide/graphics/customEffects.html

That looks like a nifty effect if you can get it to work. Unfortunately, that article is from 2013 and all of the links to other examples are dead.  I did notice that you need to add “custom” to your fill.effect.  Maybe that will help.

[lua]

coinGlow[i].fill.effect = “filter.myGlow”

– should be

coinGlow[i].fill.effect = “filter.custom.myGlow”

[/lua]

I was able to get it working using

[lua] “filter.custom.myGlow” [/lua]

instead of

[lua] “filter.myGlow” [/lua]

I wasn’t able to get it to work with composite filters yet but I’ll keep trying

FYI - composites work as well - again using the custom tag

[lua] “composite.custom.myGlow” [/lua]

I’m having limited success in mixing filter and composite multi-shaders.  This probably has something to do with the kernel.category being set to either composite or filter.

Thanks for the replies.

After posting this, I did some tweeking, and one of them was to add “filters.custom.myGlow”. I got it to work. The blur pass is for making it a little bigger than the original image, and the brightness pass is for making the glow white. It might look better if the blur pass came second?

If anyone else wants to use this, go for it. Whatever image you want to add a glow to, just create two image objects, with the glow image object behind the real image. Then apply the custom.myGlow filter to the glow image object and a nice glow or halo shows.

@scott 

Have you noticed any memory leaks when you change the default filter settings like

[lua]

object.fill.effect.crystallize.numTiles = 8  – crystalize being one of the custom nodes

[/lua]

I added this to my current custom shader that runs every frame and noticed memory leaks when I change the defaults.  Changing the fill effects of the various nodes every frame for hundreds of objects revealed some significant leaks to me that I didn’t notice on a smaller scale.

I’m investigating my shader codebase to see if there is something not playing nicely - but I’m also wondering if you have had a similar result when you adjust the multi-shader fill.effects?

Never mind, I found the leaks and they were of my own design - I left some garbage around while I was trying to find a hack to get composites and filters to work together. 

I’m still trying to find a way to get filters and composites to reliably work together - some filters like “crystalize” and “scatter” work with the composites but most don’t.

Do any of you OpenGL gurus have suspicions as to why?