user30088
user30088

Reputation: 517

Alpha blending, transparence and z-ordering

I'm making some tests with alpha blending in a projet and I don't understand something.

In my tests I've done something like that and everything look good:

enter image description here

Every tutorial say that we should:

Here is the result:

enter image description here

So, I'm not sure to understand how it work/what is wrong (I've read this document).

Thanks!

Upvotes: 1

Views: 1256

Answers (1)

Andon M. Coleman
Andon M. Coleman

Reputation: 43319

You typically disable depth writes (e.g. glDepthMask (GL_FALSE)) for the translucent objects, but the depth test itself is not something you would disable.

You need to test against the depth values generated by the opaque objects for this to function correctly, otherwise you have to sort both your opaque and translucent objects (which is exactly what you did originally).

Upvotes: 1

Related Questions