order independent transparency problem

Started by
5 comments, last by sunsflower 7 years, 10 months ago

hi! I've just implemented OIT using the recipe in opengl4 shading language cookbook and I draw some quads. It works, but the diagonal line are less transparent as if fragments there are drawn twice. Then I drop my code and copy everything from the recipe in that book but the diagonal lines are still seen clearly...here is a screenshot:

how could this happed?...

[sharedmedia=gallery:images:7463]

Advertisement

Is there indexed geometry? Let those two verts on diagonal be shared in both triangles.

They should be not just identical, but the very same instances.

I tried to use drawelements, but results are quite the sam. and I also tried to use triangle_fans and triangle_strips which doesn't work either...
How does this algorithm work?
"In this recipe, we'll use SSBOs and image load/store to implement order-independent transparency. We'll use two passes. In the first pass, we'll render the scene geometry and store a linked list of fragments for each pixel. After the first pass, each pixel will have a corresponding linked list containing all fragments that were written to that pixel including their depth and color. In the second pass, we'll draw a full-screen quad to invoke the fragment shader for each pixel. In the fragment shader, we'll extract the linked list for the pixel, sort the fragments by depth (largest to smallest), and blend the colors in that order. The final color will then be sent to the output device." some thing like that

Is there indexed geometry? Let those two verts on diagonal be shared in both triangles.
They should be not just identical, but the very same instances.


"In this recipe, we'll use SSBOs and image load/store to implement order-independent transparency. We'll use two passes. In the first pass, we'll render the scene geometry and store a linked list of fragments for each pixel. After the first pass, each pixel will have a corresponding linked list containing all fragments that were written to that pixel including their depth and color. In the second pass, we'll draw a full-screen quad to invoke the fragment shader for each pixel. In the fragment shader, we'll extract the linked list for the pixel, sort the fragments by depth (largest to smallest), and blend the colors in that order. The final color will then be sent to the output device." some thing like that


It sounds like what vstrakh is suggesting. Do you have 4 vertices per quad or 6? From how you say the algorithm works it sounds like along that line it has 2-3 values per pixel. 3 where the red and green over lap and 2 where the green is. To check you could modify the shader to set different colors depending on the size of the linked list. It seems like you have 6 vertices and the corner vertices are ever so slightly different so it is making the two triangles that make up the green quad overlap (thus giving you 2-3 values per pixel along the overlap).

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

I actually have four vertices and six indices per quad, like float verticeData[] = {100, 100, 1, 100, 300, 1, 300, 300, 1, 300, 100, 1}; uint indexData[] = {0, 1, 2, 0, 2, 3}. There shouldn't be any different on the corner vertices I guess. But thanks for the help

This topic is closed to new replies.

Advertisement