Page 1 of 1

Particlesystem

PostPosted: Wed Dec 12, 2007 6:42 am
by Gero
Hi,

just wanted to ask if there is any documentation on the particle system.
The Icecube project has only the built-in snow effect.
There is a ParticleSystem class and a IParticleEmitter interface.
PointEmitter implements this and at least there are some processor classes.
Must I create a ParticleSystem class only with a special emitter? Is this sufficient?

Re: Particlesystem

PostPosted: Wed Dec 12, 2007 7:47 am
by Gero
Ok I have it.
I think there is a bug in BrumeParticleSystem.cs:
The static functions AddColor/RemoveColor throw System.ArgumentException
when I set the ColorNoise property.
It should be made sure that the values are in between 0 and 255.

Re: Particlesystem

PostPosted: Wed Dec 12, 2007 9:10 am
by Gero
I don't know why but the particles are stumbleing a lot and don't move smooth :(
My code: ('this' is an BrumeLightedObject )
Code: Select all
        public void Init()
        {
            FxEmitter = new BrumeParticlePointEmitter(this, BrumeEParticleEmissionMode.Manual, this.Pos, this.Dir, 1.0f, 0.1f);
            FxSystem = new BrumeParticleSystem(Singleton.Instance, Name + " particlefx explode", null, 0, 0, 2.0f, 1.0f, System.Drawing.Color.Blue, FxEmitter);
        }
        public void DoFX()
        {
            FxEmitter.Center = Pos;
            FxEmitter.DirectionNoise = 1.0f;
            FxEmitter.EmissionForce = 0.1f;
           
            //FxSystem.ColorNoise = System.Drawing.Color.White; // doesn't work, throws exception on rendering
            FxSystem.MaxParticles = 50;
            FxSystem.LifeTime = 1.0f;
            FxSystem.Scale = 0.5f;
           
            FxSystem.AddParticle(); // adds 50 particles to the scene
        }

Re: Particlesystem

PostPosted: Wed Dec 12, 2007 8:21 pm
by Silmaryls
Hi Gero,

I will have no time to test that until this WE but can you just take a look at our demo ?
There are three samples made by MoDDiB in Game.cs->TestParticles() so you can compare your implementation with that.
There is actually no documentation on the particle system :roll:

Silmaryls

Re: Particlesystem

PostPosted: Thu Dec 13, 2007 8:42 am
by Gero
Thank you. I just got it to do what it shall do. :)

This code create a simple explosion like a firework rocket.
'this' is a BrumeLightedObject an Singleton.Instance is the Brume.Brume object
Code: Select all
            BrumeParticlePointEmitter FxEmitter = new BrumeParticlePointEmitter(this, BrumeEParticleEmissionMode.Once, this.Pos, new BrumeVector(0, 1, 0), 0.00005f, 0.000001f);
            BrumeParticleSystem FxSystem = new BrumeParticleSystem(Singleton.Instance, Name + " particlefx explode", Singleton.Instance.GetTexture("particle.tga"), 50, 50, 300.0f, 100.0f, System.Drawing.Color.Blue, FxEmitter);

            BrumeParticleAcceleratorProcessor FxAccelerator = new BrumeParticleAcceleratorProcessor(-0.00003f, -0.000005f);
            BrumeParticleScaleProcessor FxScale = new BrumeParticleScaleProcessor(0.5f, 0.0f);
            BrumeParticleFadeProcessor FxFade = new BrumeParticleFadeProcessor(1.0f, 0.0f);

            FxSystem.AddProcessor(FxFade);
            FxSystem.AddProcessor(FxScale);
            FxSystem.AddProcessor(FxAccelerator);

            FxEmitter.Center = Pos;
            FxEmitter.DirectionNoise = 2.0f;
            FxEmitter.EmissionForce = 0.01f;
            // complete random colors
            FxSystem.Color = System.Drawing.Color.FromArgb(127, 127, 127); 
            FxSystem.ColorNoise = System.Drawing.Color.FromArgb(127, 127, 127);

            FxSystem.Scale = 0.5f;


Nevertheless I would like to point out that the ParticleSystem class needs a manual Start() and Stop() function urgently.