行动Script3 / Pixel Bender的复合模糊效果?
-
20-09-2019 - |
题
我需要映射能力的行动Script3 / Pixel Bender的模糊滤波器。
我们有这样的形象,我们要应用这种模糊的地图得到这样的结果。
替代文字http://livedocs.adobe.com/en_US /AfterEffects/8.0/images/ef_182.png
其也被称为化合物模糊效果。
有没有人看到它与AS3 / Pixel Bender的办?
有谁知道从哪里下载与源这样的效果呢?
解决方案
下面的.pbk应该几乎做到这一点。您可以在评论看一看,看看你将如何深化模糊效果。
<languageVersion : 1.0;>
kernel NewFilter
< namespace : "Your Namespace";
vendor : "Your Vendor";
version : 1;
description : "your description";
>
{
input image4 src1;
input image4 src2;
output pixel4 dst;
void
evaluatePixel()
{
float2 pos = outCoord();
// based on the current whiteness of pixel in src2 blur by a percentage.
float4 val = sampleNearest(src2,pos);
float percent = val[0];
// this takes into account only the closest level of pixels to make the blur more in depth
// you can add the next 16 or even the 24 after that.
float4 pix = sampleNearest(src1,pos);
float4 pixNE = sampleNearest(src1,float2(pos.x+1.0, pos.y+1.0));
float4 pixE = sampleNearest(src1,float2(pos.x+1.0, pos.y));
float4 pixSE = sampleNearest(src1,float2(pos.x+1.0, pos.y-1.0));
float4 pixS = sampleNearest(src1,float2(pos.x, pos.y-1.0));
float4 pixSW = sampleNearest(src1,float2(pos.x-1.0, pos.y-1.0));
float4 pixW = sampleNearest(src1,float2(pos.x-1.0, pos.y));
float4 pixNW = sampleNearest(src1,float2(pos.x-1.0, pos.y+1.0));
float4 pixN = sampleNearest(src1,float2(pos.x, pos.y+1.0));
float4 result;
// the result is the whiteness percentage of the original pixel averaged with the surrounding pixels.
// if you added more of the surrounding pixels you can consider them in the weighted average also and get a deeper blur.
result[0] = percent*pix[0]+(1.0-percent)*(pixNE[0]+pixE[0]+pixSE[0]+pixS[0]+pixSW[0]+pixW[0]+pixNW[0]+pixN[0])/8.0;
result[1] = percent*pix[1]+(1.0-percent)*(pixNE[1]+pixE[1]+pixSE[1]+pixS[1]+pixSW[1]+pixW[1]+pixNW[1]+pixN[1])/8.0;
result[2] = percent*pix[2]+(1.0-percent)*(pixNE[2]+pixE[2]+pixSE[2]+pixS[2]+pixSW[2]+pixW[2]+pixNW[2]+pixN[2])/8.0;
result[3] = pix[3];
dst = result;
}
}
其他提示
您可能只是绘制一个模糊图像(具有alpha通道改变为模糊值地图)上的原始模拟的效果。
由于在Flash像素弯管机不支持环路,则难以形成良好的模糊过滤器。
我有这样的效果的非常古老的像素预折弯机版本在这里:的http:// (包括AS2源)www.quasimondo.com/archives/000564.php
它的工作原理与模糊半径从0增加(或您选择的铅丹半径)的最大半径创建几个模糊的位图。越是模糊步骤你做的更好质量会。使用在这样的方式创建的每个模糊层掩模paletteMap滤波器有每个连续层之间的梯度重叠。然后,你使用其掩模绘制在接下来的每个模糊层。
此第二混合阶段我可能现在而做象素弯曲。
不隶属于 StackOverflow