where material->transparency is a float between 0.0 and 1.0.
The model is rendered not transparent, but it has some artifacts (like if it is rendered without the use of the depth buffer…). If i disable lighting, all the scene is very dark, but the model is rendered with transparency… :sorrow:
Are you sure You use material->transparency value as your GL_SRC_ALPHA in blend equation ?
if its not a shader-based aproach, how do you apply your texture on model (how do you use glTexEnv) ? Maybe You need to setup glTexEnv correctly to mix your texutre’s rgb color with “glColor4f(1.0f, 1.0f, 1.0f, material->transparency)” color ?
Yes I think MichalST is right, look at the glTexEnv function. First check if GL_TEXTURE_ENV_MODE is GL_MODULATE, the default one for the material texture.
First i have a 3D textured model completely opaque. Second, i want to render a special effect. The sfx is a simple object: two textured plane, one orthogonal to the other (they intersect each other at the middle). They are textured with the same texture. I render this sfx with no backface culling. I want it transparent. I have tried
and it does works. I see the effect rendered in the right way.
If i do not use glDepthMask(GL_FALSE), the effect is not rendered correctley (i do not know how to explain this…).
Suppose that i use glDepthMask(GL_FALSE).
I have some strange effects when i render the 3D model (i want the 3D model to be inside the 3D effect).
The scene is rendered in the following way:
1]draw the background (a static image) in the color buffer
2]render the 3D opaque model
3]render the sfx
All is correct if i do not execute the second step. If, otherwise, i render the 3D opaque model, it is a mess!!!
Instead of seeing the 3D model or some combination of the 3D effect and the 3D model, i see part of the background…
(the 3d opaque model is rendered with the depth test and z-write enabled…)
Suppose that glDepthMask(GL_FALSE) is not executed. The 3D model is rendered correctly inside the sfx, but the sfx, like i said, is not rendered in the right way at 100%.
What can i do?!? What am i doing wrong?
Help please!!
Thank you
Ps.
The sfx wants to represent a simple flame. Actually, it is a bit more complex because i use four planes instead of two, but that does not change anything.
Pss.
I cannot use pixel shader and the hardware i am using is slow…so using textures to make effects (with blending enabled) is the only effective way (some particle effects can be done, but with not too much particles…)