Particlesystem

All about the core api and animation, input, sound, effect, collision and physics engines.
You can also post here your feature requests.

Moderator: Brume Dev Team

Particlesystem

Postby Gero on Wed Dec 12, 2007 6:42 am

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?
User avatar
Gero
Brume user
 
Posts: 27
Joined: Thu Dec 06, 2007 10:11 pm

Re: Particlesystem

Postby Gero on Wed Dec 12, 2007 7:47 am

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.
User avatar
Gero
Brume user
 
Posts: 27
Joined: Thu Dec 06, 2007 10:11 pm

Re: Particlesystem

Postby Gero on Wed Dec 12, 2007 9:10 am

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
        }
User avatar
Gero
Brume user
 
Posts: 27
Joined: Thu Dec 06, 2007 10:11 pm

Re: Particlesystem

Postby Silmaryls on Wed Dec 12, 2007 8:21 pm

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
User avatar
Silmaryls
Brume Team Member
 
Posts: 340
Joined: Tue Feb 21, 2006 10:09 pm
Location: Paris - France

Re: Particlesystem

Postby Gero on Thu Dec 13, 2007 8:42 am

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.
User avatar
Gero
Brume user
 
Posts: 27
Joined: Thu Dec 06, 2007 10:11 pm


Return to Technical discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron