跳过正文

模糊算法

·119 字·1 分钟
杂谈 算法 色彩
AxonSin
作者
AxonSin
梦想是复活在赛博世界,成为一名赛博垃圾人。

二维卷积模糊
#

// GaussianBlur.hlsl
float4 GaussianBlur(sampler2D tex, float2 uv, float2 resolution, float radius)
{
    float4 color = float4(0, 0, 0, 0);
    float totalWeight = 0.0;
    int samples = 5; // Number of samples for blur

    for (int x = -samples; x <= samples; x++)
    {
        for (int y = -samples; y <= samples; y++)
        {
            float2 offset = float2(x, y) * radius / resolution;
            float weight = exp(-dot(offset, offset) / (2.0 * radius * radius));
            color += tex2D(tex, uv + offset) * weight;
            totalWeight += weight;
        }
    }

    return color / totalWeight;
}

Frosted Glass Blur(毛玻璃模糊,随机采样模糊)
#

Reply by Email

相关文章

菲涅尔计算式以及近似公式
·882 字·2 分钟
杂谈 光照 算法 物理 色彩
算法原理解析
色彩空间
·13451 字·27 分钟
杂谈 Shader Houdini 渲染 算法 物理 色彩 技巧 配置
算法原理解析
Unity区域光(Area Light) 没有反应
·1123 字·3 分钟
杂谈 Unity 渲染 材质 光照 色彩
渲染技术解析