-------------------------------------------------------------------------------
How i made the spanish 447 series train model for locomotion
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
This document try to bring some help to other modders who wants to model their own trains. I want to say thanks to the tt-forum users who posted some valuable info about locomotion and the models... And of course, thanks to Patchman, the author of locotool.
I need to say i don't write english very well, so feel free to modify the text making new versions with corrected phrases or pharagrahs or even the whole document

Feel free to place this text where u want, but i would like that my nick appear like original author (just Leone xD) and the tt-forums as the source where the article was placed. Please copy this paragraph too (with corrected english if u want) in the text u take from here.
Ive atached a ZIP file containing all the figures and files i've used.
Well, lets work. I followed these steps to make the model:
---------------------------------------------------------------------------
1. Collect data (if u want

---------------------------------------------------------------------------
Info about the train, some blueprints and so...
---------------------------------------------------------------------------
2. Modelling
---------------------------------------------------------------------------
I've done all 3d work in maya, but blender seems to be a very nice free 3D software. Texture the model and use metallic materials to give some reflections to the model trying to give it some realistic taste. There are huge modellng tutorials over Internet, but u dont need a high skill of 3D Design to make the model for the game.
---------------------------------------------------------------------------
3. Render your train
---------------------------------------------------------------------------
Well this is the hardest part. You need to place the camera at the rigth position and make several "shots" of the train at certain camera angles.
Placing the camera
------------------
At first u need to make a ortographic camera in the scene and place it the side of the model. Center the model in the camera view and set the vertical view angle to about 40º pointing to the center of the model. Your view must be something like figure 1 shows.
Placing the ligths
------------------
You need to place some ligths in the scene in order to make it seamless with the ligths and shadows in the game. I will tell the best i could the position of the objects. I've used the following light set (see figure 2):
1 Directional ligth (acting like the sun in the game)
-45º (x) -45º(Y) -> pointing to 45º left and 45º down. When you rotate the model 45ºccw it will have the more ligth in the viewable side. Set intensity to 100%
1 Point ligth to make the shadow zones brigther
Placed not too near of the model, at the same Y axis position of the train model (you can see the distance proportions in the top view of figure 3). Set intensity to 60%
Rotating and render the model
-----------------------------
Ive done this work in maya using a script to make the object rotate the exact angle and then make a "shot", rotate to next angle and make a "shot" and so... You can view the scripts in the atached file.
These are the angles i've used (all rotations starts at 45º):
----- Head -----
Ground level shots
64 shots (images 000 to 063)
vertical angle 0º
angle step = (360/64)
Medium up inclination
4 shots (images 064 to 067)
vertical angle 6º
angle step = 90º
Medium down inclination
4 shots (images 068 to 071)
vertical angle -6º
angle step = 90º
Full up inclination
32 shots (images 072 to 103)
vertical angle 12º
angle step = (360/32)
Full down inclination
32 shots (images 104 to 135)
vertical angle -12º
angle step = (360/32)
----- Motor carriage -----
Ground level shots
32 shots (images 000 to 031)
vertical angle 0º
angle step = (180/32)
Medium inclination
4 shots (images 032 to 035)
vertical angle 6º
angle step = 90º
Full inclination
32 shots (images 036 to 067)
vertical angle 12º
angle step = (360/32)
Render the model at high resolution, like 1600x1200 or more (later i'll tell u why), but with NO antialiasing to avoid that not totally transparent pixels at the edges of the model in the game.
Put the background of the image to the blue color to use it as transparent color later (blue: #0000FF)
Run the script in script editor and go to watch tv

---------------------------------------------------------------------------
4. Tranform the rendered images
---------------------------------------------------------------------------
Well the next step is to tranform the images changing the actual palette to the Locomotion palette. And of course, reducing the image size.
I've used Adobe Photoshop CS to make this part in spanish, so the translation may be inaccurate.
I made an action, its like a macro that u can run in all the images of a directory. Record this steps in the action:
1 - Open one of the images u rendered
2 - Choose "Save for the Web" option in the File menu
3 - Choose PNG-8, and leave the rest by default (u can try to change for testing)
4 - in the color table tab, click on the small right arrow to the rigth of that small tab bar (not the one above the image) and choose load color table. Select loco.act (see the attached file).
5 - Shwitch to size tab and select 128x96 as the new size, and important, select the fist option in the quality droprown list (i use this in order to avoid edge graphic transparency errors). We rendered the images using so high resolution to make no jagged edged with no antialiasing, and this way we help Photoshop to do better the image resampling without a bilinear o similar interpolation algorithm, just pixel aproximation.
6 - Click Apply
7 - Save the image
8 - Close the image opened without saving changes
Stop recording the action. Now we will apply that macro to all the files in a folder:
1. File Menu -> "Automatice" -> Batch...
2. Select the new created action
3. Source: Folder, and select the folder the images are in
4. Destination: Save and close
5. Click OK
---------------------------------------------------------------------------
5. Making the DAT file
---------------------------------------------------------------------------
I've used the TGV DAT file as model. Extracted the images and the xml with locotool. Then replaced the images of the TGV with ones i created.
I modified the XML to place the graphics at the correct position setting the same xofs and yofs ONLY for all the images we created, leave the bogey images alone

<sprite id="0" xofs="-63" yofs="-57">
Adjust that numbers to your model, but all the images need to be the same xofs and yofs (except the bogey ones like i said before)
You will need to adjust the bogey position and the distance between bogeys. Ive used these options:
<variable name="length" size="1">50</variable>
<unknown name="field_1" size="1">32</unknown>
<variable name="bogeypos" size="1">160</variable>
(extracted from xml generated by locotool 0.4)
---------------------------------------------------------------------------
6. Play the new model
---------------------------------------------------------------------------
At last, test if your model have the aspect u want, and then share with us!
