当我使用自定义着色器作为混合模式并应用 BlurFilter 时,会出现黑色边框。没有过滤器它工作正常。
这是一个着色器代码。
kernel NewFilter
< namespace : "my.test";
vendor : "Im";
version : 1;
description : "Invert Luminance Blend Mode";
>
{
input image4 background;
input image4 foreground;
output pixel4 dst;
void
evaluatePixel()
{
pixel4 bg = sampleNearest(background, outCoord());
pixel4 fg = sampleNearest(foreground, outCoord());
float lum = bg.r * 0.299 + bg.g * 0.587 + bg.b * 0.114;
dst.rgb = fg.rgb + 1.0 - lum;
dst.a = fg.a;
}
}
我如何应用着色器和过滤器
[Embed(source = "InvertLuminance.pbj", mimeType = "application/octet-stream")]
var InvertLuminanceClass:Class;
...
highlighter = new Sprite();
highlighter.mouseEnabled = false;
highlighter.mouseChildren = false;
var shader:Shader = new Shader(new InvertLuminanceClass());
highlighter.blendShader = shader;
highlighter.blendMode = BlendMode.SHADER;
highlighter.filters = [new BlurFilter(1.9, 1.9, BitmapFilterQuality.HIGH)];
addChild(highlighter);
任何着色器作为混合模式都会出现此问题。有人可以帮我修复这个黑色像素吗?
谢谢!