Skip to content

GLSL - How to code a "local" jitter blur #368

Answered by pragma37
adamwparker asked this question in Q&A
Discussion options

You must be logged in to vote

The main problem is that since the offsets are random for each pixel, the GPU is going to select a very small mip map.
So the checkerboard that ends up using will look something like this:

The solution is to tell the GPU the LoD you want to use::
textureLod(qualifier_texture, uv + offset, 0)
(The LoD 0 is always the full image resolution, LoD 1 is half the resolution and so on)

Additionally, you were also accumulating samples for pixels below the "qualifier" threshold, which I guess is not what you wanted?

I guess this is the result you're looking for?

If that's the case, this is the modified code I used:

vec4 adam_blur(sampler2D input_texture, sampler2D qualifier_texture, vec2 uv, 
    f…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@adamwparker
Comment options

@pragma37
Comment options

Answer selected by adamwparker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants