问题
I have two THREE.ParticleSystem systems with particles that have textures with alpha transparency, one is using AdditiveBlending (fire texture), the other uses NormalBlending (smoke texture) and they use simple custom vertex and fragment shaders.
Each ParticleSystem has "sortParticles = true" and independently they work perfectly, however when both types of particles overlap the first particle system (fire texture) has a similar transparency depth error that is normally associated with "sortParticles = false" (see image).
It seems that the first particle system is not rendering properly, likely because those particles are all being drawn before the others even when particles from the other system are behind them, resulting in transparency artifacts.
Perhaps one possible solution is for sortParticles to somehow sort both systems. Is this a possibility? Is there a "global particle sort flag" of some sort or a way to force sortParticles to span both systems?
Another somewhat more involved solution could be to use a single sorted ParticleSystem but somehow vary both texture and blending mode per-particle. Is this possible? I have a clue of how this could be done in the shader but I'm concerned about adding a conditional for performance reasons.
Open to any and all solutions. Thanks for any advice, ideas or help!
来源:https://stackoverflow.com/questions/22901015/three-js-transparency-errors-with-multiple-particle-systems-sorting