Why do smoke particles appear as square shaped blocks?

I am trying to use following code which I took from TestPongCool.java to add some smoke to another simulation.

[java]private void initParticleSystem() {

ExplosionFactory.warmup();

particles = ParticleFactory.buildParticles(“particles”, 60);

particles.setEmissionDirection(new Vector3f(0, 1, 0));

particles.setStartSize(3f);

particles.setEndSize(1.5f);

particles.setOriginOffset(new Vector3f(0, 0, 0));

particles.setInitialVelocity(.05f);

particles.setMinimumLifeTime(400f);

particles.setMaximumLifeTime(1000f);

particles.setStartColor(new ColorRGBA(1, 0, 0, 1));

particles.setEndColor(new ColorRGBA(0, 1, 0, 1));

particles.setMaximumAngle(360f * FastMath.DEG_TO_RAD);

particles.getParticleController().setControlFlow(false);

particles.getParticleController().setSpeed(1);

ParticleInfluence wind = SimpleParticleInfluenceFactory.createBasicWind(.6f, new Vector3f(0, 1, 0), true, true);

// wind.setEnabled(true);

particles.addInfluence(wind);

BlendState as1 = display.getRenderer().createBlendState();

as1.setBlendEnabled(true);

as1.setSourceFunction(BlendState.SourceFunction.SourceAlpha);

as1.setDestinationFunction(BlendState.DestinationFunction.One);

as1.setTestEnabled(true);

as1.setTestFunction(BlendState.TestFunction.GreaterThan);

as1.setEnabled(true);

particles.setRenderState(as1);

TextureState ts = display.getRenderer().createTextureState();

ts.setTexture(

TextureManager.loadTexture(

TestPongCool.class.getClassLoader().getResource(

“jmetest/data/texture/flaresmall.jpg”),

Texture.MinificationFilter.Trilinear,

Texture.MagnificationFilter.Bilinear));

ts.setEnabled(true);

particles.setRenderState(ts);

ZBufferState zstate = display.getRenderer().createZBufferState();

zstate.setEnabled(true);

zstate.setWritable(false);

particles.setRenderState(zstate);

particles.setModelBound(new BoundingBox());

particles.updateModelBound();

arena.attachChild(particles);

}[/java]

I am using this exact code. But when I use this with my project particles appear as square shaped blocks. They don’t look like smoke. I tried reducing other textures but I didn’t see any difference.

Could someone tell me the reasons why this is happening and possible solutions?

Thank you

Maybe jme is purposly doing that because your graphic card cant handle so much information. Or the texture takes some time to load.

OR it could be particles.setModelBound(new BoundingBox()); particles.updateModelBound();

try not to modd the boundingbox, that usually interferes with normal view culling.



Im not sure Im just bringing some ideas…

1 Like

You probably forgot updateRenderState()… Man jME2 was really annoying when I look at that code now ^^

1 Like

@normen you are a genius :smiley: Thanks a lot

I wasted almost a day trying this and that.

No problem, note that all manual updateXXX calls have been banned from jME3 :wink:

updateRenderState() … Still having bad dreams about that one