エフェクト-ガウスフィルタ

ぼかす。


描画パス

ガウス分布の計算
 ↓
縦軸フィルタ
 ↓
横軸フィルタ
 ↓
ガウスフィルタ結果

ガウス分布の計算

const int Dispersion = 5.0; // ガウス散乱率
const int Sampling = 8; // 後述のサンプリング数

const float dispersion = Dispersion * Dispersion;
const int sample = Sampling / 2;

assert((sample > 0) && (sample <= 8));

// 重さ結果格納
float weight_list[sample] = {0};

// 重み計算
float total = 0.0f;
for (int i = 0 ; i < sample ; ++i) {
  float weight = expf(-0.5f * (i*i)/dispersion);
  total += 2.0f * weight;
  weight_list[i] = weight;
}
for (int i = 0 ; i < sample ; ++i) weight_list[i] /= total;

ぼかしフィルタ

縦軸ぼかし:filegauss-v.fx
横軸ぼかし:filegauss-h.fx


    ホーム 一覧 単語検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS