Categories: Unity, C #, VS2015
Date Created: 2016-05-02 I. INTRODUCTION
The previous section has covered two ways to create particle effects in Unity 5.x (mode 1, Mode 2).
In this section we mainly study the basic concepts and usage of the 2nd approach.
The new version of the Particle system generator (particle system) provided by Unity 5.x is also known as the shuriken particle system, which uses modular management, a personalized particle module, and a particle curve editor, making it easy for users to create a variety of colorful and complex particle effects.
1. Particle System Viewer
Particle System viewer (particle system Inspector) displays one particle system at a time (the currently selected particle system), as shown in:
By using modules, individual particle systems can display a variety of complex behaviors.
They can also be extended by grouping into particle effects (particle effects).
2. Particle System Editor
Clicking the Open Editor ... button in the viewer opens the Particle Editor window (particle System Editor), which is used to display all particle systems under the same root in the scene tree.
The Particle System Editor (Particle System Editor) window allows you to toggle between show all and display selected (show Selected). Show All (Show:all) renders the entire particle effect. Show selected (show:selected) renders only the selected particle system.
The selected particle system is highlighted in the particle editor with a blue border and blue in the Hierarchy view (Hierarchy). Click the icon in the upper-left corner of the particle system to change the selection in the Hierarchy view (Hierarchy view) and the particle editor (particle editor). If you want to choose more, hold down the CTRL key and click Select with the mouse.
3. Scene View editing
When you create and edit a particle system, you can modify it either directly with the viewer (Inspector) or by using the Extended Particle System Editor window. In either case, the changes are reflected in the scene view (Sceneview).
In the scene view, there is also a preview panel, which can be used to play (play), pause (pause), stop (stop), and clear play time (scrubbing playback times) under Edit mode ) to control the playback of the currently selected particle effect:
When you drag the Playback time tab, you can perform the clear play time (scrubbing play back times) action. All playback (Playback) controls have a default shortcut key, and you can also customize the shortcut keys in the Preferences window (Preferences windows).
4. Curve Editor
In the viewer view, you can also edit the particle effect directly using the particle system Curve editor.
Many of the properties of the particle system module in the viewer describe the case where the value varies with time. The change can be described by the Minmax curve (Minmax Curves). These time animation properties (such as size and speed) have a drop-down menu on the right side. For example, click the drop-down menu at the far right of Start Lifetime to select:
The meaning is as follows:
(1) constant--constants
The property value does not change over time.
(2) Random between two gradients--randomly selected values in two gradients
The property value changes over time with a gradient (RGBA) and is randomly selected in the two values specified by the gradient editor.
(3) curve--curve
The attribute value varies with time according to the curve specified in the Curve editor (Curve editor).
When "Curve" is selected, the Minmax curve is immediately displayed in the particle System Curves:
The randomly generated values in the curve are between the minimum and maximum curves, and the property values change along the resulting curve over time. For example, you can use the upper particle system Curve editor (particle system Curves) to change the random value to the following form:
The x-axis in the editor represents the value specified by the time from 0 to the duration (Duration) property, and the y-axis represents the value of the animation property corresponding to each point in time. The y-axis range can be adjusted in the Number field in the upper-right corner of the editor.
You can also click on different curves in the editor (above) to see how the particle effect changes in the scene.
Note that "-" will delete the currently selected curve, and "+" will optimize the curve (i.e. use up to 3 keys to turn the curve into a parametric curve).
5. Velocity over Lifetime and limit velocity over Lifetime
If you tick "velocity over Lifetime" and "Limit Velocity over Lifetime" (see):
You can also change these parameters in a more intuitive way with drag-and-drop changes (note the changes to the particle effect in the preview interface when changing parameters), such as:
6. Color and linear gradient
For properties that handle color, the particle system (particle systems) uses the color and linear gradient editor (color and Gradient editor) to let you set the value of the property. It works the same way as the Curve editor.
Color-based properties have a drop-down menu on the right, which you can choose from the menu:
- Linear gradient (Gradient):
- Randomly (random between two gradients) selects values in two linear gradients: the gradient (RGBA) changes over time and is randomly selected in the two values specified by the gradient editor.
The gradient (RGBA) changes over time and can be edited in the gradient editor.
The linear gradient editor (Gradient editor) describes the extent to which the gradient changes over time. It draws the color (RGB space, described by the tag at the bottom) and Alpha (described by the tag at the top).
You can add a new marker to the Alpha value by tapping the area near the top of the rectangle to add a new marker to the color (color) by tapping the area near the bottom. These markers can be dragged directly along the timeline.
If you select an alpha tag, you can edit the value of the tag by dragging the alpha value.
If you select a color tag, you can double-click the marker or click the color bar to modify the color.
To delete a marker, simply drag it outside the screen. Second, particle system module
The particle system initially only enables a few modules by default. Adding or removing modules can change the behavior of the particle system.
You can add a new module by pressing the (+) sign in the upper-right corner of the particle System viewer (particle system Inspector). This pops up the selection menu as shown in the menu and selects the module you wish to enable.
Note that because the "Show all Modules" option is checked in this, it will display all the modules (all allowed), so it is no longer possible to tick a module. If you only want to select one or more modules (only allow the selected module to work), uncheck "Show all Modules" and then tick the corresponding module.
The following describes the meaning of each module that the particle system displays in the viewer view.
1. Initialization module (Particaal System)
The module is always present and cannot be deleted or disabled.
Duration: Duration. The duration of particles emitted by particle systems (particle system).
Looping: Loop. Whether the particle system (particle systems) loops.
Prewarm: Preheat. Can only preheat the circulatory system, which means that particle systems (particle) emit particles at the beginning of the game, as if a period of particles has been emitted.
Start delay: initial delay. The delay, in seconds, that waits before the particle system (particle systems) emits particles. Note that the pre-heated circulatory system cannot use the initial delay.
Start Lifetime: initial life. Particle survival time, in seconds (see Minmaxcurve).
Start speed: initial velocity. The speed at which particles are emitted (see Minmaxcurve).
Start Size: initial sizes. The size of the particle when it is emitted (see Minmaxcurve).
Start Rotation: initial rotation. The rotation of the particle when it is emitted (see Minmaxcurve).
Start color: the initial color. The color of the particle when it is emitted (see minmaxgradient).
Gravity Modifier: Gravity modifier. The gravitational effects of particles during survival.
Inherit Velocity: Inheritance speed. Factors that control particle rate should inherit the transformation of the particle system (particle system) (for particle systems in motion).
Simulation Space: Analog spaces. Simulates a particle system in a local coordinate system or in the world's coordinate systems (particle system).
Play on awake: play when awakened. If enabled, the particle system (particle systems) automatically starts playing when it is created.
Max particles: Maximum number of particles. The maximum number of particles that the particle system (particle systems) can emit.
2. Transmitting module (emission)
Controls the rate at which particles are emitted, allowing the generation of a large number of particles at some point (particle system). Useful when exploding, you need to create a lot of particles at once.
Rate: The number of particles emitted per unit time, in seconds, or unit distance (Distance) (per metre) (see Minmaxcurve).
Burst (bursts) (time only): Adds a particle eruption that occurs during the particle system's existence.
Time and number of particles: Specifies the time (in seconds) to emit the specified number of particles. Use "+" and "-" to adjust the number of outbreaks.
3 Module (SHAPE)
Shape: Define the shapes of the emitter, click the drop-down box on the right to select: Sphere (Sphere), hemisphere (hemishpere), Cone (Cone), Cube (Box), grid (mesh). The initial force can be applied along the surface normal or in a random direction.
(1) sphere (Sphere)
Radius of the radius (radius) sphere. (You can also manipulate the handles in scene view).
emitted from the shell (Emit from the shell) from the sphere shell. If this key is disabled, the particles are emitted from within the sphere.
Random direction (randomly Direction) particles are emitted in a random direction or along the normal direction of the sphere's surface?
(2) hemispherical body (hemisphere)
Radius of the radius (radius) hemisphere. (You can also manipulate the handles in scene view).
emitted from the shell (Emit from the shell) from the dome shell. If this is disabled, the particles are emitted from within the hemisphere.
Random direction (randomly Direction) particles are emitted in a random direction or along the normal direction of the hemispherical body surface?
(3) cone (Cone)
Angle (Angle) The angle of the cone. If the angle is 0, the particles will be emitted in one direction. (You can also manipulate the handles in scene view).
The radius of the radius (RADIUS) emitter point. If the value is close to 0, it will be emitted from one point. If the value exceeds 0, a hat-shaped cone is created, and the particles are emitted from a disk rather than a point. (You can also manipulate the handles in scene view).
The length (length) of the emitted quantity. Available only when emitted from an internal (Volume) or internal shell (Volume shell). (You can also manipulate the handles in scene view).
The launch position (Emit from) determines where the emission is from. Possible values are bottom (base), bottom shell (base shell), internal (Volume), and inner shell (Volume shell).
Random direction (randomly Direction) particles are emitted in a random direction or along a conical direction?
(4) cube (BOX)
Cube x-axis (Box x) cube x-axis scaling. (You can also manipulate the handles in scene view).
The scale of the y-axis of the cube y-axis (Box y). (You can also manipulate the handles in scene view).
The scale of the z axis of the cube z-axis (Box z). (You can also manipulate the handles in scene view).
are random Direction particles emitted in random directions or along the Z-axis of the cube?
(5) grid (mesh)
Type particles can be emitted from vertices (Vertex), Edges (edge), or polygons (Triangle).
Mesh Select Mesh – as the emitter shape.
Random direction (randomly Direction) particles are emitted in a random direction or along a grid surface?
4. Time-to-live speed module (volocity over Lifetime)
The rate at which particles are animated directly. It is primarily used for particles with complex physical properties, but this property only demonstrates simple visual behavior (such as flapping smoke and temperature drops), with little interaction with the physical world.
XYZ: Controls the motion of a particle using a curve constant value or a random value between the curves. See Minmaxcurve.
Space: Spaces.
Local/world: Local/world. Whether the speed value is a local coordinate system or a value in a world coordinate system.
5, Survival time limit speed module (limit elocity over Lifetime)
Basically used to simulate resistance. If certain thresholds are exceeded, the rate is suppressed or fixed. Can be configured on a per-axis or per-vector length basis.
Separate axis: separate shaft. Used to set each axis control.
Speed: velocity. Specify the magnitude as a constant or by a curve that restricts all axis rates. See Minmaxcurve.
Dampen: damping. (0-1) The value between the control should slow down the amplitude of the rate. For example, a value of 0.5 slows the rate of exceeding by 50%.
6, survival time of the Force module
XYZ uses a curve constant value or a random value between curves to control the force acting on the particle. See Minmaxcurve.
Space (local)/world: The speed value is the value in the local or world coordinate system.
Randomization (Randomize) randomly forces each frame acting on a particle.
7, the survival time of the color module
Color controls the color of each particle during its survival. If some particles live shorter than other particles, they will move faster. Use a constant color, two-color randomization, animate a color with a gradient, or specify a random color with two gradients (see gradients). Notice that the color is multiplied by the value in the initial color (Start color) property – If the initial color is black, the color over Lifetime does not affect the particle.
8. Color Speed Module
Animates particle color based on particle velocity. Remap the speed within the defined range to the color.
The color (color) that is used to remap the speed. Use gradients to change colors. See Minmaxgradient.
Speed range defines the minimum and maximum values for the speed range that is used to remap the speed to the color.
10, the size of the survival time module
Size controls the size of each particle during its survival. With a fixed size, use a curve to animate the size or specify a random size using two curves. See Minmaxcurve.
11, Size Speed module
Size is used to remap the size of the speed. Use curves for different sizes. See Minmaxcurve.
Speed range defines the minimum and maximum values for the speed range that is used to remap the speed to the size.
12, the survival time of the rotation module
The value is specified in degrees.
Angular velocity (Angular velocity) controls the rotational speed of each particle during its survival. With a fixed rotational speed, use a curve to animate the rotational speed or specify a random rotation speed using two curves. See Minmaxcurve.
13. Rotational Speed Module
Angular velocity (Angular velocity) is used to remap the rotational speed of particle velocity. Use curves to change the speed of rotation. See Minmaxcurve.
The speed range defines the minimum and maximum values for the speed range, which is used to remap the speed to the rotational speed.
14. External Force module
The multiplier (Multiplier) determines the scale at which the particle is affected by the wind band (that is, the wind vector multiplied by the value).
15. Collision Module
Sets a collision for particles in the particle system (particle systems). World collisions and plane collisions are now supported. Plane collisions are very effective for simple collision detection. Set up a plane by referencing an existing transformation in the scene or by creating a new empty Game object (Gameobject) for this purpose. Another advantage of plane collisions is that particle systems with collision planes can be set as presets. World collisions are light-projected, so care must be taken to ensure good performance. However, in the case of approximate collisions, the world collision of low or medium (Medium) mass is very effective.
Common properties for any collision module (collision modules):
Plane/World (Planes/world) specifies the type of collision: Planar (Planes) refers to plane collisions, the world is a world collision.
Damping (Dampen) (0-1) when a particle collides, it will maintain this velocity ratio. A particle slows down after a collision unless it is set to 1.0.
Bounce (Bounce) (0-1) when a particle collides, it maintains the ratio of the velocity component, which is perpendicular to the collision plane.
Life is weakened (Lifetime Loss) (0-1) a reduction in the initial life cycle (Start Lifetime) after each collision. When the life cycle reaches 0, the particle dies. For example, if the particle should die on the first collision, set the property to 1.0.
Minimum kill speed (min kill velocity) particle at the minimum speed before being killed.
Send collision information (send collision Messages) determines whether to send collision information to determine whether to trigger onparticlecollision callbacks on game Objects (gameobjects) and Particlesystems.
Properties available only in flat mode (Planes modes)
Planar (Planes) planes are defined by assigning references to transformations. The transform can be any transformation in the scene and can be animated. You can use multiple planes. Note: The Y-axis is used as a planar normal.
Visualization (visualization) is used only to visualize a plane: Grid (GRID) or solid (solid).
Grids are rendered as small icons that quickly indicate the position and direction in the world.
Solid (solid) renders the plane in the scene for precise positioning of the plane.
The zoom plane (scale Plane) adjusts the visualization plane size.
Particle radius (particle radius) The particle radius assumed by the collision purpose. (therefore, particles are considered spheres.) )
Properties available only in world mode
The collision object (collides with) is used to specify the filter for the collider. Choose everything (everything) to collide with the whole world.
Collision Quality (Collision quality) The quality of world collisions.
Quality (high) all particles per frame for scene ray projection. Note: This is a CPU-intensive application that only uses 1000 (scene width) or less synchronized particles.
Medium quality (Medium) in each frame, the particle system receives a subset of the global set of particle ray projection plans (particle Raycast Budget) (see Particle ray projection plan). Particles are updated in a circular fashion, where particles that do not receive ray casts in a given frame will find and use older collisions stored in the cache. Note: Such collisions are approximate collisions, and some particles are missing, especially in the corners.
Lower quality (low) except that the particle system obtains part of the particle Ray projection plan (particle Raycast Budget) every four frames, the other is the same as the medium quality (Medium).
The voxel size (Voxel size) is used to cache the voxel density of the intersection used in the medium (Medium) and lower (low) quality settings. The voxel size is given in units of the scene. Typically, 0.5–1.0 is used (assuming metric units are used).
16, sub-emitter module
is a powerful module that generates other particle systems (particle systems) when the following particle events occur: particle generation, death, or collision.
Generation (Birth) generates another particle system when each particle in the particle system (particle systems) is produced.
Death (Birth) generates another particle system when each particle dies in the particle system (particle systems).
Collision (collision) generates another particle system when each particle in the particle system (particle systems) collides.
Important: Collisions are required using the Collision Module (Collision module). See Collision Modules (Collision module).
17. Texture Layer Animation Module
Animate UV coordinates during particle survival. Animation frames are displayed as a grid, or each row in the layer is a separate animation. A frame can be animated with a curve or a random frame between two curves. Animation speed is defined as "period (Cycles)". Important: The texture used for the animation is the texture used by the material found in the Renderer (Renderer) module.
Tiling (Tiles) defines the tiling of textures.
Animation (Animation) specifies the type of animation: an entire layer (Whole Sheet) or a single row.
The entire layer (Whole Sheet) uses the entire layer for UV animation.
- The timeframe (frame over time) controls its UV animation frames on the entire layer while each particle is alive. Use constants to animate frames using curves or to specify random frames using two curves. See Minmaxcurve.
- Single row uses a row of texture layers for UV animation.
- Random row If selected, the starting line is random, and if unchecked, you can specify the row exponent (first behavior 0).
- The timeframe (frame over time) controls its UV animation frames within the specified line during each particle's survival. Use constants to animate frames using curves or to specify random frames using two curves. See Minmaxcurve.
- Period (Cycles) specifies the animation speed.
18. Renderer Module
The Renderer module displays the properties of the Particlesystemrenderer component.
Note that even if the game object (Gameobject) has a particlesystemrenderer component, its properties can only be displayed here. When you delete/Add this module, you are actually adding or removing the particlesystemrenderer component.
Render mode selects one of the following particle rendering modes.
The Billboard (Billboard) keeps the particles facing the camera at all times.
Stretch billboard (stretched Billboard) stretches particles using the following parameters.
The camera scale determines the degree of camera speed that is taken into account when stretching particles.
L Speed scaling (velocity scale) determines its length by comparing particle velocity.
The length scale is determined by comparing the width of the particles to the length.
The horizontal billboard (horizontal Billboard) aligns the particles to the XZ plane.
The vertical billboard (Vertical Billboard) aligns the particles to the Y axis when facing the camera.
The mesh uses a mesh rather than a quad to render particles.
-The mesh reference used by the mesh to render the particles.
Normal Direction values 0 to 1 determine the angle (0) of the normals to the camera and the angle (1) that deviates from the center of the view.
Material (Material) a material used by a billboard or grid particle.
Sort mode the particle drawing order can be arranged by distance, first generation, or late generation.
The sort correction (sorting fudge) uses this item to influence the drawing order. Particle systems with smaller sort correction values are more likely to be placed in the last drawing, so they appear in front of other transparent objects, including other particles.
Will cast shadow (cast Shadows) particles cast shadows? This is determined by the material.
Will accept shadow (receive Shadows) particles accept shadows? This is determined by the material.
Maximum particle size (max particle size) Sets the maximum size relative to the window size. Valid values: 0-1. Description of related properties of particle generation
When trying to perform different particle effects, the properties of particles such as size, energy, emission, and velocity make the particle system a distinct personality. For example, a small size can simulate a cocoon fire bug or a star in the sky, which can simulate dust in an old building when it is larger.
The energy and emission properties control how long a particle will remain on the screen and how many particles can be displayed at a time. For example, rockets will have higher emission properties to simulate smoke, while higher emergy properties can simulate the slow diffusion of smoke in the air.
The Velocity property controls the movement of particles. The velocity values can be altered by scripting to produce better results, or if you want to simulate a continuous effect like wind, you can set the X and z values of the Velocity property, which results in a similar blow-off effect of the particles. Iv. things to note when using particle generators
Use the effect of a large number of particles sparingly. The higher the number of particles, the higher the hardware requirements.
The Emit property is used in conjunction with the Auto destruct (auto-Destroy) attribute in the particle animator. The script allows the emitter to stop emitting particles, and the auto-destroy function automatically destroys the particle system and the game objects it binds to.
"Unity" 9.3 Particle System Builder detailed