PARTICLE EFFECTS |
||
| Introduction | Attachment Points | Main Properties |
| Method | Smoke Tags | Sequence Properties |
Examples |
Smoke from a factory's chimney Steam Train |
|
Trainz version 1.3 (Service Pack 3) gives you the ability to add customizable smoke, steam, vapor and similar effects to your custom trains and scenery objects. For simplicity, this document will refer to this set of effects as simply smoke effects.
It is assumed the reader is already familiar with creating and exporting models from either 3D Studio Max™ or GMax™.
Smoke effects are added to custom trains and scenery objects in two steps:
Attachment points are added to the original model using 3D Studio Max™ or GMax™ wherever a smoke effect is desired. See figures 1 and 2 below to locate the Insert Point tool. After a point is inserted, it must be given a name with a prefix of 'a.' to identify it as an attachment point, e.g. a.smoke, a.steam, a.safety, a.mist, etc. The attachment point should also be rotated so that its Y axis is pointing in the direction that smoke particles will be emitted. (Ensure Axis Tripod is checked to see the point's orientation.) When finished, save and export the model as per normal.
![]() |
![]() |
| Fig1. 3D Studio Max™ Insert Point | Fig2. GMax™ Insert Point |
Smoke blocks are added to an object's config.TXT file to describe each smoke effect that will be created on the object. Smoke blocks are named smoke# (where # is a number) and are sequentially numbered starting at 0. See Example 2 for an example.
Smoke blocks have two sections: main and sequence properties. Main properties describe the attributes that do not change based on the mode's key. Sequence properties describe a set of one or more phases/periods in the smoke emission sequence.
A smoke block has the following format:
| smoke# | |
| { | |
| mode | time | speed | anim | timeofday |
| attachment | <name of attachment point> |
| color | <red>, <green>, <blue>, <opacity> |
| accel | <x>, <y>, <z> |
| loop | <n> |
| start | <n> [, <n>]. . . |
| period | <n> [, <n>]. . . |
| rate | <n> [, <n>]. . . |
| velocity | <n> [, <n>]. . . |
| lifetime | <n> [, <n>]. . . |
| minsize | <n> [, <n>]. . . |
| maxsize | <n> [, <n>]. . . |
| } |
Notation: '#' is a number, [ ] means optional,' . . .' indicates a variable number of parameters,'|'. means or.
Where:
<name of attachment point> is the name of an attachment point in the model. e.g a.smoke, a.steam, a.chimney, etc.
<red>, <green>, <blue> are numbers from 0 to 255 describing the intensity of that color component.
<opacity> is a number from 0 to 255 describing the effect's initial opacity/transparency.
<x>, <y>, <z> are vector components pointing in the direction of the sum of all forces affecting this smoke effect. Essentially, <z> describes gravity, and <x>, <y> describe the force of wind.
<n> is a decimal number.
| TAGS | DESCRIPTIONS | |
| mode |
Describes the mode or type of this smoke effect. This affects how start and period are interpreted. Default is time. In all modes, period can be set to -1 (default) to imply the phase is active until the next phase begins. |
|
| time | If set to time, start is a set of time values in seconds after the creation of this effect's parent object when this phase of the effect will start. period is the duration of time this effect will remain active. Scenery objects currently only support time mode. | |
| speed |
If set to speed, start is a speed in meters per second (m/s) and period is not used. (Note: 1 m/s = 3.6 km/hr) All other sequence attributes (rate, velocity, lifetime, minsize, maxsize) are interpolated so there are smooth transitions between phases. See smoke3 in Example 2 for an example. |
|
| anim | If set to anim, start is a value from 0.0 to 1.0 which describes the start time into the object's animation cycle. period is a value from 0.0 to 1.0 that describes the duration over which the effect is active. start + period must not exceed 1.0. | |
| timeofday |
If set to timeofday, start is a value from 0.0 to 1.0 which describes the time of
day when this effect will start. Values range as follow: 0 - midnight, 0.25 - 6am, 0.5 - midday, 0.75 - 6pm, 1.0 - midnight. |
|
| color | The color of the smoke effect. e.g. '150,150,150,255' for dark smoke; '255,255, 255,150' for steam; '150,150,255,255' for water. Default is '255,255,255,255'. | |
| accel | Acceleration. A vector pointing in the direction of the sum of all forces affecting this smoke effect. Essentially, <z> describes gravity, and <x>, <y> describe the force of wind. Default is 0,0,0. | |
| loop | Time in seconds to loop the smoke sequence. Only valid if mode is set to time. | |
The following properties can be set to a single value or a set of values for multiple phases of the smoke effect. Please note that phases must not overlap as only one phase can be active at any one time. If a property has a set of values, it must be the same length as start. If a single value is given then it will be used for all phases of the effect. See Example 1 for an example of using multiple phases.
| TAGS | DESCRIPTIONS |
| start, period | See mode. |
| rate | The rate of emission in particles per second for modes time, speed, and timeofday, or the number of particles to emit over the animation period for anim mode. Default is 4. |
| velocity | The initial speed of emitted smoke particles. Default is 1. |
| lifetime | Time in seconds that smoke particles exist for. Default is 3. |
| minsize | Start size of smoke particles. Default is 0. |
| maxsize | End size of smoke particles. Default is 3. |
In general, it is better to use a low emission rate with large particles (ie min/max size) than using a high emission rate with small particles to reduce the impact on frame rate. Smoke effects can be quite stunning but are best used in moderation.
Try experimenting with the different values to get a feel of how they affect the smoke effects. Many different types of effects other than smoke are possible with only a little imagination, e.g. waterfalls, mist, toxic green clouds, fire by using a few effects at the same position to simulate the smoke and fames, etc.
Example 1 - Smoke from a factory's chimney
Using a model of a factory with a chimney, an attachment point called 'a.smoke' is placed at the top of the chimney with it's Y axis pointing up. The factory is then exported as an indexed mesh (*.IM file type) to the Trainz\world\custom\scenery\factory folder and the model's art assets are copied to the same location. The following config.TXT file will cause smoke to come out of the factory's chimney between 6am and midday and 3pm and 6pm. Please note the given KUID is invalid and should not be used in your own custom context.
Config.TXTFile Example for a Scenery |
|
kuid <KUID:-15:123456>
smoke0
start 0.25, 0.5 |
Example 2 - Steam Train
An animated steam train model that requires four smoke points may be set up as follow:
The model is exported as a progressive mesh (*.PM file) to Trainz\world\custom\trains\steam_train\steam_train_body folder and the model's art assets are copied to the same location. Please see the custom content creation guide for more information on creating your own custom trains. The following config.TXT file in the parent folder will generate the desired smoke effects. Please note the given KUID is also invalid and should not be used in your own context. For example purposes, the settings of an F7 train have been used.
Config.TXT File Example for a Traincar |
kuid <KUID:-15:123456>
enginespec <KUID:-1:42004202>
smoke0
start 0
smoke1
start 0.5
smoke2
smoke3
start 0,10,20,30 |