Project

General

Profile

« Previous | Next » 

Revision fd2db957

Added by Leszek Koltunski over 7 years ago

1) bugfix computing Gaussian BLUR kernel (for odd radii, the last offset was incorrectly computed)
2) introduce more advanced method of detecting BLUR halo (compute depths in a new way)

View differences:

src/main/java/org/distorted/library/EffectQueuePostprocess.java
245 245
      if( radius%2 == 1 )
246 246
        {
247 247
        int index = offset + radius/2 +1;
248
        offsetsCache[index]=mOffsets[radius];
248
        offsetsCache[index]=radius;
249 249
        weightsCache[index]=mWeights[radius];
250 250
        }
251 251
      }
src/main/res/raw/blur2_fragment_shader.glsl
40 40

  
41 41
void main()
42 42
  {
43
  gl_FragDepth = TEXTURE(u_DepthTexture,v_TexCoordinate).r;
43
  float depth = TEXTURE(u_DepthTexture,v_TexCoordinate).r;
44

  
45
  if( u_Radius>1 )
46
    {
47
    float offset = u_Offsets[u_Radius];
48

  
49
    depth = min(depth, TEXTURE(u_DepthTexture,vec2(v_TexCoordinate.x,v_TexCoordinate.y+offset)).r);
50
    depth = min(depth, TEXTURE(u_DepthTexture,vec2(v_TexCoordinate.x,v_TexCoordinate.y-offset)).r);
51
    depth = min(depth, TEXTURE(u_DepthTexture,vec2(v_TexCoordinate.x+offset,v_TexCoordinate.y)).r);
52
    depth = min(depth, TEXTURE(u_DepthTexture,vec2(v_TexCoordinate.x-offset,v_TexCoordinate.y)).r);
53
    }
54

  
55
  gl_FragDepth = depth;
44 56

  
45 57
  vec4 pixel= TEXTURE(u_ColorTexture,v_TexCoordinate) * u_Weights[0];
46 58

  

Also available in: Unified diff