"Smoke" container

From TrainzOnline
Revision as of 23:58, 3 February 2010 by Windwalkr (Talk | contribs)

Jump to: navigation, search

A smoke container is effectively a PFX (particle effects) emitter that defines smoke and similar effects produced by assets. Smoke tags take the form smokeX where X is a number. There is no maximum number of smoke tags but they must be numbered sequentially (i.e. smoke0,smoke1,smoke2,etc). Smoke blocks have two sections: main and sequence properties. Main properties describe the attributes that stay the same for the life of the emitter. Sequence properties describe a set of one or more phases/periods in the smoke emission sequence.

Contents

Supported Tags

Each smoke container supports the following tags. Each tag is shown here with its default value.

 texture               KUID<-1:6329>
 file                  ""
 attachment            ""
 mode                  "time"
 accel                 0,0,0
 conesize              0.2,0.2,1
 direction             0,0,1
 enable-steam-physics  0
 enabled               1
 faces                 "camera"
 inheritVelocity       0
 loop                  -1
 loopdelay             0
 loop-amount           0
 minrate               0
 maxrate               20
 maxspeedkph           0
 start                 0
 period                -1
 color                 255,255,255,255
 endcolor              255,255,255,255
 rate                  4
 velocity              1
 lifetime              3
 minsize               0
 maxsize               3
 mass                  1
 mass-scale            .5
 drag                  .36
 spring                .17
 dampening             .02
 physics-delay         0


Main Properties

texture

Type: KUID
Desc: Sets the kuid of the texture to use for the particles, defaults to KUID<-1:6329> (Steam).

file

Type: String (filename)
Desc: Specifies that the particle emitter settings should be read in from a file generated by the Twinkles PFX tool.

attachment

Type: String
Desc: The name of the attachment point at which to generate the PFX. Attachment points are specified in the mesh file during creation.

mode

Type: String
Desc: The PFX emitter mode. Smoke effects can contain a number of cycled 'phases', the mode defines how the 'start' and 'period' tags are interpreted to control the progression between each smoke phase. Mode must be one of the following values (defaults to "time" if not specified).
  • time - 'start' is a list of time values (in seconds) after the creation of the parent object when the next phase of the effect will start, 'period' is the duration of time the phase will remain active.
  • timeofday - 'start' is the time of day to start the next phase. The time of day is specified as a decimal from 0 to 1, where 0 is 0:00.00 AM and 1 is 12:59.59 PM.
  • anim - 'start' specifies a time in the assets animation cycle to start the next phase. 'period' is the time over which the phase is active. The time in the anim cycle is specified as a decimal between 0 and 1. 'start' + 'period' must not exceed 1.
  • anim2 - Same as 'anim' with some additional tags (interpolate, loop, loopdelay)
  • speed - 'start' is a speed, in meters per second, to start the next phase. 'period' is not used.
Only the 'time' and 'timeofday' modes are valid for scenery objects, other modes are intended for use with assets such as locomotives.

accel

Type: Decimal List
Desc: Sets the acceleration conditions for the smoke particles. First value is gravity, second is (optional) wind effect. Default is 0,0. A third (deprecated) form exists with three parameters - this uses the first two values to calculate the wind effect and the third as gravity.

conesize

Type: Decimal List
Desc: Specifies the cone in which the particles are emitted. When a particle is created it will be given an initial velocity vector with its direction being a random vector in this cone and its speed being taken from the 'velocity' tag. The cone tag is a decimal list of 1, 2 or 3 values (in meters). The first two values specify the width and depth (x and y) of the cone, and the third value specifies it's height. If the height isn't provided a value of 1 will be used, if only one value is provided it will be used for both the width and height. The default value if the tag isn't provided at all is (0.2,0.2,1.0).

direction

Type: 3D Vector (x,y,z)
Desc: Sets the direction the particle emitter is facing. The direction will default to (0,0,1) if not supplied (straight up).

enable-steam-physics

Type: Boolean
Desc: Enables some of the more advanced smoke/steam related particle physics (drag, spring & dampening).

enabled

Type: Boolean
Desc: Sets whether the particle emitter is enabled.

faces

Type: String
Desc: Sets the direction the particle faces. Can be one of the following values:
  • camera - The particles are drawn so that they always face the camera (Default)
  • motion - The particles are drawn so that they face the direction they are travelling.
  • down - The particles are drawn facing down.

inheritVelocity

Type: Boolean
Desc: Causes particles to inherit the velocity of the emitter, default is off.

loop

Type: Decimal
Desc: Sets the time, in seconds, after which to loop the smoke sequence. Valid only for modes 'time' and 'anim2'. Can be set to -1 to imply that it loops after the length of the sequence, this is the default behaviour.

loopdelay

Type: Decimal
Desc: Specifies the delay, in seconds, until the sequence loops again.

loop-amount

Type: Integer
Desc: Sets the number of times the sequence should loop.

minrate

Type: Integer
Desc: Sets the minimum particle emission rate for the entire sequence. Defaults to 0.

maxrate

Type: Integer
Desc: Sets the maximum particle emission rate for the entire sequence. Defaults to 20.

