Particle emitter disappears with white as a background color

Hello,



I’m working with the particle emitters and I’ve realized that when the background color beyond the particle emitter is white, the particle emitter disappears.



I’ve been testing with the TestExplosionEffect.java by adding the following line in the simpleInitApp function:


  • viewPort.setBackgroundColor(ColorRGBA.White);



    And then you can’t see the explosion.



    I don’t know if that is a desired behaviour or maybe it’s a bug.



    Any ideas??

Hmmm, true, I can reproduce that.



I don’t know why it is happening though. It’s not because the effect itself was white, not even colored effects show on a white background. I tried it on a very light gray background, and then I can see the effects, but they are almost fully white – or transparent? Does the brightness or opacity of the particles somehow depend on the background color? That sounds like a bug.





I added a huge Quad image with a white background at a depth of -200 to a scene with a blackground. The effect is at the origin.



The effect fully disappears in front of the white areas and is visible in front of the black areas.

Particles are alpha additive. white + any other color = white.



I think anything else is problematic because then the particles would need to be sorted. You could try just alpha and see.

@pspeed: Regarding “try just Alpha”, I tried editing a copy of the j3md yesterday and could not find a combination where the effect is visible on white where also the background of the effect stayed transparent (and did not drag a huge black rectangle with it).

So are you saying that any transparency setting that makes particles opaque would also require sorting for the effect not to look broken?

Yes. Transparency requires sorting. Alpha add doesn’t because everything just gets added.



If you use plain alpha then you might be able to get away with turning on alpha test and setting the alpha falloff threshold.

Ok, so due the particles are alpha aditive, when the background is white they become withe as well.



Is there any way to avoid that? :?



If not I will use less white as background color. It’s the easiest solution and maybe the best. :smiley:



pspeed said “turning on alpha test and setting the alpha falloff threshold” but I have no idea of what is that.



Is there any information about that?

I know how to do it in code. I don’t know off the top of my head how to do it in a material def. But those are part of the additional render states.