alpha blending problem

Hi
I have a problem with alpha blending.
I disable depth test and draw a solid cube and a solid sphere, cube is semi transparent, the sphere is opaque.
When the sphere is in front of the cube is semi transparent too. Why?
The blend function is SRC_ALPHA, ONE_MINUS_SRC_ALPHA .
Thank a lot

I assume you mean that from the point of view of the camera, the sphere is in front of the cube. That the sphere should occlude all or part of the cube from view.
But what you are seeing is cube drawn in front of the sphere.

The fact that you turned depth test off seems wrong to me.

A better way to draw is as follows:

  • draw all the opaque stuff(Depth Writes on, Blending off)
  • draw all the transparent stuff in back to front order(Depth Writes off, Blending on)

Depth Test should be on.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.