Action Script3 / Pixel Bender 复合模糊效果?

发布于 2024-08-10 19:57:53 字数 372 浏览 13 评论 0原文

我需要具有映射功能的 Action Script3 / Pixel Bender 模糊滤镜。

我们有这样的图像,我们想要应用这样的模糊贴图来获得这样的结果

alt text http://livedocs.adobe.com/en_US/AfterEffects/8.0/images/ef_182.png

它也称为复合模糊效果。

有人见过用 AS3/ Pixel Bender 完成的吗?

有谁知道哪里可以下载这样的效果及其源码吗?

I need Action Script3 / Pixel Bender blur filter with mapping capability’s.

We have such image, we want to apply such blur map to get such result

alt text http://livedocs.adobe.com/en_US/AfterEffects/8.0/images/ef_182.png

Its also known as Compound Blur effect.

Has anyone seen it done with AS3/ Pixel Bender?

Does Anyone know where to download such effect with source?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

多情出卖 2024-08-17 19:57:53

您可以在原图上绘制一个模糊图像(将 Alpha 通道更改为模糊值图)来模拟效果。

由于 Flash 中的像素弯曲器不支持循环,因此很难创建良好的模糊滤镜。

You may just draw a blurred image(with alpha channel changed to the blur value map) on its original to simulate the effect.

Because pixel bender in Flash does not support loops, it is difficult to create a good blur filter.

慕巷 2024-08-17 19:57:53

我这里有一个非常旧的预像素弯曲器版本:http://www.quasimondo .com/archives/000564.php(包括as2源代码)

它的工作原理是创建几个模糊位图,模糊半径从0(或您选择的最小半径)增加到最大半径。模糊步骤越多,质量就越好。使用调色板映射过滤器,您可以为每个模糊层创建蒙版,以便每个连续层之间存在渐变重叠。然后,使用其蒙版将每个模糊层绘制在下一个模糊层之上。

我现在可能宁愿使用像素弯曲器来完成第二个混合阶段。

I have an very old pre-pixel bender version of this effect here: http://www.quasimondo.com/archives/000564.php (as2 source included)

It works by creating several blurred bitmaps with the blur radius increasing from 0 (or the minium radius you choose) to the maximum radius. The more blur steps you do the better the quality will be. Using the paletteMap filter you create masks for each blur layer in such a way that there is a gradient overlap between each consecutive layer. Then you draw each blur layer over the next using its mask.

This second blending phase I would probably now rather do with pixel bender.

帝王念 2024-08-17 19:57:53

下面的 .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;
    }
}

The following .pbk should pretty much do it. You can take a look at the comments to see how you would deepen the blur effect.

<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;
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文