Particle Editor Design Doc


Summary

This project is to create a particle system editor so that particle systems can be designed in a simple editor and have their settings exported to a file for use later. All useful settings for a particle system will be able to be edited via a GUI. There will also be a display so the user can see the results of the various settings.


Programs

This project will initially be comprised of 2 programs with a third added later. The first program is the GUI for editing the various settings. The second is a XNA rendering program for displaying the current settings. The third is a D3D11 rendering program. This project could be done with 1 program with a winforms or WPF GUI with a XNA child window. But since particle systems are a nice start to working in D3D11, editing and rendering will be different programs so that the editor can be kept the same for the XNA and D3D11 rendering programs.


Settings

The editing GUI will organize related settings together in categories. The following subsections list the different categories and their configuration parameters.


Camera

This allows for editing the camera used by the rending program. The camera is an orbit style one that moves about its look at position. These configuration parameters are not actually part of the particle system.

Look at position

World coordinates of the position that the camera should be looking at

Range

How far away, in units, the camera should be from the look at position

Yaw

How much yaw/orbit to use in computing the camera's position

Pitch

How much to pitch the camera above/below the orbit plane


Emitter Settings

Shape

Determines the shape of the emitter used to generate particles

Value Description
Point All particles have their initial position set to the emitter's position
Line All particles are created along a unit length line that is aligned along the x-axis and centered at the origin
Square Particles are created in a 1x1 region aligned with the emitter's local xz plane centered at the origin
Square Perimeter Particles are created along the perimeter of a 1x1 region aligned with the emitter's local xz plane centered at the origin
Circle Particles are created in a unit circle aligned with the emitter's local xz plane centered at the origin
Ring Particles are created along the circumference of a unit circle aligned with the emitter's local xz plane centered at the origin
Sphere Particles are created on the surface of a unit sphere centered at the origin
Hemisphere Particles are created on the z ≥ 0 half of the surface of a unit sphere centered at the origin

Position

World coordinates for the position of the emitter in xyz

Rotation

Yaw, pitch, and roll rotation of the emitter

Scale

Allows for scaling the emitter in xyz after position and direction are taken into account

Spawn Time

How long, in seconds, the emitter should spawn particles for

Spawn Rate

How many particles per second the emitter should generate


Particle Control

Dispersion Type

Determines how the particles determine what direction to move in.
Value Description Addition Configuration Data
Directional Particles move a particular direction Unit vector for xyz in the emitter's local space that specifies the direction particles should move in
Spherical Particles can move in any direction None
Partial Sphere Particles move a direction within a partial sphere aligned with the +z axis in the emitter's local space All angles are in the range -180 to 180, with minimium angles being less than or equal to their corresponding max.
  1. Min x angle
  2. Max x angle
  3. Min y angle
  4. Max y angle

Shape

Determines the shape of the individual particles. Options are:

Lifetime

How long in ms individual particles should live for

Size

Size of the particles in units

Speed

The minimium and maximum speed, in units/second, that particles can move at. The actual speed for a particle is randomly selected from within that range

Acceleration

Acceleration in the emitter's local space, in units/second^2, that should be applied to each particle over time. Each of the xyz components can be specified individually


Particle Coloring

Coloring Mode

Determines how particles are to have their color determined

Value Description Addition Configuration Data
Texture An image is used to color the particles. Each particle has the full texture mapped to it. Pre-multiplied alpha blending is supported, which allows for greater variety of particle shapes. Path to the image to use
Color Set Particle color is randomly chosen from a specified set of colors Colors to include in the set, as well as the associated probability for each color
Color Sequence Particle color changes over time in a set sequence. The displayed color is a proportional fade of two colors in the sequence based on time. Colors in the sequence, as well as percentage of the particle's life for when the color should occur

Program Communication

Connection Type

Since the editor and rendering processes are seperate programs, they need a method to communicate. A TCP network connection between the processes will be used, with the rendering program operating as the server. Since it is assumed that the editor and rendering programs will be running on the same system, the editor will use synchronous network function calls. The rendering programs will only wait for a message if the socket indicates that a message is available to be read.

Message Format

To minimize the amount of updating in the rendering program when the user changes a value, only what changed and its new value will be sent. The messages that communicate these changes are comprised of 3 fields, which are listed below. All multibyte fields are stored in network byte order.

  1. The version field, which is an unsigned integer 32bit field. It is used to signify the version of the messages, not the software on either side. The value will be increased by 1 for each version of the messages that are incompatible with an existing version or reordering of parameter id values. In the initial version of the messages, it will be set to 1.
  2. Parameter id, which is an unsigned integer 32bit field. It is the unique id of the configuration parameter that is being changed. Listing the various parameter ids and their meaning is beyond the scope of this document.
  3. Parameter value, which is a 32bit field. The exact type of this field is dependant on the parameter id.


File Format

The format for saved files will be an XML format, for which the xsd specification can be found here. The camera data is included in the file despite not being part of the particle system so that the previous view of a particle system can be restored on load in the editor.