diff --git a/projects/indirect_dispatch/resources/shaders/motionBlur.comp b/projects/indirect_dispatch/resources/shaders/motionBlur.comp index a90e142d71fba7299efc9879219ad1d0ff223709..42f6c43156ddd5bd53f48e1da17ef336d625604a 100644 --- a/projects/indirect_dispatch/resources/shaders/motionBlur.comp +++ b/projects/indirect_dispatch/resources/shaders/motionBlur.comp @@ -43,8 +43,10 @@ void main(){ vec3 color = vec3(0); const int sampleCount = 16; - vec2 uvStart = uv - motion; - vec2 uvEnd = uv + motion; + // clamping start and end points avoids artifacts at image borders + // the sampler clamps the sample uvs anyways, but without clamping here, many samples can be stuck at the border + vec2 uvStart = clamp(uv - motion, 0, 1); + vec2 uvEnd = clamp(uv + motion, 0, 1); for(int i = 0; i < sampleCount; i++){ vec2 sampleUV = mix(uvStart, uvEnd, i / float(sampleCount - 1));