Pages

Saturday, July 9, 2011

Particle system in unity3d

Particle Systems

Particles are essentially 2D images rendered in 3D space. They are primarily used for effects such as smoke, fire, water droplets, or leaves.You can use a Particle Emitter and Renderer together if you want static particles. Particle Systems in Unity are used to make clouds of smoke, steam, fire and other atmospheric effects. Particle Systems work by using one or two Textures & drawing them many times, creating a chaotic effect.
A Particle System is made up of three separate Components :
1)  Particle Emitter
2)  Particle Animator
3)  Particle Renderer

Ellipsoid Particle Emitter

The Ellipsoid Particle Emitter spawns particles inside a sphere. Use the Ellipsoid property below to scale & stretch the sphere.


The Ellipsoid Particle Emitter Inspector

Properties



EmitIf enabled, the emitter will emit particles.
Min SizeThe minimum size each particle can be at the time when it is spawned.
Max SizeThe maximum size each particle can be at the time when it is spawned.
Min EnergyThe minimum lifetime of each particle, measured in seconds.
Max EnergyThe maximum lifetime of each particle, measured in seconds.
Min EmissionThe minimum number of particles that will be spawned every second.
Max EmissionThe maximum number of particles that will be spawned every second.
World VelocityThe starting speed of particles in world space, along X, Y, and Z.
Local VelocityThe starting speed of particles along X, Y, and Z, measured in the object's orientation.
Rnd VelocityA random speed along X, Y, and Z that is added to the velocity.
Emitter Velocity ScaleThe amount of the emitter's speed that the particles inherit.
Tangent VelocityThe starting speed of particles along X, Y, and Z, across the Emitter's surface.
Simulate In World SpaceIf enabled, the particles don't move when the emitter moves. If false, when you move the emitter, the particles follow it around.
One ShotIf enabled, the particle numbers specified by min & max emission is spawned all at once. If disabled, the particles are generated in a long stream.
EllipsoidScale of the sphere along X, Y, and Z that the particles are spawned inside.
MinEmitterRangeDetermines an empty area in the center of the sphere - use this to make particles appear on the edge of the sphere.
How To Add It in your Scene : 
Steps : 
1) add a Particle System
2) Components->Particles->Particle System.




Particle Animator

Particle Animators move your particles over time, you use them to apply wind, drag & color cycling to your particle systems.

The Particle Animator Inspector

Properties



Does Animate ColorIf enabled, particles cycle their color over their lifetime.
Color AnimationThe 5 colors particles go through. All particles cycle over this - if some have a shorter life span than others, they will animate faster.
World Rotation AxisAn optional world-space axis the particles rotate around. Use this to make advanced spell effects or give caustic bubbles some life.
Local Rotation AxisAn optional local-space axis the particles rotate around. Use this to make advanced spell effects or give caustic bubbles some life.
Size GrowUse this to make particles grow in size over their lifetime. As randomized forces will spread your particles out, it is often nice to make them grow in size so they don't fall apart. Use this to make smoke rise upwards, to simulate wind, etc.
Rnd ForceA random force added to particles every frame. Use this to make smoke become more alive.
ForceThe force being applied every frame to the particles, measure relative to the world.
DampingHow much particles are slowed every frame. A value of 1 gives no damping, while less makes them slow down.
AutodestructIf enabled, the GameObject attached to the Particle Animator will be destroyed when all particles disappear.

Particle Renderer

The Particle Renderer renders the Particle System on screen.

The Particle Renderer Inspector

Properties



MaterialsReference to a list of Materials that will be displayed in the position of each individual particle.
Camera Velocity ScaleThe amount of stretching that is applied to the Particles based on Camera movement.
Stretch ParticlesDetermines how the particles are rendered.
BillboardThe particles are rendered as if facing the camera.
StretchedThe particles are facing the direction they are moving.
SortedBillboardThe particles are sorted by depth. Use this when using a blending material.
VerticalBillboardAll particles are aligned flat along the X/Z axes.
HorizontalBillboardAll particles are aligned flat along the X/Y axes.
Length ScaleIf Stretch Particles is set to Stretched, this value determines how long the particles are in their direction of motion.
Velocity ScaleIf Stretch Particles is set to Stretched, this value determines the rate at which particles will be stretched, based on their movement speed.
UV AnimationIf either of these are set, the UV coordinates of the particles will be generated for use with a tile animated texture. See the section on Animated Textures below.
X TileNumber of frames located across the X axis.
Y TileNumber of frames located across the Y axis.
CyclesHow many times to loop the animation sequence.



--
Vivek Shah 
Game Developer in Unity3d

0 comments:

Post a Comment