From: Steinar H. Gunderson Date: Tue, 2 Oct 2012 23:25:50 +0000 (+0200) Subject: Fix the blur so it is much prettier, by not sampling from a mipmap in the second... X-Git-Tag: 1.0~411 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=64c2d9b78bc53d93eec8a2b1eb20d6dc1a46561e Fix the blur so it is much prettier, by not sampling from a mipmap in the second pass. --- diff --git a/blur_effect.cpp b/blur_effect.cpp index 00c8fa0..17044f1 100644 --- a/blur_effect.cpp +++ b/blur_effect.cpp @@ -36,6 +36,16 @@ void BlurEffect::set_uniforms(GLuint glsl_program_num, const std::string &prefix pixel_size *= 2.0f; } + // In the second pass, we do the same, but don't sample from a mipmap; + // that would re-blur the other direction in an ugly fashion, and we already + // have the vertical box blur we need from that pass. + // + // TODO: We really need to present horizontal+vertical as a unit; + // currently, there's really no guarantee vertical blur is the second pass. + if (direction == VERTICAL) { + base_mipmap_level = 0; + } + glActiveTexture(GL_TEXTURE0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, base_mipmap_level); check_error();