*エフェクト-ガウスフィルタ [#w0f74216] ぼかす。 ---- #contents ** 描画パス [#de049b8d] ガウス分布の計算 ↓ 縦軸フィルタ ↓ 横軸フィルタ ↓ ガウスフィルタ結果 ** ガウス分布の計算 [#c166d0fd] 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; ** ぼかしフィルタ [#md59ed82] 縦軸ぼかし:&ref(gauss-v.fx); 横軸ぼかし:&ref(gauss-h.fx); |