3.3 Particle particle
Particle system scripts can be used as templates to create multiple particle systems at run time
The particle system script is loaded at initialization and defaults to the '. Particle ' file under all public resource locations (root::addresourcelocation). You can load the file type of the custom extension by using the Particlesystemmanager::getsingleton (). Parseallsources method, or by Particlesystemmanager:: Getsingleton (). Parsescript parsing a single script file
Example:
Particle_system Examples/purplefountain
{
Material Examples/flare2
Quota 10000
Billboard_type oriented_self
Emitter Point
{
Emission_rate 75
}
Affector Linearforce
{
Force_vector 0-100 0
}
Affector Colourfader
{
red-0.25
}
}
A particle needs a globally unique name, such as: Examples/purplefountain. The particle system supports a number of public properties and particle emitters (creating particles), and the impact device (modifying particles). The parameters of the transmitter and the impact device depend on the type of each emitter and the impact device.
3.3.1 Property Quota
Particle systems contain a maximum number of particles, for example: quota 10000
Material
Material, example: material example/flare
Paticle_width/paticle_height
The particle width \ height in the world coordinate system. Example: Paticle_width 100.
Note: This property is fixed when billboard_type is point or perpendicular_self, Billboard_type is Oriented_comon\oriented_set\perpendicular_ Common will be scaled based on the length of the direction vector (dirction vector)
Cull_each
Whether to crop independently. By default, the particle system is clipped to the bounding box as a whole, and in some cases it can be set to true to optimize performance.
Example: Cull_each True
Renderer
Renderer. The particle system is rendered through the Particlerenderer class, which can be registered by the management class. The ogre provides the default Billboard base renderer. Other renderers can be registered via plugins, each specifying a unique name.
Example: Renderer Billboard
Sorted
Particles are not sorted by default and can be better rendered by setting to True
Local_space
By default, particles are emitted into world space and can be modified to local space by setting to True
Billboard_type
Billboard renderer Properties, default value point, usage:
Billboard_type point|oriented_common|oriented_self|perpendicular_common| Perpendicular_self
Description
Point toward camera, with camera x, Y axis (up vector), suitable for ambiguous spheres such as flash (light flare)
The Oriented_common uses common_direction as the public y-axis and rotates around the axis to face the camera. Suitable for storms, starry skies
The oriented_self uses its own direction vector as the y-axis, which is suitable for laser fire, fireworks and other bands with their respective orientation particles.
The Perpendicular_common uses common_direction as the public z-axis, and the y-axis is calculated by Z and Common_up_vector. This type of particle does not rotate, so you need to set the double-sided texture to avoid clipping on the back. Suitable for halo, slightly faster than perpendicular_self
Perpendicular_self each independent direction vector as Z-axis, suitable for stacked loops, with respective orientations (rings stack)
Common_direction <x y z>
Set the common direction vector (common direction) used by Oriented_commo, Perpendicular_common type bulletin Boards
Common_up_vector <x y z>
Set the Perpendicular_common\perpendicular_self Type bulletin board with the common vector (common up vector)
Billboard_origin <top/center/bottom_left/(center)/right>
Particle origin type, default is center
Example: Billboard_orign top_left, default: Billboard_orign Center
Billboard_rotation_type <vertex/texcoord>
Rotation type, the billboard particles are implemented by default with texture rotation as a particle rotation. However, the original corner texture is lost when this is rotated, and there is no need for texture at the corner when overlapping sampling (wrap address) or sub-textures are used. Can be resolved by setting the rotation vertex (vertex), but with a little less efficiency
Usage: Billboard_rotaion_type Vertex/texcoord
Point_rendering <true/false>
The bulletin board defaults to four-vertex quad rendering, which is set to true with hardware point rendering (speed is not significantly increased), which is controlled by the hardware rendering state and has the following limitations:
L support only point type bulletin board
L particle display is controlled by the rendered channel of the material used: (Point_size, Point_size_attenuation, Point_sprites)
L graphics card Display, maximum point size is 64-256 pixels
Example: Point_rendering True
At the same time, the material channel must turn on the point sprite rendering:
Point_sprites on
Point_size_attenuation on 0 10 0
Accurate_facing on/Off
Off is off by default, which is the opposite direction of the camera orientation. Turn on to point a single calculation of each billboard to the direction of the camera
Iteration_interval <float>
Particle system is updated by frame rate by default, can set fixed update time (seconds), 0 means update by frame rate
Example: Iteration_interval 0.01
Nonvisible_update_timeout <float>
The particle system is updated by default until it is not visible to be consistent, and you can set the time-out (in seconds) to stop the update after a period of time is not visible. The default value of 0, which indicates that it has been updated. Example: Nonvisible_update_timeout 5
Emit_emitter_quota <int>
The transmitter limit is emitted, and the emitter can be fired, which controls the number of transmitters fired by the emitter.
Emitter
Specify emitter, Usage: Emitter <type> {...}
Cases:
Emitter Box {...}
3.3.2 Transmitter Emitter
Transmitter for emitter inline directive: Emitter <type> {...}, type is emitter type, case sensitive. Ogre currently supports ' point points, box boxes, cylinder cylinders, Ellipsod ellipsoid, Hollowellipsoid Hollow ellipsoid, Ring ring, and several other types of transmitters, which can be registered via plugins with new transmitter types
3.3.3 Transmitter Public properties
Various transmitters contain the following common properties, in addition to each transmitter also contains its own special properties:
Name <name>
Emitter name, used when used with other transmitters
Position <x y z>
The position of the emitter relative to the scene node of the particle system
Direction <x y z>
Particle emission direction
Angle <degrees>
Maximum deviation from the direction angle, 180 is the omni-directional emission, the default 0 is strictly according to the emission direction emission particles
Emission_rate <num>
Number of particles emitted per second
Velocity <float>
Launch speed, world coordinate units per second
Velocity_min & Velocity_max
Transmit speed range, avoid the same launch speed, need to set the coverage velocity in pairs
Colour
Color, usage: colour <r> <g> <b> [<a>]
Colour_range_start & Colour_range_end
Color Range
Time_to_live <float>
Particle survival Time
Time_to_live_min & Time_to_live_max
Particle survival time range, paired settings
Duration <float>
Transmitter duration, default 0 indicates infinite length
Duration_min & Duration_max
Transmitter Continuous activity Time range
Repeat_delay <float>
Restart time after the transmitter is stopped (due to duration expiration)
Repeat_delay_min & Repeat_delay_max
Restart Time range
Emit_emitter <name>
Emitter: The emitter at which the specified name is emitted at the end of the current emitted particle, similar to fireworks
Example:
Particle_system Examples/fireworks
{
Material Examples/flare
Quota 1000
Emit_emitter_quota 10//Up to 10 transmitters: mainemitter particles
Transmitter transmitter.
{
Emit_emitter explosion//transmitter explosion transmitter
Emission_rate 1000
Time_to_live 3
}
The launcher that was fired
Emitter Point
{
Name explosion
Emission_rate 1000
Time_to_live 2
Duration 0.1
Repeat_delay_min 2
Repeat_delay_max 3
}
}
3.3.4 Ogre Particle Emitter
The ogre implements the following particle emitters. A new particle emitter can be implemented via plugins, for reference: Plugin_particlefx project
Point emitter
Emit particles from a single point without their own specific properties
Example: Emitter point {}
Box box/Box Launcher
Emit particles from anywhere in a three-dimensional box, additional properties:
Width <units> width, default 100,
Height <units> height, default 100
Depth <unit> high/deep, default 100
Cylingder Cylindrical Emitter
Same as box with width\height\depth three properties
ellipsoid ellipsoid Emitter
Same as box with width\height\depth three properties
Hollowellipsoid ellipsoid Emitter
Same as ellipsoid, the hollow part does not emit particles, including width\height\depth three of its own properties
Contains three properties indicating the hollow ellipsoid size: inner_width\ inner_height\ inner_depth
Ring Ring Launcher
Similar to hollowellipsoid, the difference is two-dimensional, except Width\height
Also included: Inner_width\ inner_height two properties
3.3.5 Impact Device Affector
The impact device is Affector inline: Affector <type> {...}, type is the influence of the case. Ogre currently supports the Linearforce and colourfader two types of impact converters, which can be registered with the plugin to register a new type of impact.
The impact device has no public properties
3.3.6 Ogre Particle Impact device
Ogre implements the following impact device. A new particle impact device can be implemented via plugins, for reference: Plugin_particlefx project
Linearforce Linear Force
Apply linear force vectors to all particles to change the velocity and direction of the particles to mimic gravity, wind, etc.
Property:
Force_vector <x> <y> <z>
Force vector, x y z size represents the size of the force
Force_application <add|average>
Force Superposition Method:
Add cumulative, increase force vector size per second
Average average (average on each refresh with the current speed, because the refresh rate is very high, the original speed decreases exponentially, the particles instantaneously reach the force vector speed, actually no use)
Colourfader Color
Change the color of the particle, including the following four properties:
Red <float> change color per second
Green/blue/alpha < float >
ColourFader2 Two Stage color change
Change the color of the particle, including the following properties:
RED1/GREEN1/BLUE1/ALPHA1 first Stage color change per second
State_change<float > Second Stage duration (state_change time period before particle survival end time is second stage, very bad design)
RED2/GREEN2/BLUE2/ALPHA2 Second Stage color change
Scaler Scaling
Rate<float> magnification per second
Rotator rotation
Rotate particles By default rotation texture mode
Rotation_speed_range_start/end <degress_per_sercond>
Rotation degree range per second
Rotation_range_start/end <degrees>
Initial rotation angle number range
Colourinterpolator Color Difference Value
Specify the stage time relative length and color values, specifying a maximum of 6 stages (note: Half the time of each phase is used for the previous gradient):
TIME0/1/2/3/4/5 <rate>
COLOUR0/1/2/3/4/5 <r> <g> <b> [<a>]
Example: TIME0 0.5
Colour0 1 0 0
TIME1 0.5
Colour1 0 1 0
Colourimage one-dimensional picture gradient
Gradient particle color based on one-dimensional picture, similar to Colourinterpolator:
Image <image_name>, Example: Image smokecolors.png
Deflectorplane Bounce Plane
Bounce after particle collision:
Plane_point <x y z> a point on the plane
Plane_normal <x y z> plane Normal
Bounce <rate> reflex speed ratio, 0-1.0, default 1
Directionrandomiser Random Direction
Using random amounts to influence particle motion, you can simulate snowflakes, leaves
Randomness Random amount size
Scope affects particle proportions (0-1.0), default 1.0 is all
Keep_velocity whether the speed remains constant, false by default
Ogre Reference Manual (vi) 3.3 particles