Skip to content
Permalink
Browse files

Allow specifying sample count in radial blur

  • Loading branch information...
Shinmera committed Oct 6, 2019
1 parent 1a18805 commit 07068c3fc11bf0f486c0bcf8a2ef735ba0f13122
Showing with 4 additions and 3 deletions.
  1. +4 −3 data/radial-blur.frag
@@ -2,6 +2,7 @@ uniform sampler2D previous_pass;
uniform float strength = 0.2;
uniform float exposure = 0.8;
uniform vec2 origin = vec2(0.5, 0.5);
uniform int samples = 12;

in vec2 tex_coord;
out vec4 color;
@@ -11,10 +12,10 @@ void main(void){
vec4 color_sum = vec4(0.0, 0.0, 0.0, 0.0);
vec2 _tex_coord = tex_coord + size * 0.5 - origin;

for (int i = 0; i < 12; i++) {
float scale = 1.0 - strength * (float(i) / 11.0);
for (int i = 0; i < samples; i++) {
float scale = 1.0 - strength * (float(i) / samples);
color_sum += texture(previous_pass, _tex_coord * scale + origin);
}

color = color_sum / 12.0 * exposure;
color = color_sum / samples * exposure;
}

0 comments on commit 07068c3

Please sign in to comment.
You can’t perform that action at this time.