Bug in the blending function?
by Bendik Stang · in Torque Game Engine · 02/02/2003 (2:28 am) · 2 replies
I have noticed that both the interior transparency code and the fxGrassReplicator code suffers from the same problem.
From time to time all the blending renders nicely and just as often there is a blending problem.
This leads me to think that it might be other bug elsewhere.
It is one object that seem to get messed up with the blending functions, the sky.
If you look at the fxGrass from above, it looks fine, but looking at the grass from a low angle where there is a cliff so that the background is the sky, the result is bugged.
Same goes for the dif-transparecy code. Although this code also creates other bugs on occations.
In the fxGrass code I use:
Any suggestions?
From time to time all the blending renders nicely and just as often there is a blending problem.
This leads me to think that it might be other bug elsewhere.
It is one object that seem to get messed up with the blending functions, the sky.
If you look at the fxGrass from above, it looks fine, but looking at the grass from a low angle where there is a cliff so that the background is the sky, the result is bugged.
Same goes for the dif-transparecy code. Although this code also creates other bugs on occations.
In the fxGrass code I use:
glEnable ( GL_TEXTURE_2D ); glBindTexture ( GL_TEXTURE_2D, mFieldData.mGrassTexture.getGLName() ); glEnable ( GL_BLEND ); glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ); glTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); glEnable ( GL_ALPHA_TEST ); glDisable ( GL_CULL_FACE ); glAlphaFunc ( GL_GREATER, mFieldData.mAlphaCutoff );
Any suggestions?
#2
Instead of doing a depth sort, I wanted to use alpha testing.
I guess it's due to the rendering structure that you mentioned. If this is so, I guess there is no work around.
I must either do a sort or leave it as it is...
Doing a sort, is pointless with 20k grass elements needing to be sorted every frame. (as far as I know)
Leaving it as it is...hmm
:(
02/03/2003 (12:05 am)
By bugged i mean exactly what you said. ;)Instead of doing a depth sort, I wanted to use alpha testing.
I guess it's due to the rendering structure that you mentioned. If this is so, I guess there is no work around.
I must either do a sort or leave it as it is...
Doing a sort, is pointless with 20k grass elements needing to be sorted every frame. (as far as I know)
Leaving it as it is...hmm
:(
Torque Owner Mz
I know that Corvidae's interior transparency code doesn't sort by Z value, which it would need to do to get rid of all artifacts. Torque also doesn't have a mechanism to render blended polys in a separate batch, which it probably shold have. I don't know about the fxGrass, but I imagine it's the same problem.
Fixing that kind of thing is going to require some big changes to Torque's rendering process, I think.