Problem with blending

I have a dataset which i put into a 3d texture using GL_LUMINANCE_ALPHA, where the luminance is the value of the data and the alpha value is just 0 for 0 and 255 for everything else. I map this to 3 quads as seen in this screenshot

However the blending is only correct for the last drawn quad. I use

Is there anything simple i have overlooked?

Yes, a couple of things :slight_smile:

  • depth testing
  • your blendfunc is order dependant. So you have to carefully order the drawing of your quad, ie. for back to front.

If you only have binary alpha, you can get away with alpha blending and use only alpha testing, and no need to sort your quads in that case.

glAlphaFunc(GL_GREATER,0.5f); // adjust your prefered threshold here

Some litterature on the subject, I recommend you read at least “Introduction to GPU Volume Rendering” (1) and (2) :

This is somewhat older :

The keywords for your searches : hardware accelerated volume rendering.

There has already been quite a lot of discussions about it on these forums as well.

That did the trick, thanks alot. Also thanks for the reading suggestions.