by Derek » Mon Sep 26, 2011 8:51 am
More route creator information.
taken from a raw dev doc so not final.
d
Point and Spot lighting, placement/attachment and projected textures
Setup
There are 2 new blueprints cSpotLightBlueprint and cPointLightBlueprint these describe a point or spot light.
Point Light:
● Set the colour of the light (alpha is not used)
● Set the radius, the light will fall off to 0 at radius and falloff is linear
● Set the shadow caster flag (Warning: the render component has a shadow caster flag as well) this should be false for all but very special lights (see performance constraints)
● Set the day night flag, for scenery light (e.g street lighting, shop lighting etc) this should be true. If true the light will come on at night and be off in the day.
● Set the projected texture. This is a special cube map image which can be used to modify the colour/shape of the light to do advanced effects such as lampshades, stained glass, fixed shadows etc
● Set the animation texture, this is an uncompressed (suffix _nm.ace) texture which acts as an animation for the colour (r,g,b channel) and size of the light (alpha channel). This should be a power of 2 size texture with at least 32 texels. The animation runs at 32fps and multiplies the light colour by the colour of the texture and the radius by the alpha channel.
Spot Light:
● Set the colour of the light (alpha is not used)
● Set the radius, the light will fall off to 0 at radius and falloff is linear
● Set the Umbra(Phi) the angle of the cone and Penumbra(Theta) the angle within the cone that has full intensity. Phi should be greater than or equal to theta. if theta is less than phi the angle between phi and theta has a linear falloff in light intensity.
● Set the day night flag, for scenery light (e.g street lighting, shop lighting etc) this should be true. If true the light will come on at night and be off in the day.
● Set the shadow caster flag (Warning: the render component has a shadow caster flag as well) this should be false for all but very special lights (see performance constraints)
● Set the projected texture. This is a special image which can be used to modify the colour/shape of the light to do advanced effects such as lampshades, stained glass, fixed shadows etc
● Set the animation texture, this is an uncompressed (suffix _nm.ace) texture which acts as an animation for the colour (r,g,b channel) and size of the light (alpha channel). This should be a power of 2 size texture with at least 32 texels. The animation runs at 32fps and multiplies the light colour by the colour of the texture and the radius by the alpha channel.
To connect lights to the train headlight controls the light children need to follow the following convention. Fwd for forward running, Bwd for backward running and headlight for headlights and taillight for taillights.
Fwd_Headlight_<index>
Bwd_Headlight_<index>
Fwd_Taillight_<index>
Bwd_Taillight_<index>
Where index is any value. e.g Fwd_Headlight_1, Fwd_Headlight_2 to have 2 fwd headlights.
Usage
Point and spot lights can be placed in routes or scenarios or attached as child objects. Where point or spot lights are placed as simple objects they can have there properties (colour,range etc) altered by double clicking on the light editor object.
Performance Constraints
● Simple lights are those that have no projected texture and do not cast shadows. These are efficient and can be placed relatively freely. A scene could contain hundreds of these and perform well.
● Lights with projected textures have a small additional overhead and should be used more carefully.
● Lights that cast shadows are expensive! these should be used very sparingly/carefully, large point light shadow casters are the worst, small spot light shadow casters are less expensive.
Decal lighting
Setup
normal decals
The material should be called decal_XXX where XXX is a logical material name.
This material supports full alpha, so a full 32-bit image should be used.
Dynamic Numbering
Dynamic number fonts now support alpha, which has two advantages -
● We get nice anti-aliased fonts against the bodywork (instead of that horrible jaggy edges seen in RW/RW2)
● It reduces the amount of font textures we need to do for multiple liveries. For example, a loco might have a red and a blue livery both with white numbers. Previously we had to have fonts textures for white numbers on blue, and white numbers on red because of the edge aliasing. Now we can simply have white number font with alpha'd edges.
To get this working -
● The materials most now be prefixed with "decal_". For example, the materials in your primary digits Multi-Sub would be called "decal_primarynumber_0", "decal_primarynumber_1", "decal_primarynumber_2" etc
● The shader must be TrainDecal.fx for each of the primary digit materials in your Multi-Sub.
● The textures are still called primarynumber_0, primarynumber_1, primarynumber_2 as before, but can now have a full 8-bit alpha channel (instead of 1-bit as previously)
Usage
Dynamic numbers, train logos on sides of tenders etc
Emissive Glow
Setup
To make a glowing object use the shader TrainEmissiveGlow.fx, texture one is the standard diffuse channel, channel 2 is the emissive colour.
Usage
Use to create strip light like effects etc
Performance Constraints
None! These have a roughly fixed cost so can be used freely.
Shadows for cabs
Setup
By default, all geometry will cast shadows. All that is required is that a polygon faces a light, and a shadow will be cast by it.
However, for cabs, the problem is that polygons face inwards, so they are not recognised as occluders.
By default, to ensure old interior geometry looks good, all interior model geometry will cast shadows by treating all faces as two-sided. This presents 2 problems. The first is that the game unnecessarily renders interior geometry twice (once with back face culling and once with front face culling), wasting graphics processing time. The second is that light bleeds into the interior models at edges due to two-sided polygons acting like thin geometry - one thing shadow mapping doesn’t like.
To combat both these problems, a new shader has been introduced. “TrainShadowOnly.fx” is a shader that can be applied to geometry that doesn’t show up in game, but still casts a shadow, similar to a shadow volume. This shader should be used to create a shell around the interior acting as the exterior model.
Note that this is not the same as a shadow model used in stencil shadows. There are no naming requirements, and no need for the model to be a closed mesh. The only requirement is that there are faces that face outwards from the interior to allow shadows to be cast into the interior.
Any interior model that makes use of this shader will be assumed by the game to not require rendering geometry twice, which will improve performance, so make use of this shader for all interior models. This will also prevent light bleeding, as the shadow only geometry should have a gap between itself and the interior geometry.
Usage
-
Performance Constraints
As with all geometry, performance decreases as poly count increases, so try to stay within poly count budgets.
Also, even if a cab looks fine with the in-code workaround, it still has an impact on performance, so make use of the TrainShadowOnly.fx shader for interior models to turn off the workaround and manually setup a shadow casting model.
Remember that these models are not shadow volumes, and don’t require a closed mesh. Cutting out a hole for windows is therefore fine to do. You could use the exterior geometry as the occluding geometry and apply the shader to the whole thing.
Wonky Track
Setup
Default is set in Track Rule.
Usage
Default can be overridden in route or scenario editing using track properties. Debug track rendering will show wonkiness on the seventh press of space - white is flat, red is ultra, with colour grading accordingly.
No Space bar = Normal rendered track.
1 = Line Type (Yard, main etc)
2 = Directionality
3 = Speed Limits
4 = Sounds
5 = Electrification
6 = Super-elevation
7 = Wobble
8 = Track linked objects
9 = Return to normal rendered track
Performance Constraints
None
Water blueprint setup and placement
Setup
As of RW3 the water has had a number of updates/improvements. These dont require many changes. There is 2 new properties, a colour and a murkyness depth. The murkyness depth is the depth in metres at which the water will appear opaque.
Usage
Water is placed as before but now also has a property page.
● Set the colour if required using the colour button or enter a hexadecimal value
● Set the murkyness depth
● Set the size and height, where multiple pieces of water are placed as part of a large lake or sea make sure the height is exactly the same.
Performance Constraints
Water has a fixed overhead when visible, place as required.
Block asset setup
Setup
There is now a single instance of cAssetBlockBlueprint, no further setup is required.
Usage
● Place the asset block
● Set the density per square km
● Set the size
● Choose an asset to populate the block with.
● Choose the variance for height and rotation, these will scale and rotate the assets randomly
Performance Constraints
● Asset blocks speed the game up in most cases as they reduce the number of draw calls from the CPU to GPU.
● Asset blocks can increase the polygon throughput, in particular they are expensive if used with high polygon assets.
● Asset blocks should mostly be used for blocking out distant scenery.
Weather and fog setup
Setup
As per RW2, although fog is now less dense to provide distant views.
Usage
As per RW2
Performance Constraints
None
Specular track
Setup
Track sections should be built as per RW2, however a new shader has been created to allow specular on the rails.
LoftTexDiffSpec.fx
Assigning this shader to the rails will create a specular phong highlight on the rail depending on the direction of the light source. This phong size is fixed.
Usage
Use this on track rails.
Performance Constraints
-
Skydome
Setup
The skydome is setup as in RW2 but with support for a few new layers. The hierarchy is now :
1_0000_skyhack
1_0000_cloud_storm
1_0000_cloud_wispy
1_0000_cloud_thick
1_0000_cloudband_1
1_0000_cloudband_2
1_0000_cloudband_3
1_0000_stars
The new layers here are ‘cloudband_1’, ‘cloudband_2’, ‘clousband_3’ and ‘stars’.
● The background skydome hemisphere (skyhack) uses TrainSkyDome.fx
● 3 Cloud layers (cloud_storm, cloud_wispy, cloud_thick) uses BlendATexDiff
● Stars layer (stars) uses Stars.fx
● 3 new cloud bands (cloudband_1, cloudband_2, cloudband_3) uses BlendATexDiff
For the three new cloud bands, cloudband_1 is drawn first, cloudband_2 is drawn second, then finally, cloudband_3 is drawn. Previous we could not represent Cumulus clouds in the skydome, as the original 3 layers rotated about all axis. These three new cloud bands only rotate around the Y axis allowing the clouds to always appear at the horizon. The speed at which these three new bands rotate is linked to the wind speed set-up in the blueprint.
The stars layer is a simple sphere with generic star map applied. The shader supports transparency, so therefore the the alpha channel of the stars texture should predominantly be black with white pixels representing the stars.
Usage
Skydome only.
Performance Constraints
-
Platform Entry & Exit Gates
Setup
There are three new assets already set up. Platform Entry Gate, Platform Exit Gate and Platform Entry and Exit Gate.
Usage
Place this platform loft linked object where you want passengers to leave and enter by. The link position defines the height of the gate, so make sure it is near the asset if the platform is sloped.
When a platform has an entry or combined gate, existing platform spawning behaviour is disabled. When an exit or combined gate is placed, existing platform exitting behaviour is disabled.
Performance Constraints
None.
Superelevation
Setup
The track rule defines the maximum tilt and the tilt to radius ratio.
Usage
Track properties has a check box on track selection to make the track tilt. The whole ribbon is superelevated. The curve must be eased. The easement must also have tilt selected. Do not use in the scenario editor.
Debug rendering will show superelavated ribbons.
No Space bar = Normal rendered track.
1 = Line Type (Yard, main etc)
2 = Directionality
3 = Speed Limits
4 = Sounds
5 = Electrification
6 = Super-elevation
7 = Wobble
8 = Track linked objects
9 = Return to normal rendered track
Performance Constraints
None.
Distant terrain setup
Setup
There is a 20km area of mid distance terrain, this should be generated as a bare minimum around the track to avoid the world edges being visible.
To import ASTER GDEM data the old ‘T’ key has been replaced with a new dialogue accessed from a button in the paint tools tab. The area option controls the amount of data, the data type allows a choice of SRTM and ASTER data sources.
Aster data is available on the web as .tif files.
Very distant terrain may also be generated using the distant terrain button, this generate very low res 4km x 4km patches from the height field data, this is saved to the file DistantPatches.bin.
Usage
To import terrain use the import terrain button up to 19 x 19km squares can be imported at once.
To generate distant terrain patches, import terrain for all required areas, then while in tile 0,0 use the generate distant terrain button to build distant terrain patches. Save (F2) after generation.
Performance Constraints
Distant patches have some overhead and should only be used as required.
Static consists & COPs
Setup
RW3 now supports AI pick up rail vehicles in addition to drop of.
Usage
● Setup as per Player consist operations
● AI can only pick up consists from the starting location in the scenario
● The scenario creator is responsible for making sure the path takes the driver around the consist if the train must run around to do the collection.
● AI will fail to get the pick-up point correct (and therefore crash) if:
○ The consist order is wrong
○ The consist has extra or missing elements
○ Duplicate rail vehicle numbering makes the correct consist difficult to identify
○ The consist to pick up moves prior to the pick up
Static consists now present warnings in the scenario creator, these should be investigated as they may lead to AI crashes. The links are click-able so the scenario creator can examine where the paths overlap.
Performance Constraints
None
Fire & particle shaders
Setup
The particles are st-up as in RW2. However, a new field has been created in the Particle XML to allow particles to be lit or unlit.
● TrainParticleDefault - for normal smoke etc (this will be lit/darkened at night)
● TrainParticleEmissive – for things like flames etc (this will remain fully illuminated)
●
Ensure that the correct shader is specified in the Particle XML
Usage
Diesel smoke, house smoke, fire, steam etc
Performance Constraints
Tunnel ambient shader setup
Setup
These three new shaders are specifically for use on tunnels. They create an ‘ambient occlusion’ effect where the entrance and exit of the tunnel are ‘brighter’ and the middle section of the tunnel darker. The length of the ‘brightened’ section of the entrance and exit is fixed and cannot be modified.
LoftTunnelTexDiff.fx - Used on the rails.
LoftTunnelTexDiffTrans.fx - Used on the ballast if transparent edges are required.
LoftTunnelBumpSpec.fx - Used on the tunnel walls. Allows for normal maps and specular.
Usage
These shaders should be used on tunnel walls, tunnel track rails and tunnel ballast.
Performance Constraints