Quickshift
Quickshift
November 22, 2009, 04:59:07 pm
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Test Version 0.2 is now released!
 
  Home Help Search Staff List Login Register  

[How - To] Creating Particle Effects


Pages: [1]
  Print  
Author Topic: [How - To] Creating Particle Effects  (Read 103 times)
Monty
Jr. Member
**
Posts: 85


Nevar mess with the sun.


View Profile
« on: August 20, 2007, 03:26:16 pm »

Didn't know where to put it so i thought this section would do.
Anyways.
I'm going to give you a run through of particles and emmiters.
Here i have the trail effects for my flarebow (A crossbow that shoots illuminating bolts while doing no damage, useful for night/dark maps).
Code:
// Crossbow bolt projectile particles
And the emmiter for the particles
datablock ParticleData(FlarebowBoltParticle)
{
   textureName          = "~/data/shapes/particles/smoke";
   dragCoefficient     = 0.0;
   gravityCoefficient   = -0.3;   // rises somewhat slowly
   inheritedVelFactor   = 0.0;
   lifetimeMS           = 1500;
   lifetimeVarianceMS   = 10;   // ...more or less
   useInvAlpha = false;
   spinRandomMin = -30.0;
   spinRandomMax = 30.0;

   colors[0]     = "0.1 0.1 0.1 1.0";
   colors[1]     = "0.1 0.1 0.1 1.0";
   colors[2]     = "0.1 0.1 0.1 0";

   sizes[0]      = 0.15;
   sizes[1]      = 0.20;
   sizes[2]      = 0.25;

   times[0]      = 0.0;
   times[1]      = 0.3;
   times[2]      = 1.0;
};
And its relevant emmiter.
Code:
datablock ParticleEmitterData(FlarebowBoltEmitter)
{
   ejectionPeriodMS = 2;
   periodVarianceMS = 0;

   ejectionVelocity = 0.0;
   velocityVariance = 0.0;

   thetaMin         = 0.0;
   thetaMax         = 90.0; 

   particles = FlarebowBoltParticle;
};

Take a look at this snippet of code.
You'll notice the numbers in []'s. These are the particles "states". These are the states colours, at state 0 it'll be a really dark gray, it'll be the same for state 1 and in state 2 it'll be invisible. I think the particle slides smoothly between the states, therefor between states 1 and 2 it gets less and less visible until you cannot see it.
Code:
   colors[0]     = "0.1 0.1 0.1 1.0";
   colors[1]     = "0.1 0.1 0.1 1.0";
   colors[2]     = "0.1 0.1 0.1 0";
Beneath is the other two state varibles, the time and sizes.
The time states set the time in which a particle goes into the state, state 0 should be 0.0 or bad things might happen, i haven't tried it myself.
The state size is how big the particle is at that state, as you can see the state sizes go up through the states, making the particle slowly get bigger between the states.
Code:
   sizes[0]      = 0.15;
   sizes[1]      = 0.20;
   sizes[2]      = 0.25;

   times[0]      = 0.0;
   times[1]      = 0.3;
   times[2]      = 1.0;
A biggie in particles is the life time of the particle, the life time is measured in milliseconds so 1000 would be a second. The life time variance adds or takes a random number between 0 and the number set, so the life time of these particles would be 1500-0 to 10 or 1500+0 to 10.
Code:
   lifetimeMS           = 1500;
   lifetimeVarianceMS   = 10;   // ...more or less
Here is a little control over how the particle spins, this i think the speed of the particle spinning, a negative number would make the particle spin anti/counterclockwise.
Code:
   spinRandomMin = -30.0;
   spinRandomMax = 30.0;
This bit of code makes the particle have "gravity" effects. A positive number makes the particle fall and a negative one makes the particle rise.
Code:
   gravityCoefficient   = -0.3;   // rises slowly
This concludes my particles run through, i might add more later but i can't think of anything else to put in.
« Last Edit: August 22, 2007, 04:04:10 am by Monty » Report Spam   Logged


Pages: [1]
  Print  
 
Jump to:  

Online MMORPG / MPOG Games Top MMORPG / MPOG Sites
[Show/Hide MC Radio]

Copyright © Quickshift Games 2007. All rights reserved.
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2006, Simple Machines LLC
ServerBeach Coupon