Jump to content
  • Advertisement
Sign in to follow this  
sunsflower

OpenGL order independent transparency problem

This topic is 778 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

 

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
"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

Share this post


Link to post
Share on other sites

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).

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!