I opened this issue to keep track of the forum discussion:
https://hub.jmonkeyengine.org/t/problem-setting-renderstate-blendmode-off-on-particleemitter/45215
Changing the default "BlendMode" of the "particle material" from Off to another and then back to Off, something seems to break.
Also happens when setting it directly to Off without setting it to something else first.
Here is the test case:
package com.test.main;
import com.jme3.app.SimpleApplication;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.material.RenderState.BlendMode;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.system.AppSettings;
/**
*
* @author capdevon
*/
public class Test_BlendModeIssue extends SimpleApplication {
private ParticleEmitter emit;
private float angle = 0;
private float timer;
private float refreshRate = 1f;
private int mIndex = 0;
private BlendMode[] modes = { BlendMode.Off, BlendMode.Alpha };
/**
*
* @param args
*/
public static void main(String[] args) {
AppSettings settings = new AppSettings(true);
settings.setResolution(800, 600);
Test_BlendModeIssue app = new Test_BlendModeIssue();
app.setShowSettings(false);
app.setPauseOnLostFocus(false);
app.setSettings(settings);
app.start();
}
@Override
public void simpleInitApp() {
flyCam.setDragToRotate(true);
flyCam.setMoveSpeed(20);
viewPort.setBackgroundColor(ColorRGBA.DarkGray);
createParticleEmitter();
}
@Override
public void simpleUpdate(float tpf) {
timer += tpf;
if (timer > refreshRate) {
timer = 0;
mIndex = (mIndex + 1) % modes.length;
BlendMode bm = modes[mIndex];
fpsText.setText("BlendMode: " + bm.toString());
emit.getMaterial().getAdditionalRenderState().setBlendMode(bm);
}
angle += tpf;
angle %= FastMath.TWO_PI;
float x = FastMath.cos(angle) * 2;
float y = FastMath.sin(angle) * 2;
emit.setLocalTranslation(x, 0, y);
}
private void createParticleEmitter() {
emit = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 300);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat.setTexture("Texture", assetManager.loadTexture("Effects/Smoke/Smoke.png"));
emit.setGravity(0, 0, 0);
emit.getParticleInfluencer().setVelocityVariation(1);
emit.getParticleInfluencer().setInitialVelocity(new Vector3f(0, .5f, 0));
emit.setLowLife(1);
emit.setHighLife(1);
emit.setImagesX(15);
emit.setMaterial(mat);
rootNode.attachChild(emit);
System.out.println("Default BlendMode: " + mat.getAdditionalRenderState().getBlendMode());
}
}
I opened this issue to keep track of the forum discussion:
https://hub.jmonkeyengine.org/t/problem-setting-renderstate-blendmode-off-on-particleemitter/45215
Changing the default "BlendMode" of the "particle material" from Off to another and then back to Off, something seems to break.
Also happens when setting it directly to Off without setting it to something else first.
Here is the test case: