利用者:Phonybone/Archive/Modular particle system/System vs Settings
Particle System vs. Settings
Particle System is a feature of objects (each object can have multiple particle systems). It provides the context, i.e. the concrete space in which the particles exist. This includes
- Memory buffers and caches
- Data Links
- Overall coordinate system
Particle Settings define the behaviour of the particle systems using them. They define components and properties of
- Simulation
- Rendering
- Realtime Display
Settings are stored in their own library data block and dynamically linked by a particle system. This means that several particle systems can use the same type of particle effect.
Modules
The novel feature introduced here is the Particle Module, which describes a distinct part of particle functionality. They can be combined flexibly by the artist to create the desired effect. Each of the particle settings' tasks has it's own set of modules to choose from.
Focus on simulation
The majority of modules will be defined for the simulation task. Rendering and drawing will usually not require as much customization, but in some cases it can be beneficial.
|
Simulation
These modules perform a modification of particle data based on a given time-step.
Module interface:
typedef struct ParticleSimulationModule {
void (*execute)( /* Execution function */
ParticleSimulationData *sim, /* Common context (psys, parent object, etc.) */
float curtime, /* Current simulation time */
float timestep /* Time step interval */
);
} ParticleSimulationModule;
Mesh Emitter | Creates new particles randomly over time and places them on a mesh surface or volume. |
Integrator | Takes forces/acceleration and transforms them to velocity/position change. Several different types possible: Euler, RK4, Verlet, ... |
Gravity | Simple gravity force. |
Effector | Applies force fields from external objects/object groups. |
Collision | Does collision test against external objects/object groups and calculates dynamic response (bouncing, friction, etc.). Advanced node modules could separate collision checks from dynamic reactions! |
Boids | Applies boid behaviour |
Hair | Adds a hair strand to each particle and special simulation of the strand. Like collision, this is quite complex feature and may be split into several components |
SPH Fluids | Simulates fluids with the SPH method. |
Rendering
Halo | Simple circular halos. |
Billboard | One quad per particle with UV coordinates and normals for advanced shading. |
Strands | Used for rendering hair and grass simulated by the hair simulation module. |
Surface | Create a rigid mesh surface from particle locations (useful for fluid simulations). |
Object | Uses instances of an external object. |
Drawing
These modules generate simple OpenGL geometry primitives for display in the 3D window.
Point | Point display. |
Cross | Cross display. |
Circle | Visualizes the particle size by the circle radius. |
Strands | Shows strands by drawing lines. |
Object | Uses instances of an external object. |