利用者:Phonybone/Archive/Particles2010/ParticlesTodo

提供: wiki
移動先: 案内検索

Particle TODO list

This is a list of possible improvements to particle systems. It should be sorted according to what is most wanted and/or can be implemented with reasonable effort. Some implementations may also be easier to do after others have been finished.

Separating Particle System from Settings

in progress Inprogress0.jpg 0%

 not started yet

Separate the particle system code from the particle settings code. Currently both are mixed in particle.c and particle_system.c and it is often not clear whether a struct or function belongs to the particle system or settings. Functionality is currently mostly in the particle system code, but will gradually be shifted to the settings with modularization.

Effect
  • Increase readability of the particle code
  • Clear the path for further improvements by making maintenance much easier.
Complexity
Only minor changes should be required to the code. Mostly it is about moving things to distinct files and renaming some functions.

Emitter Separation

in progress Inprogress50.jpg 50%

 mainly done, needs bug fixing

Separate emitter functionality from the particle owner object. A particle system has a list of emitter objects, each of which has it's own emission settings and contributes particles to the system.

Effect
  • Emitters become a feature of particle systems (instead of particles being a feature of the emitter/owner object).
  • Multiple objects can emit particles in the same system.
  • Simplifies remaining particle system code by stripping it of emitter code.
  • Prepares emitters for becoming a modules/node.
Complexity
Using the owner object as the only emitter is deeply rooted in the code, which can cause unexpected bugs.

Link Slots

in progress Inprogress100.jpg 80%

 some bookkeeping functionality missing

Link slots make it possible to use references to external data (objects, materials, textures, etc.) in Particle Settings without a concrete pointer in the settings data block. Settings manage a list of slots, which can be seen as "roles" for the actual data (e.g. emitters use object slots). Concrete data pointers are assigned in particle systems.

Effect
  • Particle systems can use the same settings, but assign different data to the slots.
  • Particle settings library data is independent of the scene content and can be reused.
Complexity
Implementation is quite simple. This is an addition to the current system and does not interfere with existing code.

Example:

Example for a link slot setup.
  • Object X does not assign slot 2
  • Object Y does not assign slot 1
  • Different objects are assigned to slot 0 by both systems
  • Object "something" is used for different slots by both systems


Node Interface

in progress Inprogress25.jpg 01%

 Experimenting/Concept stage

Define a common interface for particle nodes. Such nodes should replace the current fixed pipeline for simulation, rendering and drawing. Special node input/output socket types must be created for particle sets.

Effect
Makes real flexible particle simulations possible.
Complexity
Lots of detail problems will come up along the way, but this can probably be implemented alongside the current system without changing it very much. Existing features and backwards compatibility can be ported gradually.

Custom Particle Data

in progress Inprogress0.jpg 0%

 not started yet

Implement a generic way of registering particle properties to be allocated in the buffer. The particle buffer should contain per-particle properties (e.g. size, mass, color, temperature, ...) only when at least one simulation or rendering feature actually needs it.

Effect
  • Decouples the base particle system code from the individual simulation features.
  • Extending particles will be easier and not require changes to the particle system code.
  • In general the particle buffer will be smaller, because it only contains data that is actually required.
Complexity
Implementing the system is not exceptionally difficult, but it will require changes to each and every current feature. Access of particle data has to become more formalized by the use of access functions and/or managed property pointers.

Paged Buffer

in progress Inprogress50.jpg 30%

 conversion in progress

Allocate particles in "pages" instead of one contiguous buffer at creation time. Add new pages as particles are emitted and remove pages when all particles are dead.

Effect
Allows a much more flexible behaviour of particle emission:
  • The amount of particles in the simulation does not have to be known beforehand, which in the short term makes real animated emission rates possible and custom emission features, like event-based emissions, later.
  • The amount of unused memory allocated for the particle buffer can be reduced drastically in certain circumstances (many particles, long simulation + short lifetime, no disk cache).
Current buffer and cache allocation
Page-based allocation. Compare the amount of unused allocated memory!
Complexity
Will require changes to the way particles are accessed in the buffer. This will not be possible any more:
int p = ...
ParticleData *pa = psys->particles + p;
Retrieving a specific particle by index must be done with an access function:
int p = ...
ParticleData *pa = psys_find_particle(psys, p);
Iterating over particles is done with a special iterator:
ParticleIterator pit;
...
for (psys_iterator_init(&pit, psys); pit.pa; psys_iterator_next(&pit)) {
    ...
}