Hi Everyone,
Newbie here. I’m having a little difficulty with smoke and the terrain (Screenshot attached).
I’m using “setQueueBucket(RenderQueue.Bucket.Translucent)” on the smoke node so that I can see it through the WaterFilter in the background, but this means that I can see the smoke through the terrain as well (visible in the lower half of the shot - the smoke and the fire is actually behind that terrain).
Any idea what I’m doing wrong? I’ve tried lots of different rendering options with setQueueBucket on the different spatials. Thanks in advance for any help. My code is below:
[java]
// Water Filter:
fpp = new FilterPostProcessor(assetManager);
water = new WaterFilter(rootNode, lightDir);
water.setWaterHeight(initialWaterHeight);
fpp.addFilter(water);
viewPort.addProcessor(fpp);
AudioNode waves = new AudioNode(assetManager, “Sounds/Environment/ocean.ogg”, false);
waves.setLooping(true);
audioRenderer.playSource(waves);
// Fire:
ParticleEmitter fire =
new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 30);
Material mat_red = new Material(assetManager,
"Common/MatDefs/Misc/Particle.j3md");
mat_red.setTexture("Texture", assetManager.loadTexture(
"Effects/Explosion/flame.png"));
fire.setShape(new EmitterPointShape(Vector3f.ZERO));
fire.setMaterial(mat_red);
fire.setImagesX(2);
fire.setImagesY(2); // 2x2 texture animation
fire.setEndColor( new ColorRGBA(1f, 0f, 0f, 1f)); // red
fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 2, 0));
fire.setStartSize(1.5f);
fire.setEndSize(0.1f);
fire.setGravity(0, 0, 0);
fire.setLowLife(1f);
fire.setHighLife(3f);
fire.getParticleInfluencer().setVelocityVariation(0.3f);
fire.move(-75.88f, 10.95f, -21.23f);
fire.setQueueBucket(RenderQueue.Bucket.Translucent);
rootNode.attachChild(fire);
// Smoke:
ParticleEmitter smoke =
new ParticleEmitter("Smoke", ParticleMesh.Type.Triangle, 2500);
Material smoke_mat = new Material(assetManager,
"Common/MatDefs/Misc/Particle.j3md");
smoke_mat.setTexture("Texture", assetManager.loadTexture(
"Effects/Explosion/smoketrail3.png"));
smoke.setMaterial(smoke_mat);
smoke.setImagesX(6);
smoke.setImagesY(5);
smoke.setLocalScale(new Vector3f(10.0f, 10.0f, 10.0f));
smoke.setSelectRandomImage(true);
smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f, 4f, 0.0f));
smoke.getParticleInfluencer().setVelocityVariation(0.035f);
smoke.setLowLife(1f);
smoke.setHighLife(30f);
smoke.setParticlesPerSec(50);
smoke.setGravity(0, 0, 0);
smoke.setStartColor(ColorRGBA.White);
smoke.setRotateSpeed(2.5f);
smoke.move(-75.88f, 10.95f, -21.23f);
smoke.setQueueBucket(RenderQueue.Bucket.Translucent);
rootNode.attachChild(smoke);
// Load the Terrain:
Spatial terrain = assetManager.loadModel("Scenes/test_island_001.j3o");
terrain.setLocalTranslation(0, -75, 0);
terrain.setLocalScale(2);
rootNode.attachChild(terrain);
[/java]