Images2TGA Tutorial.pdf

(644 KB) Pobierz
Tools for Asset Repair by PEV Image by Alberte Zato
Images2TGA Revision 1.1 to suit Images2TGA Version 1.15
30 August 2012
This tutorial was originally written for John King's Trainz
Resources News Letter.
Texture2TGA that just performed the conversion. Now I
supply Images2TGA that has many more features.
Introduction
I don't propose to write about reskinning. Sufficient to say
that many tutorials are available so I will just say that the
Images2TGA tool can assist in this process.
Trainz uses a render engine called Auran Jet to display and
move objects within the simulator. Auran Jet supports a
suite of proprietory file formats that define 3d objects,
surfaces, animations, sounds and so on.
Repairing Downloaded Assets
TS2009, TS2010 and TS12 only support DXT compressed
textures which are made by conversion from image files
when assets are committed into the game by the Content
Manager program. If you wish to download or import an
asset from an earlier version and it has texture files in the
Auran binary *.texture format, you will find that Content
Manager will not import them. To succeed the textures must
be converted to TGAs. I recommend using my
Images2TGA to convert to TGA files and generate the
required *.texture.txt files.
Any 3d object or surface can be modelled as a series of
triangular facets, on to which surface colouring (textures)
are added. All of this information is gathered together in a
"mesh". The mesh contains all of the 3d geometrical data
needed to define the shape of the object as well as the
texture specifications to select surface colouring, and the
texture mapping details to correctly place the texture images
on to the various portions of the surfaces.
The progressive mesh was the same as the indexed mesh
but with the addition of data that could simplify the mesh for
distant viewing. (lower the Level Of Detail). Auran later
chose to use multiple 'im' meshes instead of a single 'pm' for
their LOD method.
What Can Images2TGA Do?
The Indexed Mesh contains references to 'textures' for
surface colouring. A 'texture' is a special form of image file
with in-built features to achieve LOD and to control
rendering within the game. The latest versions (TS2009
onwards) use DXT compression to reduce texture file size.
DXT compressed images are now directly supported by
most video cards.
1. Display images. The program can open any image type
used in Trainz and display the image and alpha image (if
present) Trainz supports .texture, .TGA, .JPG, and .BMP
image files. All of these can be opened. All images can be
viewed full size. Transparent sections can be viewed
against a selectable coloured background.
2. Convert to other formats. Once opened an image can
be saved back to .TGA, .JPG or .BMP formats. There is no
need to save to .texture files as these are created when
assets are committed into the game. When texture images
are saved to TGA format the appropriate *.texture.txt file is
generated automatically.
Reskinning
Many users of Trainz wish to make their own versions of
rolling stock or scenery based on existing assets in the
game. This can be done by recolouring the existing assets;
a process called 'reskinning'
3. Add or remove Alpha channels.
To reskin an asset the textures need to be edited. The
Auran texture format cannot be opened with normal imaging
programs like Photo Shop, Paint Shop Pro, or the Gimp.
Hence I decided to provide an intermediate conversion to a
format that could be readily edited. I chose the TGA format
because it supports an in-built Alpha channel for
transparency. Initially I provided a program called
4. Open the image or alpha image in you favourite
image editor.
5 Merge an external image as an alpha channel.
© Peter Villaume (PEV) 2010 1
893872404.009.png
Using Images2TGA
in Windows explorer and point it to this program before this
will work.
Installation
The name of the Last File opened is also displayed. Click on
that to re-open the file.
If you don't have this program, please download its installer
program (PEVImages2TGA_setup.exe) from my PEVSoft
Download page.
The Exit option closes the program.
Once the file is opened its image is displayed along with any
alpha channel.
http://www.members.optusnet.com.au/~villaump/pevsoft.htm
Run the installer and the program will be loaded on to the
Program Files area of your C: drive, along with a desktop
icon and an entry in the PEVSoft folder of your All Programs
menu.
Setup
Before attempting any conversions you should connect
Images2TGA to your favourite image editor (Photo Shop,
Paint Shop Pro, Gimp or what ever.)
To set up editing, open the Images2TGA program and click
on the 'Setup/Editor' in the main menu. You will be
prompted to locate your favourite image editor. An open file
dialog will appear allowing you to browse to your editor
program. Click on it to select and save its location for future
use.
Full sized versions of the images can be viewed by right
clicking on either image and selecting Display Actual Size
from the pop-up menu.
“Setup/OpenWith” creates the 'OpenWith' macros for
Content Manager for TS2009, TS2010 and TS12. This
allows you to run Images2TGA directly from the Content
Manager.
If you have installed Trainz TS2009, TS2010 and/or TS12 in
the default folders then this process is completely automatic.
If the “OpenWith” installer cannot find a Trainz installation it
will present a folder search dialogue window and ask you to
locate the installation. If you don't have that version
installed press the “cancel” button. Otherwise locate the
Trainz application folder.
In Content Manager you will find that you now have an
Open With option in the right click popup menu. Using this
option Images2TGA will automatically search the opened
asset folder and its sub folders for texture files to convert to
TGAs. All textures in the asset should be converted and
appropriate texture.txt files created.
I recommend, also, that you you make Images2TGA.exe the
program that opens *.texture files when you double click
them in Windows Explorer.
Opening a File.
The program can open Trainz Image files only. (.texture,
.TGA, .BMP or .JPG)
Transparency can be enabled to view masked or blended
alpha images against the window background. To view
transparent, right click on the main image and select Display
Transparent from the pop-up menu.
To Open a File,start the program and click on the File menu.
Click on Open and the open file dialogue box will be
displayed. The file extensions are filtered so only the correct
types are available.
Files can also be opened by double clicking in Windows
Explorer. You must add the .texture file extension to the list
© Peter Villaume (PEV) 2010 2
893872404.010.png 893872404.011.png
Creating an Alpha Mask
A masked alpha channel can be added or substituted for an
existing alpha image.
The mask is created by right clicking on the main image,
and selecting Create Alpha Mask from pop-up menu.
Note that the transparent portions of the image have a
checker board pattern in the background colour. As below:
The tolerance input window will open and you can adjust the
colour tolerance with the spin-edit box.
The background colour can be changed by right clicking on
the main image and selecting Transparent Background. A
colour selector will appear for you to choose a new colour.
Convert To TGA
The opened Image can be saved as a TGA, BMP or JPG
file. If it has alpha data this will be lost if saved as BMP or
JPG. Hence the program automatically offers to save as
TGA when the image has been loaded from a texture.
The tolerance is the value plus or minus that is selected
from the RGB value (0-255) when you pick a colour (next
step).. So if you enter 5, any value between plus 5 and
minus 5 of the select colour value will be made transparent..
(Black on the alpha image).
To save an image, click on the File menu and then click on
Save As. The Save File dialog will be displayed and you
choose the file type to save, and enter a file name. Then
click the save button to complete the save of the file.
When you have accepted the tolerance value, the colour
picker is enabled. Notice that RGB values appear next to
the cursor and change as you move the cursor over the
main image.
When you save a *.texture to a TGA the program will
automatically make the appropriate *.texture.txt file.
(See first image on the next page)
If you have lots of textures to convert to TGA's use the trawl
facility included in this program..
© Peter Villaume (PEV) 2010 3
893872404.012.png 893872404.001.png 893872404.002.png 893872404.003.png
Click on the colour that you want to be transparent and the
new alpha mask will appear in the Alpha image panel, as
below:
Select Edit and your editor will open with the image in it
ready to edit.
Similarly to edit the alpha image, right click on the alpha
image and so on.
When ever you save the image file in your editor the file will
be updated in the Texture Viewer.
Note: In your image editor, do NOT save as a different file
name, just press the save button.. If you save to a different
file name, the connection to the Images2TGA will be lost,
and it will not reload the saved image.
Also, do not change the size of the image.. It will not merge
with the other channel if you change the size.
Trawling
Images2TGA can be used to trawl (or search) for images to
convert. Before attempting to trawl, the type of images to
convert to TGAs must be set.
Adjust the tolerance and try again if you are not satisfied
with the result.
Note that this process makes a masked alpha channel.
Masked alpha channels have only two values, black and
white or 0 and 255, in the colour data. If there is any pixel
with a value other than 0 or 255 the alpha channel is
considered blended.
For TS2009, you must be very careful to ensure that you
have only black or white in your alpha images. Any
intermediate values will hinder performance and in some
cases will not work in TS2009 native mode.
Editing the Main Image or Alpha Image
The image and alpha channel can both be opened for
editing in an image editor such as Gimp or Paint Shop Pro.
If you have connected Images2TGA to your editor as
explained in the SetUp section above, you can open your
editor from Images2TGA.
From the Options menu select the image type or types that
you would like to convert to TGAs.
To edit the main image, right click on the image to bring up
the pop-up menu.
© Peter Villaume (PEV) 2010 4
893872404.004.png 893872404.005.png 893872404.006.png 893872404.007.png
The Convert Textures option enables conversion of Trainz
Binary textures (.texture files) to TGAs.
The Convert Textures option is set by default when the
program is run for the first time after installation.
Content Manager 2 or 3), as detailed in the SetUp section
above, and as shown in the image of Content Manager
below.
If you click on " Images2TGA.bat " in the Open With menu
of Content Manager 2 or 3 the program will convert
whatever textures or images it finds to TGAs with texture.txt
files.
The Convert JPGs option enables conversion of JPEG
images to TGAs.
The Convert BMPs option enables conversion of BITMAP
images to TGAs
The files processed are listed in the text box below the
alpha image as the conversions progress. The program
keeps a log (named Trawl_Log.txt) of files found and shows
the actions taken on each file. The log is accessed from the
File menu and clicking on View Log. The log file
accumulates data every time trawl is started. The Log
should be deleted after large trawl conversions. A delete
option is included in the File Menu.
If none of the above options is set the progam will display a
message and do no conversions.
Trawling must be launched from the command line
(typically from the batch file in the 'Open With' menu of
© Peter Villaume (PEV) 2010 5
893872404.008.png
Zgłoś jeśli naruszono regulamin