CCG/PFX: PFX from Config.txt
Contents |
PFX from Config.txt
Adding Smoke Tags
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 below.
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 | stack| lowpressurevalve 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, starting with 0 [ ] Means optional, ... Indicates a variable number of parameters, | Means or. {} These brackets define the smoke container limits, and are generated by CCP when the config.txt file is saved.
Breakdown:
<name of attachment point>
- Is the name of an attachment point in the model. e.g. a.smoke0, a.smoke1, 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.
Refer also to Chapter 5 for additional explanations.
MAIN PROPERTIES
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.
1. 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.
2. 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.
3. 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.
4. 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.
The following modes are suitable for use with Twinkles generated effects, as a .tfx file.
5. If set to stack, this allows the use of two tags:
- inherit-velocity - range 0 to 1, this is to tell the particle that it will inherit the velocity of the emitter. This can have different effects depending on the velocity and direction of the locomotive.
- scale - range 0 to 1, the scale of the emitter or the scale (rate) of the particles. Small values increase the precision of the effect with regards to regulator usage.
A typical layout for this mode is as follows:
smoke0 { attachment "a.smoke0" mode "stack" file "chimneymoving.tfx" color 0,0,0,0 enabled 1 inherit-velocity 0.0 scale 0.98 }
6. If set to lowpressurevalve, the effect is turned on and off in relation to the boiler pressure in the engine spec for the locomotive. When the maximum boiler pressure is reached when driving, the effect will be activated until the boiler pressure drops below the specified maximum pressure. A typical layout for this mode is as follows:
smoke4 { attachment "a.smoke3" mode "lowpressurevalve" file "safetyvalve.tfx" color 0,0,0,0 enabled 1 }
7. If set to anim, when placing an attachment for a whistle steam effect the attachment must be named a.whistle for the effect to turn on when the whistle key is pressed. A typical layout for the effect is shown below:
smoke7 { attachment "a.whistle" mode "anim" file "whistle.tfx" color 0,0,0,0 enabled 1 }
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. Not functional in TRS.
Sequence Properties
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 using multiple phases.
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 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 flames etc.
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 smoke container entries in the config.txt file will cause smoke to come out of the factory's chimney between 6am and midday and 3pm and 6pm.
Example 1 - Smoke from a Factory's Chimney
Config.txt
kuid <KUID2:####:#####:1> region "Britain" kind "scenery" 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 }
Example 2 - Steam Train
An animated steam train model that requires four smoke points may be set up as follow:
- · Dark smoke from the main chimney stack that is dependant 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).
The model is exported as an indexed mesh (.im file type) to a '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. 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.
Please refer to examples and detailed explanations of additional tags in the earlier chapters of this document.
Config.txt
kuid <KUID2:####:#####:1> kuid <KUID2:####:#####:1> kind "traincar" bogeys { 0 { bogey <KUID:####:#####> } } engine 1 username "A Steam Train" trainz-build 2.9 mass 100000 enginespec <KUID:###:#####> enginesound <KUID:###:#####> hornsound <KUID:###:#####> interior <KUID:###:#####> 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 }
Twinkles PFX
Twinkles pfx is a particle effects editor.
Twinkles was designed for the creation and configuration of 3D effects for use in 3D games. Twinkles is game independent and requires a TRS effects plugin to convert it's particle emitters into TRS format, a .tfx file. Once installed, adding an effect in Twinkles allows you to add and configure the TRS particle emitter effect.
Full documentation is supplied with Twinkles PFX as is the TrainzPFX plugin.
Examples of smoke block configuration for TRS assets are available from the Twinkles PFX User Guide.doc which forms part of the Twinkles install.
A number of tutorials are available from forum links, explaining how to use twinkles effects. See also Page 392 for some uses of the .tfx file with the mode options.
Download Twinkles from the following site:
http://www.auran.com/TRS2004/downloads/contentcreation/Twinkles.zip