Texture using additive render mode?

Hello everyone,

I am having problems understanding the usage of material parameters (I am pretty new to jMonkey).
As far as I understand my desired effect is not difficult to achieve, but I could not find any topics or tutorials that helped. All I need is that the following trail has an additive render effect, that is black pixels are completely transparent, and all pixels brighter than black add to the value of beneath pixels. As I am new to this, I might use uncorrect terminology, so feel free to correct me.

My code so far:
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat.setColor(“Color”, color);
mat.setTexture(“ColorMap”, assetManager.loadTexture(“Textures/F3Fb0.png”));

1 Like

Perhaps AlphaAdditive would be what you’re looking for?

Erm… just noticed you weren’t using additive at all…




Blend modes touched on here:


yeah, that helped. I somehow overlooked that line.

I have now two further questions:

  1. What settings need to be performed that the trail uses alpha additive render mode on itself? Currently it has these ugly borders:

  2. I figured that the best way to use sprites is with Quads, am I right? Right now I have no idea how to graphically fade this engine fire sprite in or out when the engine drive is active.

Thanks in advance!

Setting the AlphaDiscardThreshold will help (a material parameter) but this is a pretty standard issue with transparency in modern 3D graphics. The pixel drawn first + nearest wins because it fills the Z buffer.

Another approach is that if you always render your trails last then you can turn off depth writing.

I don’t really understand what you’re saying. What should I set the AlphaDiscardThreshold ?
[java]setFloat(“AlphaDiscardThreshold”,???); [/java]

But I think I’ll just disable depth writing for trails and sprites, as all of them are rendered additively and after everything else. Thanks for that tip, it looks just as i wanted now.

Has anyone a tip how to fade in/out quads over time (the engine drive flare as seen above)?

Put the time into the vertexes, and use a shader to modify the alhpa based on vertexcreationtime and currenttime?