Alpha not getting set correctly in particles

  ... in the unlikely case you discovered a bug, post it here.

Alpha not getting set correctly in particles

Postby Bunkins » Sun Feb 26, 2012 4:48 pm

I have found a strange alpha setting issue when I was using some particle systems yesterday.

I have two particle systems - blurry blobs and some stars. The blurry blobs are always at 0.1 alpha before fading to 0.0 before expiring. The stars should start at 1.0, before fading to 0.0 at the end before expiring. Like so

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. m_BlurBlobParticleSystem = new SpriteParticleSystem(new PointParticleEmitter(176.0f, 336.0f), 1, 3, 15, m_BlurBlobTextureRegion, this.getVertexBufferObjectManager());
  2. m_BlurBlobParticleSystem.addParticleInitializer(new BlendFunctionParticleInitializer<Sprite>(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE));
  3. m_BlurBlobParticleSystem.addParticleInitializer(new AlphaParticleInitializer<Sprite>(0.1f));
  4. m_BlurBlobParticleSystem.addParticleModifier( new AlphaParticleModifier<Sprite>(4.5f, 5.0f, 0.1f, 0.0f) );
  5. m_BlurBlobParticleSystem.addParticleModifier(new ExpireParticleModifier<Sprite>(5.0f));
  6. m_BlurBlobParticleSystem.addParticleInitializer( new VelocityParticleInitializer<Sprite>( -150.0f, 150.0f, -150.0f, 150.0f));
  7.  
  8. m_StarParticleSystem = new SpriteParticleSystem(new PointParticleEmitter(176.0f, 336.0f), 3, 10, 50, m_StarTextureRegion, this.getVertexBufferObjectManager());
  9. m_StarParticleSystem.addParticleInitializer(new BlendFunctionParticleInitializer<Sprite>(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE));
  10. m_StarParticleSystem.addParticleInitializer(new AlphaParticleInitializer<Sprite>(1.0f));
  11. m_StarParticleSystem.addParticleModifier( new AlphaParticleModifier<Sprite>(4.5f, 5.0f, 1.0f, 0.0f) );
  12. m_StarParticleSystem.addParticleModifier(new ExpireParticleModifier<Sprite>(5.0f));
  13. m_StarParticleSystem.addParticleInitializer( new VelocityParticleInitializer<Sprite>( -150.0f, 150.0f, -150.0f, 150.0f));
  14.  
  15. m_Scene.attachChild( m_BlurBlobParticleSystem );
  16. m_Scene.attachChild( m_StarParticleSystem );
  17.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4

The bug was found with the star particle system. After a while (I believe once it starts reusing particles to spawn new ones), the star particles are not getting set to 1.0 alpha when they spawn regardless of the alpha initializer on them. They then seem to remain near or at zero alpha from the previous particles setting before it was respawned. If I change the initializer to 0.9 alpha, then it works fine. It's only 1.0 that it can't set them too.

It looks like an alpha issue was addressed in the codebase about 5 days ago, but it appears this still remains.

Cheers
Bunkins
 
Posts: 3
Joined: Sun Feb 26, 2012 4:28 pm

Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest