I'm using shaders to display rectangles as circles using a vertex point shader (frag shader) but depending of the angle of my camera the transparent zones appear as black (see below). Is there a way to fix this (using a shader) ?
I believe this problem occurs when rendering non z-sorted semi-transparent objects.
You could try disabling the depth buffer inside your setup() function:
hint(DISABLE_DEPTH_MASK);
I think I saw this trick in one of the example sketch that comes with Processing.
This solution can work in some cases but I need to let it enabled. I was wondering if I can resolve this problem inside the shader without losing the depth information and let appear some particles on top of others.
There should be multiple ways to fix that problem... depending on how your shader code looks like. Could you provide some example code for us to play around with? :)
Answers
I believe this problem occurs when rendering non z-sorted semi-transparent objects. You could try disabling the depth buffer inside your setup() function:
hint(DISABLE_DEPTH_MASK);
I think I saw this trick in one of the example sketch that comes with Processing.
This solution can work in some cases but I need to let it enabled. I was wondering if I can resolve this problem inside the shader without losing the depth information and let appear some particles on top of others.
There should be multiple ways to fix that problem... depending on how your shader code looks like. Could you provide some example code for us to play around with? :)
Here is a little example sketch using a modified version of the point shader found in Processing's Shader Tutorial:
Works without any transparency issues, how does your shader code look like?