I’ve sometimes had to mess with the image link (I think Dropbox required something like “&web=1” at the end, for instance).
Anyhow, I’ll lay out what I had in mind. Maybe you can come up with something from there.
First off, all but one of the built-in composite effects use fewer than four parameters, and even that one wouldn’t be hard to adjust:
Composite Effects
So an equivalent effect should be able to add a couple more without a problem.
Then, you’d have (most of) your custom effect:
local kernel = { category = "filter", name = "my\_custom\_effect" } kernel.vertexData = { { name = "alpha", -- as per most of the composite effects default = 1, min = 0, max = 1, index = 0 }, { name = "u", -- a texture coordinate... default = 0, min = 0, max = 1, index = 1 }, { name = "v", -- ...the other one default = 0, min = 0, max = 1, index = 2 } -- still another slot left for whatever } kernel.fragment = [[P\_COLOR vec4 FragmentKernel (P\_UV vec2 uv) { P\_COLOR vec4 a = texture2D(CoronaSampler0, uv); // using the normal texcoords P\_COLOR vec4 b = texture2D(CoronaSampler1, CoronaVertexUserData.yz); // our pair // Fill in the rest! (e.g. code from the Wikipedia link earlier) }]] graphics.defineEffect(kernel)
To get the second set of coordinates you’d do something like the following, for each object:
object.fill.effect = "filter.custom.my\_custom\_effect" local frame\_data = OverFrames[object.frame] object.fill.effect.u = frame\_data.x / frame\_data.width -- in [0, 1] object.fill.effect.v = frame\_data.y / frame\_data.height -- ^^ Adjust to whichever data format you're using for frame data, of course
It would be handy if some of the code for the built-in effects were released, but as the earlier link showed, many of them can be found in some form elsewhere.
EDIT : Argh, I realized those texture coordinates are constant.
Hmm, this is tricky, since it looks like we need a couple more parameters still… (There are ways to cram these number together, but they cost some precision, which you probably can’t afford if you want accurate texturing.)
I’ll see if I can refine this idea. I need to work out the ins and outs of this problem anyhow.