Project

General

Profile

« Previous | Next » 

Revision b36613d8

Added by Leszek Koltunski about 6 years ago

small correction for blending OIT colors.

View differences:

src/main/java/org/distorted/library/main/DistortedEffects.java
414 414

  
415 415
///////////////////////////////////////////////////////////////////////////////////////////////////
416 416

  
417
  static void blitDepthPriv(DistortedOutputSurface surface, float corrW, float corrH)
417
  static void blitDepth(DistortedOutputSurface surface, float corrW, float corrH)
418 418
    {
419 419
    mBlitDepthProgram.useProgram();
420 420

  
......
433 433
// render all the transparent pixels from the per-pixel linked lists. This is in the 'merge
434 434
// postprocessing buckets' stage.
435 435

  
436
  static void blitDepthRenderPriv(DistortedOutputSurface surface, float corrW, float corrH)
436
  static void mergeOIT(DistortedOutputSurface surface, float corrW, float corrH)
437 437
    {
438 438
    mBlitDepthRenderProgram.useProgram();
439 439

  
src/main/java/org/distorted/library/main/DistortedOutputSurface.java
281 281
    GLES31.glDisable(GLES31.GL_STENCIL_TEST);
282 282
    GLES31.glStencilMask(0x00);
283 283

  
284
    DistortedEffects.blitDepthPriv(this, buffer.getWidthCorrection(), buffer.getHeightCorrection() );
284
    DistortedEffects.blitDepth(this, buffer.getWidthCorrection(), buffer.getHeightCorrection() );
285 285
    GLES31.glActiveTexture(GLES31.GL_TEXTURE0);
286 286
    GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0);
287 287
    GLES31.glActiveTexture(GLES31.GL_TEXTURE1);
......
292 292

  
293 293
///////////////////////////////////////////////////////////////////////////////////////////////////
294 294

  
295
  private int blitWithDepthRender(long currTime, DistortedOutputSurface buffer)
295
  private int mergeOIT(long currTime, DistortedOutputSurface buffer)
296 296
    {
297 297
    GLES31.glViewport(0, 0, mWidth, mHeight);
298 298
    setAsOutput(currTime);
......
301 301

  
302 302
    DistortedRenderState.enableStencil();
303 303

  
304
    DistortedEffects.blitDepthRenderPriv(this, buffer.getWidthCorrection(), buffer.getHeightCorrection() );
304
    DistortedEffects.mergeOIT(this, buffer.getWidthCorrection(), buffer.getHeightCorrection() );
305 305
    GLES31.glActiveTexture(GLES31.GL_TEXTURE1);
306 306
    GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0);
307 307

  
......
390 390
          numRenders += currQueue.postprocess(mBuffer);
391 391
          numRenders += blitWithDepth(time, mBuffer[quality]);
392 392
          GLES31.glMemoryBarrier(GLES31.GL_ALL_BARRIER_BITS);
393
          numRenders += blitWithDepthRender(time,mBuffer[quality]);  // merge the OIT linked list
393
          numRenders += mergeOIT(time,mBuffer[quality]);  // merge the OIT linked list
394 394
          clearBuffer(mBuffer[quality]);
395 395
          }
396 396
        }
src/main/res/raw/blit_depth_render_fragment_shader.glsl
60 60
  uint curr = u_Records[index];
61 61

  
62 62
  if (curr == 0u) discard;
63
  else
64
    {
65
    u_Records[index] = 0u;
63 66

  
64
  vec4 color= vec4(0.0,0.0,0.0,0.0);
65
  u_Records[index] = 0u;
67
    vec4 color= vec4(0.0,0.0,1.0,1.0);//convert(u_Records[curr+2u]);
68
    curr = u_Records[curr];
66 69

  
67
  while (curr > 0u)
68
    {
69
    color= blend( color, convert(u_Records[curr+2u]) );  // keep walking the linked list
70
    curr = u_Records[curr];                              // and blending the colors in
71
    }
70
    while (curr > 0u)
71
      {
72
      color= vec4(0.0,0.0,0.0,1.0);//blend( color, convert(u_Records[curr+2u]) );  // keep walking the linked list
73
      curr = u_Records[curr];                              // and blending the colors in
74
      }
72 75

  
73
  gl_FragDepth = texture(u_DepthTexture, v_TexCoordinate).r;
74
  fragColor    = color;
76
    gl_FragDepth = texture(u_DepthTexture, v_TexCoordinate).r;
77
    fragColor    = color;
78
    }
75 79
  }

Also available in: Unified diff