PM2IM Tutorial.pdf

(549 KB) Pobierz
Tools for Asset Repair by PEV Image by Alberte Zato
PM2IM Revision 3 12 August 2012
This is the second in a series of tutorials where I describe
the use of the tools I have written to bring assets up to
date for TS2009/10 and TS12.
What Can PM2IM Do?
1. Convert one PM mesh to IM format, from the File Open
menu or by double clicking on a PM in windows explorer.
Introduction
2. Trawl (or search) for PMs and convert any it finds to IM
format.
Reiterating the background, Trainz uses a render engine
called Auran Jet to display and move objects within the
simulator. Auran Jet supports a suite of proprietary file
formats that define 3d objects, surfaces, animations,
sounds and so on.
3. Remove unsupported texture types.
4. Change specular lighting to remove an unwanted shine
on object surfaces.
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.
5. Remove non-english characters from material and
texture names.
Using PM2IM
Installation
If you don't have this program, please download its
installer program from my PEVSoft Download page.
The Auran Jet mesh type is now the "Indexed Mesh"('IM')
which has superseded the "Progressive Mesh" ('PM').
http://www.members.optusnet.com.au/~villaump/pevsoft.htm
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. The PM method of collapsing the
mesh is a bit hit or miss as some of the content on the
DLS shows.
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.
If you have TS2009 or later, you can automatically set up
'OpenWith' macros for Content Manager in each Trainz
installation. When PM2IM is run for the very first time it
will attempt to install these macros. If you Trainz
installations are in the default locations this will happen
without any input from you.
PM meshes were obsoleted in TRS2006, though they still
work in the game. In TS2009, PM meshes cannot be
committed into the game by the Content Manager; so any
one doing reskins of assets with PMs will not be able to
commit them. So a way of changing PMs to IMs seemed
to be important.
As an example, the “OpenWith” macro for TS2009 is
located in the following base folder:
'C:\Program Files\Auran\TS2009\bin\CMPData\tools'
I created my first PM to IM converter for TRS2006. That
program took the PM mesh and stripped out those
portions of it which performed the LOD functions.
In this folder , the PM2IM program will make a new folder
named 'OpenWith' (one word). PM2IM then builds the
macro (a DOS batch file with the name "PM2IM.bat" or
similar) that looks as follows:
PM3IM Converter 2 is an all new version that performs the
same functions as well as those such as “strip textures”
and “adjust speculars” that were part of the previously
released version. This new version makes no changes to
the animation base data.
@echo off
"C:\Program Files\PEVSoft\PM2IM\PM2IM.exe" -trawl %1
© Peter Villaume (PEV) 2010 to 2012 1
893872403.003.png
To use the OpenWith facility select one or more items in
Content Manager 2, then right click to bring up the menu.
Select Open With, then click on PM2IM.bat.
The selected items will open for edit and the PM to IM
conversion will be done as they are opened.
I recommend, also, that you you make PM2IM.exe the
program that opens *.pm files when you double click them
in Windows Explorer.
Fig. 2.
Opening a File
The program can open .pm files only. (or .im files for
texture stripping).
Replace pm with im makes an im file with the same
name as the pm. The original pm file is deleted.
Make im of same name makes an file of the same name
and retains the original pm file.
Make im with new name makes an im file with whatever
name you enter into the edit box.
Choose an option and click on the “Convert” item in the
Main Menu and the conversion will proceed.
When completed the program will tell you that the IM file
has been created.
Fig. 1.
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 type can be opened.
Fig. 3.
Many PM's have incorrect values (usually 1.00,1.00,1.00)
for Specular lighting in the texture settings. With later
versions of Trainz these settings cause an unnatural shiny
look on object surfaces. To prevent this enable the Adjust
Speculars option.
Files can also be opened by double clicking in Windows
Explorer. You must add the .pm file extension to the list in
Windows explorer and point it to this program before this
will work.
The Exit option closes the program.
Convert to IM
When opened from the Start Menu or the desktop short
cut, the program will await a file open instruction from the
user. Click on the File menu. Click on Open and the open
file dialogue box will be displayed. The file extensions are
filtered so only PM will be visible. Select a PM to convert.
There are three options in the action list:
Fig. 4.
You can change the colour of the specular lighting by
clicking on the colour patch labelled “Specular” as shown
in Fig. 2. A colour picker dialogue will appear allowing you
to select a colour. A dark grey (near black) is
recommended for starters.
© Peter Villaume (PEV) 2010 to 2012 2
893872403.004.png 893872403.005.png 893872403.006.png 893872403.001.png
The program also checks for non english characters in
material names and texture names. It will automatically
replace any non-english characters with an underscore. If
this occurs a message is displayed showing the new
name. The name of the texture or texture.txt file will need
to be altered by the user to match the new name if a
texture name is changed.
function in Windows explorer, except that when it finds a
file it processes it without asking any questions. Trawling
can save many hours of work by automatically converting
PM's to IM's. TS2009 and later do not allow .PM files to be
committed into the game without flagging an error.
So if you have faulty content caused by the presence of
PM files (as flagged by CM2/3) you can use the CM2
search filter for faulty content and open it all for editing,
then apply the trawling process to the editing folder.
All messages are included in the log if you are using
trawling. The log can be viewed by selecting View Log
from the File menu.
The Exit option in the File menu closes the program.
To use Trawling you must launch this program from the
command line with the -trawl switch, or launch from the
Open With menu (right click) in Content Manager 2 or 3.
Trawling.
Here is an example of a faulty bogey in TS2009, caused
by the presence of a PM.
Trawling is the process where the program searches a
folder and ALL of its sub folders for Progressive Mesh files
to convert to Indexed Meshes. It is similar to the search
and the presence or absence of shadow meshes.
If you click on PM2IM.bat as shown the PM2IM program
will open in trawl mode and an IM mesh will be made for
every PM found in the search. In this case only one IM is
made. Please note the the config.txt file will require
alteration to get the IM mesh to show up in the game. I do
not include any instructions here for config.txt modification
because the config.txt changes depend on Trainz version
If launched in normal window mode (not minimised) you
can stop trawling at any time by pressing the Stop button...
If you press the Resume button the process will continue.
The files processed are listed in the main text box as the
conversions progress.
© Peter Villaume (PEV) 2010 to 2012 3
893872403.002.png
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.
The PM2IM program only reads the "diffuse, bump and
reflect" slots, so during conversion it automatically skips
the other slots. Hence I was able to add an option to be
able to open IM files so that unsupported texture
references can be removed from IM meshes as well.
To allow opening of IM files the “Open IM Files” option
should be set in the Options menu. You can also over-ride
this by manually choosing the file filter in the File Open
Dialogue.
Command Line
The program can be launched from the command line to
automatically start trawling for .PM files to make new IMs.
Any unsupported texture references are automatically
removed from PM meshes when they are converted to IM.
To remove unsupported texture references from an IM
mesh, open the IM file from the File menu and the File
Open dialogue. The IM mesh option can be found by
changing the file filter in the dialogue.
The command line format requires the switch "-trawl" to
enable trawling as in the example below
PM2IM.exe -trawl " c:\Documents and
Settings\userPEV\My Documents\PEVContent\Carz"
If you are happy to proceed press the Convert to IM button
and the unsupported texture types will be stripped from
the mesh.
In this case the trawling would start in the ...\Carz folder
and scan through all its sub folders looking for PM files to
convert.
PLEASE NOTE: the original IM file will be lost (over-
written) if you chose to remove the unsupported texture
types.
The program keeps a log of files found and shows the
action taken on each file. The log is accessed from the
File menu and clicking on View Log.
If launched from the command line with an IM file as
argument the process will proceed without any prompts.
The default for this option is to run minimised showing only
an entry on the Windows task bar. The program closes on
completion of the trawl.
This option to open IM's does not work when launched
with the trawl option. Trawling is only for converting PM's
to IM's.
If you wish to check the log file or view item by item
progress, restore the window from the task bar. In this
case the program will remain open on completion.
Program Options
The PM2IM program provides the following options:-
Adjust Speculars
If converting old PM's it is advisable to set the "Zero
Speculars" Option to prevent unwanted shine on
converted objects. If you require a shine leave this option
un-set and see what sort of result you get.
Remove Unsupported Texture Types
Some content creators made assets using additional
texture slots in GMax or 3dsMax. Slots such as "ambient,
shine, specular, selfilum" were used in an attempt to
enhance the appearance. In TS2009 onwards, the use of
these slots causes an error in Content Manager.
Unfortunately the error is poorly flagged as "Cannot load
texture 'texturename.texture'in 'meshname.IM'" even
though the texture is present in the asset folder.
Open IM Files
If you wish to open IM files by default for removal of
unsupported textures then set the "Open IM Files" Option.
This replaces the old “Strip Textures” option.
© Peter Villaume (PEV) 2010 to 2012 4
Zgłoś jeśli naruszono regulamin