blending
Hi,
again, blending is confusing me and I can''t figure out a simple factor combination. I have the mask for each bitmap stored in the alpha layer, 0 being where I want to see through the bitmap and 255 where the actual image is. How should I set the blending func to create a solid mesh that I can (completely) see through where the alpha mask is zero? I''m figuring glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);, but it produces a totally different effect... Note that I don''t want to use a separate monochrome image for masking - instead I''d like to store everything in one bitmap.
Thanks in advance,
Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
Found the solution.
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
GL_SRC_ALPHA for the source blend factor.
GL_ONE_MINUS_SRC_ALPHA for the destination blend factor.
Use GL_REPLACE. (don''t use GL_BLEND). You might want to use GL_MODULATE.
Use RGBA for your map.
Set your material color to 4 components, where the alpha is 1.0.
I believe you want to enable GL_BLEND, but don''t confuse this with the texture operation, which should not be GL_BLEND.
It gets rather confusing.
GL_ONE_MINUS_SRC_ALPHA for the destination blend factor.
Use GL_REPLACE. (don''t use GL_BLEND). You might want to use GL_MODULATE.
Use RGBA for your map.
Set your material color to 4 components, where the alpha is 1.0.
I believe you want to enable GL_BLEND, but don''t confuse this with the texture operation, which should not be GL_BLEND.
It gets rather confusing.
_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
I resorted to blending and set glAlphaFunc() to > 0 (and enabled GL_ALPHA_TEST) and the result is pretty much as expected. Looks nice except for one thing. I''ll post a pic describing the problem:

The red lines denote four quads (topside view) and the green triangle is the fov. This is a tricky one - if I use any other mode than GL_LINEAR to create the textures, the edges of the quads are "blended", or "interpolated". This poses a problem - the order in which the quads have to be drawn becomes relevant. The normal order is back-first for blending as, I''m sure, everyone here knows. In this case, however, how do I set the order for the quads?
Here''s a result when they''re drawn in constant succession, regardless of the orientation/position of the eye:

Even though this screenshot doesn''t examplify the actual problem (I could draw the trees and other such objects as the last things in the scene), there still remains a similar effect when it comes to viewing through the holes in the leaves of the tree. The backmost quads of the same tree can be seen through just as the water surface can be seen through in this screenshot - all due to incorrect z-order. Just in case it''s unclear: have a closer look at the red rectange and the terrain that can be seen clearly through the water surface along the edge of the tree leaves. What would be a solution to this?
Thanks,
Crispy

The red lines denote four quads (topside view) and the green triangle is the fov. This is a tricky one - if I use any other mode than GL_LINEAR to create the textures, the edges of the quads are "blended", or "interpolated". This poses a problem - the order in which the quads have to be drawn becomes relevant. The normal order is back-first for blending as, I''m sure, everyone here knows. In this case, however, how do I set the order for the quads?
Here''s a result when they''re drawn in constant succession, regardless of the orientation/position of the eye:

Even though this screenshot doesn''t examplify the actual problem (I could draw the trees and other such objects as the last things in the scene), there still remains a similar effect when it comes to viewing through the holes in the leaves of the tree. The backmost quads of the same tree can be seen through just as the water surface can be seen through in this screenshot - all due to incorrect z-order. Just in case it''s unclear: have a closer look at the red rectange and the terrain that can be seen clearly through the water surface along the edge of the tree leaves. What would be a solution to this?
Thanks,
Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
The simple solution is to use alpha masking by itself, and not bother with blending for this.
Blending eats up more fillrate, and what youre after is achieved via alpha masking alone anyway
-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
Blending eats up more fillrate, and what youre after is achieved via alpha masking alone anyway

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement