Loading...
Logo
Processing Forum
Hi there

I'm working on a depth of field simulation with multiple images (png). The images are moving in all axis in a P3D sketch. Every image has a transparent border of 100px.

The problem:
Now for some reason the transparent part of the image doesn't always render correctly. Sometimes it's just filled with the sketch background color, non-transparent pixels. Any idea on how to solve that problem?

I'm working Processing 2.0b6 and OSX with a AMD Radeon HD 6970M 2048 MB

Replies(5)

I really need to make this work. Maybe it's a general rendering bug, should I move back to processing 1.5?
Any help would be highly appreciated...
short update:
when I disable the depth test with 
Copy code
  1. hint(DISABLE_DEPTH_TEST);
  2.       //draw images
  3. hint(ENABLE_DEPTH_TEST);
the problem with the transparent borders disappears, but than the images are not displayed in the correct z-order anymore.

I doubt whether going back to 1.5.1 would work - but it is simple enough to try yourself.

The fact that it works when you disable the depth test seems to indicate that the textures created include the alpha value.

There are other hints you might use for instance you might try (I don't know if it works but easy to test)

Copy code
  1. hint(DISABLE_DEPTH_TEST);
  2. hint(ENABLE_DEPTH_SORTT);
  3.       //draw images
  4. hint(DISABLE_DEPTH_SORT);
  5. hint(ENABLE_DEPTH_TEST);
Processsing supports other hints you might try I have copied them from the source code

Copy code
  1.   // hints - hint values are positive for the alternate version,
  2.   // negative of the same value returns to the normal/default state
  3.   static final int ENABLE_NATIVE_FONTS        =  1;
  4.   static final int DISABLE_NATIVE_FONTS       = -1;
  5.   static final int DISABLE_DEPTH_TEST         =  2;
  6.   static final int ENABLE_DEPTH_TEST          = -2;
  7.   static final int ENABLE_DEPTH_SORT          =  3;
  8.   static final int DISABLE_DEPTH_SORT         = -3;
  9.   static final int DISABLE_OPENGL_ERRORS      =  4;
  10.   static final int ENABLE_OPENGL_ERRORS       = -4;
  11.   static final int DISABLE_DEPTH_MASK         =  5;
  12.   static final int ENABLE_DEPTH_MASK          = -5;
  13.   static final int ENABLE_ACCURATE_2D         =  6;
  14.   static final int DISABLE_ACCURATE_2D        = -6;
  15.   static final int ENABLE_STROKE_PERSPECTIVE  =  7;
  16.   static final int DISABLE_STROKE_PERSPECTIVE = -7;
  17.   static final int DISABLE_TEXTURE_MIPMAPS    =  8;
  18.   static final int ENABLE_TEXTURE_MIPMAPS     = -8;
  19.   static final int ENABLE_STROKE_PURE         =  9;
  20.   static final int DISABLE_STROKE_PURE        = -9;
  21.   static final int HINT_COUNT                 = 10;


thanks a lot!
What do you mean by  textures "created include the alpha value" is there a way to avoid this?

A first try with enabling depth sort didn't work, but I'll keep on trying with other hint setting.
After playing around with different hint settings I still haven't found anything yet that solves the problem.

This, one year old post seems to deal with the same issue, as a solution they changed from OPENGL to P3D renderer. Since I'm using processing 2, this is currently no option.