Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Sign in to follow this  
Julien

Nouvelle documentation. En anglais...

Recommended Posts

Julien    659

Bonsoir,

 

Derek a posté sur UKtrainsim cette documentation interne qui répond à pas mal de questions qu'on peut se poser sur les nouveaux shaders et blueprints. Faites en bon usage !

 

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

Performance Constraints

 

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

Share this post


Link to post
Share on other sites
fildefer    1,612

Bonjour,

Très, très interessant. C'est le tuto que j'attendais :D . Je vais faire des essais!

Amitiés.

Share this post


Link to post
Share on other sites
fildefer    1,612

Bonjour,

Petite démontration de ce que l'on peut faire avec les nouveaux éclairages. La cabine est ici éclairée par un "point light", avec une texture de jour normale. De plus, avec le shadow caster et le day/night validé, on obtient de belles ombres et une cabine qui s'éclaire automatiquement à la nuit tombée!

Amitiés.

  • Like 1

Share this post


Link to post
Share on other sites
fildefer    1,612

Re...

Deux autres screens sur les feux par une belle nuit d'été sur la test track.

Amitiés.

  • Like 1

Share this post


Link to post
Share on other sites
Julien    659

Superbe !

 

Tu as utilisé des spots pour l'arrière ou des points lights ?

  • Like 1

Share this post


Link to post
Share on other sites
fildefer    1,612

Bonsoir Julien,

J'ai utilisé des spot mais avec un réglage différent: Radius 5, Phi 70, Theta 50.

Share this post


Link to post
Share on other sites
Spud    145

J'avais pas vu est c'est vrai que ça rends super bien avec les nouveaux effets....

 

Bye

Share this post


Link to post
Share on other sites
Julien    659

Bonsoir Julien,

J'ai utilisé des spot mais avec un réglage différent: Radius 5, Phi 70, Theta 50.

 

Et pour l'avant ? Juste un spot ?

 

 

J'avais pas vu est c'est vrai que ça rends super bien avec les nouveaux effets....

 

Bye

 

Oh toi je sens que tu ne vas pas rester longtemps calé sur ton jeu de tank ;)

Share this post


Link to post
Share on other sites
dom107    157

Bonjour,

On n'a plus besoin de créer une face avec le shader AddaTex pour avoir la vitre du phare allumée (en plus du faisceau d'éclairage) ?

L'objet spot light permettrait alors de créer à la fois le faisceau et l'allumage de la vitre du phare. La vitre du phare s'allume selon la texture appliquée à l'objet spot light.

C'est bien ça ?

Share this post


Link to post
Share on other sites
Julien    659

Non dom, l'emetteur lumineux est invisible. L'objet lumineux est toujours nécessaire

Share this post


Link to post
Share on other sites
dom107    157

Merci pour cette précision.

Pour les phares, rien ne change dans le modèle de loco lui-même (sauf dans le cas de la BB17023 où je devrais enlever la simulation de projection utilisant une face animée).

Il faut ajouter via les fichiers blueprint les objets spot ou point.

Donc un bête cube doit convenir celui-ci ne servant que de support à la fonction lumière qu'on lui a paramétré.

Share this post


Link to post
Share on other sites
fildefer    1,612

Bonjour,

