NiParticleSystem

From GECK
Jump to: navigation, search

NiParticleSystem is a type of NiGeometry that creates an instance of a 2D sprite-based particle system. It contains a NiPSysData that provides the basic information of particles in the system, as well as a list of modifiers that alters the behavior of emitted particles, and whether or not particles are spawned in relation to the world rather than the scene.

An example of a NiParticleSystem.

Its fields are:

  • Name: The name of the particle system.
  • Controller: Should always be a NiPSysEmitterCtlr starting a chain of particle controllers.
  • Flags: See NIF NiAVObject Flags.
  • Translation: The position of the system in relation to the previous Node.
  • Rotation: The angle of the system in relation to the previous node.
  • Scale: The scale of the particle system. Might affect the size of particles and their emitters?
  • Num Properties: The amount of properties the system has. Should always be at least 4.
  • Properties: The material properties of the system. Should always include at least NiTexturingProperty, BSShaderNoLightingProperty, NiAlphaProperty, and NiMaterialProperty.
  • Data: Should always be a unique NiPSysData.
  • World Space: Determines if particles are spawned in world space or within the scene graph. If yes, particles are aligned with the world and ignore additional transforms from within its NIF, meaning they cannot be moved or rotated if blocks they're parented to are animated. The scale of the system can still be adjusted. Useful if you have a particle system nested in a moving object that you want to maintain its orientation. Particle bounds and scale may also be affected by world settings.
  • Num Modifiers: The total number of particle modifiers the system has.
  • Modifiers: All of the particle modifiers the system uses. Always needs at least a NiPSysAgeDeathModifier hooked up to a NiPSysSpawnModifier, a NiPSysPositionModifier, and a NiPSysBoundUpdateModifier, as well as a type of NiPSysEmitter to spawn the particles from, with the NiPSysAgeDeathModifier as the first modifier.

NiPSysData

NiPSysData defines the basic information of particles such as the maximum number of particles allowed in the system as well as whether or not aspects have variation.

An example of a NiPSysData.

Its fields are:

  • Group ID: Meant for internal loading functions, always leave as 0.
  • BS Max Vertices: The maximum amount of particles that can concurrently exist at one time.
  • Keep Flags: Unknown, handled by the engine so leave at 0.
  • Compress Flags: Meant for consoles, leave at 0.
  • Has Vertices: Should always be yes.
  • BS Vector Flags: Should usually be left at 0 as Beth doesn't generally use lighting shaders on particles. If Has Normals is set to Yes, then tick Tangents.
  • Has Normals: Usually set to no.
  • Center: Leave at 0,0,0. Used for bounds calculation.
  • Radius: Determines the distance between the center and each vertex of the sprite. If Has Radii is set to yes, leave at 0.
  • Has Vertex Colors: Whether or not particles have vertex colors.
  • Vertex Colors: Supported but doesn't seem to be editable. Might pull from NiPSysColorModifier or BSPSysSimpleColorModifier.
  • Consistency Flags: Hardcoded to be CT_MUTABLE. Non-Beth games use CT_VOLATILE but Beth removed it.
  • Has Radii: Whether or not particles have variable radii from modifiers, like a NiPSysEmitter.
  • Num Active: Set at runtime, indexes the total number of currently alive particles.
  • Has Sizes: Whether or not particles have variable sizes from modifiers, like a NiPSysGrowFadeModifier.
  • Has Rotations: Whether or not particles have variable rotations from modifiers, like a NiPSysRotationModifier.
  • Has Rotation Angles: Whether or not particles have variable rotational angles from modifiers.
  • Has Rotation Axes: Whether or not particles have variable rotational axes from modifiers.
  • Has Texture Indices: Whether or not particles are mapped to sections of the source texture.
  • Num Subtexture Offsets: The total number of sections of the source texture. Must be a multiple of 2. (2 will have two sections, 4 will have 4, etc)
  • Subtexture Offsets: Sections are split into four vectors and start from the upper-left corner of the texture. X and Z specify the horizontal and vertical position and positive values move rightward and downward respectively, and Y and W define the height and width of the section in relation to the texture's height and width, respectively.
  • Has Rotation Speeds: Whether or not particles have variable rotational speeds from modifiers.