Comment 39 for bug 1222602

Revision history for this message
In , Timo Aaltonen (tjaalton) wrote :

got a word from a unity dev about what's happening with opengl 2.x

"Yes, the non-working codepath invokes a much more heavyweight Gaussian blur convolution function. The working codepath also downscales the image before blurring.

An example of the shader code for the broken pass is as follows.

    "varying vec4 v_tex_coord;
     uniform sampler2D tex_object;
     uniform vec2 tex_size;
     #define NUM_SAMPLES %d
     uniform float weights[NUM_SAMPLES];
     uniform float offsets[NUM_SAMPLES];
     void main()
     {
      vec3 acc = texture2D(tex_object, v_tex_coord.st).rgb*weights[0];
      for (int i = 1; i < NUM_SAMPLES; i++)
      {
        acc += texture2D(tex_object, (v_tex_coord.st+(vec2(0.0, offsets[i])/tex_size))).rgb*weights[i];
        acc += texture2D(tex_object, (v_tex_coord.st-(vec2(0.0, offsets[i])/tex_size))).rgb*weights[i];
      }
      gl_FragColor = vec4(acc, 1.0);
     }";

The NUM_SAMPLES in this case is 10."