Chapter 10 notice board and particle Part 2 of book notes in Pro Ogre 3D Programming

Source: Internet
Author: User
Tags emit

Particle System
The particle system in ogre can be described by scripts or code. The particle system defined by the particle script is actually a template, so the particle system defined by it can be easily reused in the program.
Particle systems and scenarios
The particle system will be mounted to the scene node. Therefore, the translation, scaling, and rotation of the node will be associated with the particle system, affecting the direction of the particle reflection.
The particle will be emitted into the world space, which means that when the scene moves, it will be implicated in the transmitter, but the particles that have been emitted will not be affected. If these particles are required to be affected by the knots, they can be transmitted to the local space. The particle system cannot emit particles without limit. It has a quota (quota ). Once the limit is reached, the particle system will not emit particles until the existing particles die. The default quota is 10.
Particle system constraints (Bounds)
The dynamic characteristics of particle systems mean that their binning boxes must be periodically recalculated. By default, ogre stops after 10 seconds.
Update the BIND box. You can change the default behavior by using particle system: setBoundsAutoUpdated (bool autoUpdate, Real stopIn = 0.0f. The stopIn parameter indicates how long the ogre will stop updating. If there is a particle system, you can know that its growth will not exceed a certain range, you can use the particle system: setBounds () to set the size of the bound box in advance. This is highly efficient. If you cannot determine the growth of the particle system in advance, you can first set an initial size with setBounds () and use setBoundsAutoUpdated () to update it after a period of time.
Particle System update
For particle system updates, ogre adopts a moderate heuristic strategy. For example, when the particle system is not within the cone, ogre will still update the particle system, considering that the particle system may re-enter the cone soon. This avoids visual discord in this situation. But for performance consideration, after the particle system exits the cone for a period of time, the particle does stop updating. This will encounter the above problem: the frozen particle system suddenly re-enters the cone. Ogre provides a so-called
The "fast-forward" mechanism allows the particle system to quickly surpass the current state after being frozen. This feature can also be used in the just-created particle system to make their state a little ahead of time. The method used is the particle system: fastForward ();
Particle System sorting
It indicates that ogre sorts particles based on the distance between the camera and the camera. This may affect performance, but sometimes it has to be used. In smoke
In this example, the result of not sorting is that the flame is still clearly seen from the top of the smoke, and the flame is blurred by smoke after sorting. Obviously, the latter is more authentic.
Transmitter
The point transmitter emits particles from a single point in the space. The box transmitter can emit particles from any position in the regular Quartet. Cylinder defines a cylinder. Ellipsoid defines an elliptical body. Hollow elipsoid is only the shell of the elliptical body. The ring emits only the side of the plane ring. The speed and direction of the emitted particle can also be configured. The particle system will be mounted to the scene node, so the transmitter has a relative position with the parent node. Particles generally do not emit along a straight line. They are emitted in a cone in the direction of the transmitter. They are defined by an angle parameter. If you want to launch along a straight line, angle should be set to 0. If you want to launch in the whole direction, angle is set to 180, and 90 indicates that it will be randomly transmitted in the hemisphere of the direction vector.
The emission rate is represented by the number of particles per second. The transmitter can launch at a specific rate or use a random value in a range. Particle availability
With a fixed life cycle, it can also be randomly specified from a range. The same is true for colors, fixed values, and random values. You can also provide custom transmitters in the form of plug-ins during motion, which is the easiest way to expand the ogre particle system.
Influencer
Once a particle is transmitted to the world, it can be used to influence the particle's motion path and life cycle.
LinearForce: adds a force to a particle. A force is a vector with a direction and a size (modulus ).
ColourFader: used to change the color of a particle. Indicates the number of dropped values per second, which is an absolute value.
ColorFader2: similar to ColourFader, but a particle's life can be converted to another fading function when it reaches a stage of its life.
ColourInterpolator: similar to the preceding two, but it can have up to six stages. The time and color of each stage can be defined respectively, and then interpolation is performed between different stages, this is a bit like the idea of key frame animation.
Scaler: Used to scale the particle size. A scaling factor is defined using the time function.
Rotator: rotates the texture of a particle by a random number or random rate, which is defined within a certain range.
ColourImage: captures the color from the image from left to right. It is suitable for one-dimensional textures.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.