0
\$\begingroup\$

Before I try to make anything transparent, the model renders nicely. When I change the uv layout so that one piece of the model will be transparent, it renders horribly. This is the result with a translucent green texture:

The green part in the middle is translucent

I did transparency with OpenGL when I did 2D games and everything worked nicely because of these two lines:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Now, I fear, this won't be enough, right? Or maybe I should use some other technique?

\$\endgroup\$
  • \$\begingroup\$ Without seeing your code is a little bit hard to figure out the problem. Please add the related code in your question. \$\endgroup\$ – dsilva.vinicius Dec 9 '13 at 19:47
  • \$\begingroup\$ I'm not even sure what code to actually show you. \$\endgroup\$ – Kipras Dec 9 '13 at 20:31
  • \$\begingroup\$ I mean, this is basic model loading from an .obj file. When the uv is fully opaque it renders well (like in the picture but with opaque green on the chest), but when I change that green to transparent or translucent weird things happen. By the way, the little bit of yellow on the cyan legs aren't a bug, they should be there so that's ok. \$\endgroup\$ – Kipras Dec 9 '13 at 20:38
  • 3
    \$\begingroup\$ @Kipras This looks like a sorting issue. Ideally you need to draw all polygons in back-to-front order when using translucency. \$\endgroup\$ – Nathan Reed Dec 9 '13 at 20:44
  • 1
    \$\begingroup\$ First enable backface culling. That should make it a lot better, but still wrong. Then proceed to solving the sorting issue if you still need to. \$\endgroup\$ – msell Dec 10 '13 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.