Pour Dom 107: L'objet support du spot light apparait dans le jeu mais semble très difficile à placer correctement. En effet, pour placer le spot light dans le blueprint, il faut utiliser le gizmo de l'asset editor. La manipulation est rien moins qu'imprécise ! Il est donc nécessaire, après exportation de faire les corrections au niveau du fichier .bin avec RWTools. Pour information: la 11ème ligne de <Element> correspond à l'orientation du faisceau lumineux (le faisceau est toujours dirigé vers l'avant du support dans les coordonnées du monde. Il faut donc faire tourner le dit support dans la direction souhaitée). 1=vers l'avant, -1=vers l'arrière, la 13ème défini la position latérale (gauche ou droite), la 14ème hauteur et la 15ème la position longitudinale par rapport aux coordonnées de l'objet (x,y,z à 0). Le support de la source lumineuse doit être aux coordonnées x,y,z à 0 lors de sa modélisation. Personnellement, je me sert d'une plane avec une texture quelconque que je ne fais pas apparaitre dans le jeu et qui me sert à prépositionner la lumière dans l'asset editor. Je me sert (pour les feux) des anciens feux de RW2 pour faire apparaitre la lueur de ceux-ci en face des phares.

Pour Julien: lorsque j'exporte mon spot light dans le jeu, l’émetteur apparait bien, mais dés que je modifie sa position, il disparait. C'est pourquoi j'utilise toujours les anciennes "lights" de RW2. A creuser !

A l'avant, spot light avec R=1, G=0.937255, B=0.764706, Radius=70, Phi=40, Theta=15. A l'arrière, Radius=5, R=0.639216, G=0, B=0. Pour la cabine, point light avec R=1, G=0.9569, B= 0.8667.

Amitiés.

Share this post


Link to post
Share on other sites
fildefer    1,612

Bonsoir,

Encore une précision concernant les corrections à apporter au fichier .bin, si le ligne 11 est à -1, la première ligne doit aussi l'être, faute de quoi le feu disparait lorsque l'on s'éloigne latéralement.

Amitiés.

Share this post


Link to post
Share on other sites
pml3    311

Bonsoir,

 

Avec toutes ces infos, je souhaite appliquer les nouveaux éclairages à la motrice du TGV.

Mais c'est que je m'en vois ;(

Dans le simu, les lumières apparaissent mais ne sont pas commandées par la touche H...

Je crois avoir respecté les normes :

phares blancs avant :

1_0000_Fwd_Headlight_01

phare frontal avant blanc :

1_0000_Fwd_Headlight_02

phares rouges avant :

1_0000_Bwd_Taillight

 

J'ai gardé les éléments des phares origines qui fonctionnent bien avec H.

 

Sans H, les cônes sont déjà apparents !

Remarque, je trouve le faisceau de phare de RS bien pâlichon.....

RS2010-eclairage.jpg

 

et avec H, surimpression de mes phares

RS2010-eclairage2.jpg

 

 

Fildefer, auras-tu une idée : je dois avoir un paramètre faux quelque part ?

blueprint spotlight :

phares blancs : R=100 (metres de rayon), PHI=20 (degrés, angle d'ouverture du cône des phare sur le plan latéral) et THETA=20 (degré, angle d'ouverture du cône sur le plan vertical) si j'ai bien compris.

phare frontal blanc : R=30, PHI=20, THETA=0

phares rouges : R=5, PHI=70, THETA=50

et eclairage cabine en pointlight avec un R=4, je le trouve correct mais bien discret.

 

Merci de ton avis !

 

Patrick

Share this post


Link to post
Share on other sites
fildefer    1,612

Bonjour Patrick,

Effectivement, chez moi aussi, les feux ne sont plus commandés par la touche H. C'est logique puisque le feux ne sont plus dans les "controls" mais en "children". Il doit falloir reprogrammer le control headlights. Mais là, ça me dépasse ! Pour tes coordonnées de feux: R est la distance où porte le rayon lumineux, Phi est l'angle du cône de lumière diffusée et Theta est l'angle du cône de lumière plus intense à l'intérieur du cône Phi. Essaye r=100, Phi=70 et Theta= 30.

Pour la cabine, essaye d'augmenter ton rayon à 5, en cochant "cast shadow" (pas "casts shadows) pour que la lumière de la cabine ne filtre pas à l'extérieur (défini ton fichier 3D avec un LOD court pour économiser les polys) et, si tu veux que ton éclairage de cabine s'éclaire automatiquement en fonction de la nuit, "Day night cycle". L'avantage du point light éclairage cabine, c'est que ta cabine sera éclairée aussi en vue intérieure (voir screen joint) sans recourir à une texture de nuit ni modifier ton fichier Cab !

Amitiés.

Share this post


Link to post
Share on other sites
dom107    157

Bonjour,

 

Je note que le positionnement du regard du conducteur fonctionne.

J'ai mis dans Cab camera.xml :

X=0

Y=-0.2

Z=0.97

Voilà qui va permettre de conduire plus agréablement la BB17023 surtout quand on fait des transitions vue intérieure / vue extérieure.

 

Je note aussi que dans l'éditeur de blueprint, le nom des contrôleurs (ou enfants) est affiché sans avoir besoin de déplier les détails de chaque contrôleur.

 

Pour les feux, j'ai fait un test des feux pour voir rapidement ce que cela donne (le positionnement du feu dans asset editor c'est crispant).

La touche H commande à la fois la projection et la lumière de la vitre des phares.

Il n'y a pas de lien entre le nommage de la hiérarchie dans le modèle et le nommage des enfants de type spot light.

 

Dans le modèle j'ai toujours light_revhead, light_fwdtail, light_fwdhead, light_revtail (avec les bons chiffres devant, 3DC s'en occupe automatiquement dans ce cas)

Pour le moment j'ai déclaré 2 enfants dans le blueprint principal : Fwd_Headlight_01 et Bwd_Headlight_01.

 

Les conducteurs sont pris en compte dans le fichier xml mais le positionement n'est pas correct.

Share this post


Link to post
Share on other sites
dom107    157

J'ai utilisé les paramètres proches de ceux de fildefer : R=1, G=0.937255, B=0.756863, Radius=70, Phi=40, Theta=15

RW3_Phares01.jpg

RW3_Phares02.jpg

Share this post


Link to post
Share on other sites
fildefer    1,612

Bonjour dom107,

Ça rend bien ! Ces paramètres me paraissent satisfaisant. Pour le TGV de pml3, il faudrait peut-être augmenter la portée. Ceci dit, en matière d'éclairage de train, les feux sont destinés à permettre au train d'être vu et non à éclairer la voie au même titre que les phares des automobiles.

Amitiés.

Share this post


Link to post
Share on other sites
dom107    157

Les conducteurs sont pris en compte dans le fichier xml mais le positionnement n'est pas correct.

Après un export, je vois ce soir que c'est corrigé. Le positionnement est bon.

Share this post


Link to post
Share on other sites
GerardS    549
Ceci dit, en matière d'éclairage de train, les feux sont destinés à permettre au train d'être vu et non à éclairer la voie au même titre que les phares des automobiles.

 

Bonjour

 

 

Là, je crois que tu es resté au temps de la vapeur, sur les locs actuelles les projecteurs éclaires quand même les voies.

D'ailleurs ils comportent deux positions, feux de croisement et projecteurs.

Cordialement

Geluc

Share this post


Link to post
Share on other sites
dom107    157

D'ailleurs ils comportent deux positions, feux de croisement et projecteurs.

... mais TS ne semble pas avoir prévu 2 commandes séparées (1 feux de croisement et 1 projecteur).

Share this post


Link to post
Share on other sites
GerardS    549

Bonjour

Comme j'ai roulé sur vapeur, diesel et électrique, c'était juste un petit souvenir.

Et je reconnais que le 63500, même en position projecteur était loin de l'éclairage automobile.

Pour TS2012 , pour moi une seule position suffit largement.

Cordialement

GELUC

Share this post


Link to post
Share on other sites
dom107    157

Beau rendu des voies utilisant LoftBumpTrans.fx et LoftTexDiffSpec.fx (vu sur le forum 3DCrafter).

RW3_Voies.jpg

Share this post


Link to post
Share on other sites
Sign in to follow this  

×