Setting alpha to 0 but still see objects?

Hello,

I have a vertex shader where I am trying to have the visibility of some terrain fade out at some distance from the viewpoint. I was trying to ramp the fragment color alpha down from 1.0 to 0.0 to do this. That should work, shouldn’t it?

Anyway I notice that even when I explicitly just set the fragment color to 0, the objects are still visible. Shouldn’t setting the fragment color w value to 0 make it invisible?

Thanks
Bob

Shouldn’t setting the fragment color w value to 0 make it invisible?

No. Alpha doesn’t mean anything by itself. It’s just a number. It only takes on a meaning based on what you do with it. If you want alpha to make something transparent or transluscent, you will need to employ blending and key the blend function off of the alpha.

Yeah, I found that I had set the blend wrong. It was :

	glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

instead of this, which seems to work more like what I want:

             glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

However, I am still getting my alpha value mangled somehow, if you have time to read my other post just after this one?
Thanks
Bob

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