UseInvAlpha = true causing transparency flashes
by Ronald J Nelson · in Torque Game Engine Advanced · 05/10/2008 (9:09 pm) · 6 replies
This was addressed and fixed in TGE.
www.garagegames.com/mg/forums/result.thread.php?qt=31109
However, I am seeing particles (using useInvAlpha set to true) near objects using transparency causes flickering in the transparency on objects.
I suspect there is some correlation between this bug and the one I linked to..
www.garagegames.com/mg/forums/result.thread.php?qt=31109
However, I am seeing particles (using useInvAlpha set to true) near objects using transparency causes flickering in the transparency on objects.
I suspect there is some correlation between this bug and the one I linked to..
#2
The blend selected by useInvAlpha=true (BlendSrcAlpha,BlendInvSrcAlpha) is a depth-order-dependent blend in contrast to the usual additive blend (BlendSrcAlpha,BlendOne) which is not depth-order-dependent. Since particles sort according to the emitter's bounding box, rather than individual particles, they never interact perfectly with overlapping transparent objects and I suspect it's worse when using a depth-order-dependent blend.
05/13/2008 (7:08 am)
In the thread you point to, flickering was occurring in particle-emitters that mixed particles with different useInvAlpha settings. The TGEA particle system explicitly requires a single blend per particle-emitter so it can't be the same issue.The blend selected by useInvAlpha=true (BlendSrcAlpha,BlendInvSrcAlpha) is a depth-order-dependent blend in contrast to the usual additive blend (BlendSrcAlpha,BlendOne) which is not depth-order-dependent. Since particles sort according to the emitter's bounding box, rather than individual particles, they never interact perfectly with overlapping transparent objects and I suspect it's worse when using a depth-order-dependent blend.
#3
05/13/2008 (8:26 am)
One possible reason for a flashing interaction between a particle-emitter and nearby transparent objects could come from the fact that a particle-emitter dynamically adjusts its bounding box. This can cause it to jump between sorting in front of and behind transparent objects causing a flicker. This should be noticeable with normal particles but might be more obvious with useInvAlpha=true.
#4
05/13/2008 (10:14 pm)
Thanks for the information Jeff, it sounds like a bug but one I can just avoid by not using useInvAlpha I suppose.
#5
Also, useInvAlpha is obsolete. You can now specify any kind of blend for your particles as long as you only use one blend in an emitter. See this link for more info:
tdn.garagegames.com/wiki/TSE/Particles#ParticleEmitter_Blend_Factors
The biggest problem we always have to deal with when using Torque particles is the way emitters sort with each other and other transparent objects. There are some situations that you just can't get to work perfectly. If there are working algorithms to maintain depth ordering of all individual particles with other transparent objects, that would eliminate most of the usual problems.
05/14/2008 (5:40 am)
Well, that's one way to avoid the problems but it's hard to do black smoke with an additive blend. For what it's worth, we use useInvAlpha and other depth-order-dependent blends quite a bit without encountering too many problems. Yesterday I tried a few things where I placed useInvAlpha particles in proximity and overlapping with transparent objects and did not encounter any kind of flickering in the transparent objects. It actually looked pretty good. However, we often lock our emitter bounding boxes so I thought a dynamically changing box could be part of the problem. There might be something specific about your situation or the nature of your transparent objects that is at play here.Also, useInvAlpha is obsolete. You can now specify any kind of blend for your particles as long as you only use one blend in an emitter. See this link for more info:
tdn.garagegames.com/wiki/TSE/Particles#ParticleEmitter_Blend_Factors
The biggest problem we always have to deal with when using Torque particles is the way emitters sort with each other and other transparent objects. There are some situations that you just can't get to work perfectly. If there are working algorithms to maintain depth ordering of all individual particles with other transparent objects, that would eliminate most of the usual problems.
#6
05/15/2008 (4:13 pm)
We use useInvAlpha particles infront of our explosions, which are animated billboards aligned to the camera, and can't see any of the problems mentioned above.
Torque Owner Ronald J Nelson
Code Hammer Games