This project is read-only.

unreleased 1.4 version



Particle systems are created using a 'Particle Effect'. For the particle effect to create particles it needs a Emitter. Currently there is a bunch of diferent type of emitters in Nine, that can be used to in many cases. The emitter also affects the initial properties of each particle, such as speed, position, color(+alpha) and size. It handles how many particles that are emitted when you trigger it, how many it emit per second, particles lifespan. You can add Controllers to handle the look after the particle have been released, for example I can make it speed down towards the end. You can change size, color and rotation also you can even apply different types of forces, like absorbation to a point in 3D space. If you don't like the way it is renderd, you can change the particle type. There are 3 type of particles Billboard, Constrained Billboard and Constrained Billboard Up. Constrained billboards always travel along the moving direction, this make it easy to render effects such as rain or snow. Soft particles are when drawing the particle, each pixel of the particle is compared against the current depth buffer to eliminate the intersection artifact between the particle geometry and world geometry.

Point Emitter; emit particles from a point in 3D Space.
Box Emitter; emit particles within a box in 3D Space.
Sphere Emitter; emit particles within the shell in 3D Space.
Cylinder Emitter;
Line Emitter; emit particles from a list of lines in 3D Space.
Bone Emitter; emit particles from a model bone collection in 3D Space.



Xaml Scene





Code Example


// Drawing Context holds alot of information like camera, render time and much more
DrawingContext drawingContext;
// Particle Effect our Effect
ParticleEffect Effect;

// This is used to create a particle from code
protected override void LoadContent()
        // ...
        drawingContext = new DrawingContext(GraphicsDevice);
        drawingContext.Camera = new FreeCamera(GraphicsDevice);

        // Load from an xaml
        Effect = Content.Load<ParticleEffect>("galaxy");

        // Or you can create a particle from code, if thats what you want
        ParticleEmitter Particle = new PointEmitter()
                Emission = 50,
                Duration = new Nine.Range<float>() { Min = 1.5f, Max = 3.0f },
                Speed = new Nine.Range<float>() { Min = 4.0f, Max = 5.0f },
                Size = new Nine.Range<float>() { Min = 0.5f, Max = 1.0f },
                Spread = MathHelper.ToRadians(15),

        Effect = new ParticleEffect(GraphicsDevice)
                Texture = Content.Load<Texture2D>("fire"),
                Emitter = Particle, // Apply the emitter

        SizeController SizeController = new SizeController()
                EndSize = new Nine.Range<float>() { Min = 4.0f, Max = 5.0f },

        SpeedController SpeedController = new SpeedController()
                EndSpeed = new Nine.Range<float>() { Min = 0.0f, Max = 0.0f },

        Effect.Controllers.Add(new FadeController());

// Your Update function
protected override void Update(GameTime gameTime)
        // ...

// Your Draw/Render Function
protected override void Draw(GameTime gameTime)
        // ...
        Effect.Draw(drawingContext, null);

Last edited Aug 16, 2012 at 10:19 PM by ChFlashER, version 6


No comments yet.