Particle texture


I like the particle effects in jME a lot - I use them for fire, explosion and some bullets.

But for the bullet I would like to use the colors from the texture as real colors on the screen and use the alpha channel of the texture as alpha instead.

Can someone tell me which code in the ParticleManager/Particle prevents the particles from doing so (it uses the color-channel as alpha), so I can revert that?

Best regards,


This is completely dependent on the AlphaState you apply, not the Particles themselves. Have a look at the state settings you are using.

Thanks for the fast reply.

Seems like I don’t really know how to use alpha states ://

I copied the particle manager setup from the ParticleEditor and used this code for alpha (played around with the parameters a bit but could not get what I want):

      alpha.setBlendEnabled( true );
      alpha.setSrcFunction( AlphaState.SB_SRC_ALPHA );
      alpha.setDstFunction( AlphaState.DB_SRC_ALPHA );
      alpha.setEnabled( true );

When using this image as texture the result is this:

(used green in the particle editor)
But what I want something like that:

What would be suited as alpha?

What beginning/ending color did you specify? If you play with those two items, you should be able to get the color to be what you expect.

Ok, you need to pay attention to both the color and alpha states. Also, you should expand your texture to 32x32 because at 30x30, some cards may not handle it properly.

In regards to color, set the particle start and end colors to white to let the texture color show… if you wanted to rely on start and end colors to provide your texture color (like red -> yellow fire for example) you’d want to use a greyscale image or the texture color and start/end colors will blend and perhaps produce an unexpected result. otherwise, use equal amounts of r,g and b to simply lighten/darken the texture color.

The alpha you provide in start/end color is still useful for fade out though. So try setting them like this:

    manager.setStartColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
    manager.setEndColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.0f));

Now, for your alpha state, try something like this:

    AlphaState as1 = display.getRenderer().createAlphaState();

Hope that's what you are looking for!

Thanks for your time, renanse, this solves my problem - would not have realized that it was so easy…


(I did not recognize your post until now as I did not get the notify mail.)

no problem. yeah, the notify feature is not the most reliable.