模糊专题

  • 高斯模糊优化
    Android图像处理系列 - 高斯模糊的几种优化方法
    高品质后处理:十种图像模糊算法的总结与实现(Kawas Blur实现比较简单)
    An investigation of fast real-time GPU-based image blur algorithms
    Efficient Gaussian blur with linear sampling
    动态线性插值例子
    动态线性插值生成shader的代码示例:
 // uStep必须是1像素对应的值,不然线性插值误差较大
    int firstOffset = -radius;
    float weightAll = 0.0f;
    for (int i = 0; i < radius; ++i) {
             float weightFirst = prob[i * 2];
             float weightSecond = prob[i * 2 + 1];
             float weightTotal = weightFirst + weightSecond;
        weightAll += weightTotal;
        int offset1 = firstOffset + (int)i * 2;
        int offset2 = offset1 + 1;
        float sampleOffset = ((float)offset1 * weightFirst + (float)offset2 * weightSecond) / weightTotal;
        char char_loop[100];
        sprintf(char_loop, "sumColor += texture2D(uTexture, vTexCoord + %.6f*uStep) * %.6f;\n",sampleOffset, weightTotal);
        str_frag += std::string(char_loop);
   LOGE("offset1 %d offset2 %d sampleOffset %f weightTotal %f", offset1, offset2, sampleOffset, weightTotal);
    }
//最后一个点
    char char_loopLast[100];
    sprintf(char_loopLast, "sumColor += texture2D(uTexture, vTexCoord + %.6f*uStep) * %.6f;\n",radius * 1.0, prob[size - 1]);
    str_frag += std::string(char_loopLast);
    weightAll += prob[size - 1];
    LOGE("weightTotal %f weightAll %f", prob[size - 1], weightAll);

Unity的Bloom效果里通过DownScale和UpScale实现平滑模糊:
https://catlikecoding.com/unity/tutorials/advanced-rendering/bloom/
Unity 自定义Bloom(辉光)

  • 散景模糊
    五、散景模糊(Bokeh Blur)
    Bokeh disc ShaderToy)
    谈谈游戏中常见的后处理技术
    Olive-Editor-Community-Effects/bokehBlur
    在线调试黄金螺旋/叶序螺旋

你可能感兴趣的:(模糊专题)