maxspeedkph

Type: Decimal
Desc: For cone emitters, this will set the maximum speed of the particles, in kph.


Sequence Properties

Per-phase tags are specified as value lists. If a list is added it should specify a value for each phase.

start

Type: Decimal List
Desc: Specifies when to start this phase, 'start' behaves differently depending on 'mode' (see mode for details). Start will default to 0.

period

Type: Decimal List
Desc: Specifies the duration of this phase, 'period' behaves differently depending on 'mode' and is not always used (see mode for details). Period can be set to -1 to imply that the phase is active until the next phase begins, this is the default behaviour.

color

Type: Color List (RGBA, 0 to 255)
Desc: Specifies the initial color of the PFX texture for each phase. Color will default to white (255,255,255,255).

endcolor

Type: Color List (RGBA, 0 to 255)
Desc: Specifies the ending color of the PFX texture for each phase. Color will default to white (255,255,255,255).

rate

Type: Integer List
Desc: Specifies the rate of particle emission in each phase. For most modes this is set to the number of particles to emit per second, for 'anim' and 'anim2' however this is the number of particles to emit over the animation period. The default rate is 4. See also 'minrate' and 'maxrate'.

velocity

Type: Decimal List
Desc: Specifies the initial speed of the emitted particles for this phase. Speed is specified in meters per second, the default value is 1m/s.

lifetime

Type: Decimal List
Desc: Specifies the time, in seconds, that the particles exist for in this phase (defaults to 3).

minsize

Type: Decimal List
Desc: Specifies the starting size of the particles created in this phase (scaling value where 1 is 100%, default is 0).

maxsize

Type: Decimal List
Desc: Specifies the ending size of the particles created in this phase (scaling value where 1 is 100%, default is 3).

mass

Type: Decimal List
Desc: The initial mass, in kilograms, of the particles created in this phase. Defaults to 1.

mass-scale

Type: Decimal List
Desc: The percentage of mass lost over the particles life time for this phase. This allows particles to become lighter as they disipate into the air. The value is specified as a percentage where 1 is 100% and will default to 0.5 (50%).

drag

Type: Decimal List
Desc: The drag constant for the particle created in this phase. This specifes the resistance against the particles ability to move freely through the air. If not specified the drag constant will default to 0.36, increasing the value will cause particles to be more strongly affected by wind. Requires the 'enable-steam-physics' tag.

spring

Type: Decimal List
Desc: The spring constant for particles created in this phase. The spring constant specifies how the strong the link is between individual particles. By default the spring constant is 0.17 if not specified, increasing the value will cause the particles to be more rigidly linked to each others movement. Requires the 'enable-steam-physics' tag.

dampening

Type: Decimal List
Desc: The spring damping constant for particles created in this phase. The spring damping constant affects the 'stability' of the link between individual particles (see 'spring'). Requires the 'enable-steam-physics' tag. Defaults to 0.02.

physics-delay

Type: Decimal List
Desc: Delay, in seconds, before particles are affected by world physics. 0 by default.

Example Config.txt

Sample config.txt file for a scenery asset that produces smoke:

 region Britain
 kind scenery
 type Industrial
 light 1
 smoke0
 {
   attachment a.smoke
   mode timeofday
   color 150,150,150,250
   accel 1,0.3,0
   start 0.25, 0.5
   period 0.25, 0.125
   rate 8
   velocity 3
   lifetime 5
   minsize 0.5
   maxsize 2
 }

Sample config.txt file for a steam train with four smoke emitters.

  • Dark smoke from the main chimney stack that is dependent on the trains velocity (a.smoke, Y axis pointing up),
  • A constant steam trail from a small safety pipe on top (a.steam.safety, Y axis pointing up),
  • 2 steam trails on each side of the train that alternately expel steam keyed to the animation of the trains wheels (a.steam.l, a.steam.r, Y axis pointing outwards).
 kind traincar
 bogey 0
 engine 1
 name Steam Train
 mass 100000
 enginespec <KUID:0:0>
 enginesound <KUID:0:0>
 hornsound <KUID:0:0>
 interior <KUID:0:0>
 
 smoke0
 {
   attachment a.steam.l
   mode anim
   color 255,255,255,150
   start 0
   period 0.4
   rate 2
   velocity 1
   lifetime 2
   minsize 0.05
   maxsize 1
 }
 smoke1
 {
   attachment a.steam.r
   mode anim
   color 255,255,255,150
   start 0.5
   period 0.4
   rate 2
   velocity 1
   lifetime 2
   minsize 0.05
   maxsize 1
 }
 smoke2
 {
   attachment a.steam.safety
   mode time
   color 255,255,255,150
   rate 2
   velocity 1
   lifetime 2
   minsize 0.05
   maxsize 1
 }
 smoke3
 {
   attachment a.smoke0
   mode speed
   color 100,100,100,200
   start 0,10,20,30
   rate 3,5,7,9
   velocity 3,4,5,5
   lifetime 4,3,2.5,2
   minsize 0.3
   maxsize 2
 }


Categories

Personal tools