MeshTextViewer Tutorial.pdf

(254 KB) Pobierz
Tools for Asset Repair by PEV Image by Alberte Zato
Using PEV's Mesh Text Viewer for asset fault finding
This is the last in this short series of tutorials on using my
PEVSoft Trainz tools.
Introduction
The Mesh Text Viewer program displays the contents of
the mesh in English and adds the names of the various
properties coded into the mesh. With a little experience
you can see what is causing some of the annoying errors
that Content Manager throws at you. To assist I have
attempted, here, to deal with a few of the common errors
that are caused by the data in the meshes.
The mesh is the primary data object in the display of 3d
objects in Trainz. The sim supports two mesh formats, the
Progressive Mesh (PM) and the Indexed Mesh (IM). The
progressive mesh is the more complex with data included
to simplify the mesh for distant viewing (Level of Detail
adjustments). Auran have changed how LOD is handled
by supporting multiple IM meshes, and in the process they
have obsoleted the PM mesh.
So, for example, you may download an asset from the
Download Station that has these errors (plenty of assets
do) and you can't get it to commit into the sim. How do
you know what's causing the rather cryptic error messages
that Content Manager presents to you? Read on...
As Trainz has evolved through its various versions some of
the mesh properties used by the render engine have
become more significant, and in a couple of cases these
properties now cause errors that prevent an asset from
being committed into the Trainz Asset Database.
To repair an asset, read the error messages carefully and
act upon them one by one.
The mesh is basically a string of numbers with a few
identifiers scattered through it so deciphering with a hex
viewer is nigh on impossible. Fortunately Auran published
the mesh format and the creation of a parsing program
was done ages ago by Jack Emmerichs (user JFE). My
work follows on (with Jack's permission) from where he
started.
© Peter Villaume (PEV) 2010 1
893872400.010.png
Errors caused by: missing textures.
As you can see from the listing below from Mesh Text
Viewer the texture name also has the path of the file.
Ignore this.. Trainz always looks for the textures in the
folder where the mesh is located. Anywhere else will
cause the missing textures message.
Content Manager presents the user with the "Cannot find
texture 'name' in mesh 'name'." message when a texture is
missing from the asset.
The message is displayed when attempting to commit an
asset into TS2009/10. In the case of the listing below, the
env_metal.texture.txt and env_metal.tga were located
incorrectly, so the mesh could not find the texture, as the
error message rightly pointed out. Using the Mesh Text
Viewer we get the listing from which I was able to confirm
that the env_metal.texture was required by the mesh. So I
copied it into the correct folder.
80 Chunk ID: MATL Size: 316 (next chunk: 404) Version: 102
92 Material Name Size: 44
96 Material Name: *throttle_housing*A3FC19C5*mtl #1*m.reflect
140 Property Count: 0
144 Two Sided: 0
148 Opacity : 1.000
152 Ambient 1.000, 1.000, 1.000
164 Diffuse 1.000, 1.000, 1.000
176 Specular 1.000, 1.000, 1.000
188 Emissive 0.000, 0.000, 0.000
200 Shininess : 0.100
204 Number of textures: 2
208 Texture Type: 1 = TEX_DIFFUSE
212 Texture Name Size: 88
216 Texture Name: C:\Program
Files\GMax\gamepacks\Trainz\PEVAssets\EMU_cab\Levers\throttle_housing.texture
304 Texture Amount : 1.000
308 Texture Type: 9 = TEX_REFLECT
312 Texture Name Size: 84
316 Texture Name: C:\Program
Files\GMax\gamepacks\Trainz\PEVAssets\EMU_cab\Levers\env_metal.texture
400 Texture Amount : 0.100
404 Chunk ID: GEOM Size: 9736 (next chunk: 10148) Version: 200
Repair Strategy
*.texture file name. Use my Images2TGA tool to open
the .texture file. It should tell you the size of the texture in
pixels and also tell you the file is uncompressed. Since
only DXT compressed textures are supported in
TS2009/10, use my Images2TGA tool to convert the
textures to TGA images. The *.texture.txt files will be
automatically generated. The required compressed
textures (that we never see) will be produced when you
commit the asset into Trainz. If you use the "OpenWith"
menu in Content Manager for TS2009/10 and open with
Images2TGA.bat, it will convert all *.textures it finds to
TGAs...much easier.
Where a commonly used texture.txt and image are
missing, they can be copied from other assets. Textures
such as env_metal, env_glass, black, red and so on are
examples.
If the missing texture is a minor one for the object it may
be possible to view the mesh in my Trainz Mesh Viewer
and see where on the object the texture is missing. The
missing texture portion of the mesh will be rendered white.
Make a small image of an appropriate colour to fit the
missing portion. Don't forget that a texture.txt is needed as
well.
If the main texture for an asset is missing it is difficult, if not
impossible, to create an appropriate texture from scratch.
Such an asset would most likely be a write-off.
If you have downloaded an asset that contains early Auran
binary textures, you will also be confronted with missing
textures message. In this case the texture files will have a
© Peter Villaume (PEV) 2010 2
893872400.011.png 893872400.012.png 893872400.013.png
 
Errors caused by: Unsupported texture
types
The listing below from Mesh Text Viewer illustrates an
attempt to use texture slots in GMax/3dsMax that are not
supported by Trainz. Pre-TS2009 versions simply ignored
unsupported texture types. However TS2009 introduced
checking of texture types and meshes such as this
example are rejected by the Content Manager 2.
Unfortunately the error message presented to the user is
misleading. In this case it says "Cannot find texture
'mainkfc.texture' in mesh 'kfc.im'." .. but it's present in the
folder isn't it..
80 Chunk ID: MATL Size: 480 (next chunk: 568) Version: 102
92 Material Name Size: 44
96 Material Name: *KFC-Australia*16A5E8E7*7 – default*m.onetex
140 Property Count: 0
144 Two Sided: 0
148 Opacity : 1.000
152 Ambient 0.973, 0.973, 0.973
164 Diffuse 0.973, 0.973, 0.973
176 Specular 0.573, 0.573, 0.573
188 Emissive 0.000, 0.000, 0.000
200 Shininess : 0.320
204 Number of textures: 5
208 Texture Type: 1 = TEX_DIFFUSE
212 Texture Name Size: 60
216 Texture Name: R:\TRS2004Copy\World\Custom\Trains\KFC-Oz\mainkfc.texture
276 Texture Amount : 1.000
280 Texture Type: 2 = TEX_SPECULAR
284 Texture Name Size: 60
288 Texture Name: R:\TRS2004Copy\World\Custom\Trains\KFC-Oz\mainkfc.texture
348 Texture Amount : 1.000
352 Texture Type: 3 = TEX_SHINE
356 Texture Name Size: 60
360 Texture Name: R:\TRS2004Copy\World\Custom\Trains\KFC-Oz\mainkfc.texture
420 Texture Amount : 1.000
424 Texture Type: 4 = TEX_SHINESTRENGTH
428 Texture Name Size: 60
432 Texture Name: R:\TRS2004Copy\World\Custom\Trains\KFC-Oz\mainkfc.texture
492 Texture Amount : 0.200
496 Texture Type: 5 = TEX_SELFILLUM
500 Texture Name Size: 60
504 Texture Name: R:\TRS2004Copy\World\Custom\Trains\KFC-Oz\mainkfc.texture
564 Texture Amount : 1.000
568 Chunk ID: GEOM Size: 34288 (next chunk: 34864) Version: 102
Here the SPECULAR, SHINE, SHINESTRENGTH, and
SELFILLUM textures are not supported by Trainz. (The
TEX_ prefix identifies the texture type number as a texture
name constant in the game code.)
Repair Strategy.
My PM2IM program removes the unsupported texture
references from both PM and IM meshes. The resulting IM
mesh is supported by TS2009 onwards. If the above
example had been a PM mesh the unsupported textures
would have been automatically removed in the conversion
to IM.
Trainz only supports DIFFUSE, BUMP, and REFLECT
texture types. All other effects are achieved by judicious
use of the alpha channel on these three texture types, the
numerical settings for the ambient, diffuse, and specular
colours for the material, and the correct use of the material
names.
In the example above the material name ends with
"m.onetex" telling Trainz there is only one texture when in
fact there are five. Notice also that all slots point to the
same texture, another no-no. Each slot must point to a
separate texture, as in the example in the first listing.
© Peter Villaume (PEV) 2010 3
893872400.001.png 893872400.002.png 893872400.003.png
 
Errors caused by: missing attachments
attachments specified in the config.txt with those in the
listing. If you find a discrepancy alter the name in the
config.txt to match that in the mesh.
Missing attachment points are a common ocurrance in
assets imported into TS2009/10. Fortunately this time the
error message from the Content Manager clearly defines
the problem. Again open the mesh in Mesh Text Viewer
and go to the attachment portion of the mesh (close to the
end of the listing.)
If an attachment specified in the config.txt is missing from
the mesh, consider if you can live without the item that it
hosts. If not then use my AttachmentMaker program to add
the appropriate attachment/s.
The listing below shows an attachment list for an interior
asset with the first couple spaced to show each
attachment's data.
In many cases I have found that the missing attachment/s
are caused by typos in the config.txt or in the attachment
name in the mesh. So compare the names of the
13912 Chunk ID: ATCH Size: 1676 (next chunk: 15596) Version: 100
13924 Attachment Count: 25
13928 Attachment Name size: 16, Name: a.red_mushroom
13948 Orientation: [1.000, 0.000, 0.000]
13960 [0.000, 0.981, -0.196]
13972 [0.000, 0.196, 0.981]
13984 Position: [0.004, -0.626, -0.472]
13996 Attachment Name size: 16, Name: a.blue_button1
14016 Orientation: [1.000, 0.000, 0.000]
14028 [0.000, 0.981, -0.196]
14040 [0.000, 0.196, 0.981]
14052 Position: [0.165, -0.560, -0.487]
14064 Attachment Name size: 16, Name: a.blue_button2
14084 Orientation: [1.000, 0.000, 0.000]
14096 [0.000, 0.981, -0.196]
14108 [0.000, 0.196, 0.981]
14120 Position: [0.164, -0.502, -0.498]
14132 Attachment Name size: 16, Name: a.blue_button3
14152 Orientation: [1.000, 0.000, 0.000]
14164 [0.000, 0.981, -0.196]
14176 [0.000, 0.196, 0.981]
14188 Position: [-0.156, -0.560, -0.487]
14200 Attachment Name size: 16, Name: a.blue_button4
14220 Orientation: [1.000, 0.000, 0.000]
14232 [0.000, 0.981, -0.196]
14244 [0.000, 0.196, 0.981]
14256 Position: [-0.156, -0.502, -0.498]
etc down to
15460 Attachment Name size: 16, Name: a.horn_button
15480 Orientation: [1.000, 0.000, 0.000]
15492 [0.000, 0.981, -0.196]
15504 [0.000, 0.196, 0.981]
15516 Position: [-0.001, -0.272, -0.545]
15528 Attachment Name size: 16, Name: a.green_button5
15548 Orientation: [1.000, 0.000, 0.000]
15560 [0.000, 0.981, -0.196]
15572 [0.000, 0.196, 0.981]
15584 Position: [-0.169, -0.272, -0.544]
15596 Eof
Repair Strategy
Or, add missing attachments with my AttachmentMaker
tool.
As already mentioned, compare the listing attachment
names with those in the config.txt, and fix any non-
matches in the config.txt.
© Peter Villaume (PEV) 2010 4
893872400.004.png 893872400.005.png 893872400.006.png
 
Specular Lighting Problems
Mesh Text Viewer can help in sorting out object lighting
factor issues. Each material has AMBIENT, DIFFUSE,
and SPECULAR lighting settings that control how the
mesh looks in Trainz. Early exporters from GMax and
3dsMax used default values for these colour properties
that cause an un-natural shine to appear on the object in
TS2009/10. The settings were all white (1.000 red, 1.000
green, 1.000 blue) as the listing from the Mesh Text
Viewer shows below.
We have found that changing the ambient and diffuse
colours from white, unlocks a default render property that
allows better use of these factors. It seems to give us
more control over the specular factor, allowing object shine
to be controlled. Keep this in mind when making new
assets for TS2009/10.
80 Chunk ID: MATL Size: 316 (next chunk: 404) Version: 102
92 Material Name Size: 44
96 Material Name: *throttle_housing*A3FC19C5*mtl #1*m.reflect
140 Property Count: 0
144 Two Sided: 0
148 Opacity : 1.000
152 Ambient 1.000, 1.000, 1.000
164 Diffuse 1.000, 1.000, 1.000
176 Specular 1.000, 1.000, 1.000
Repair Strategy
If you can re-export the mesh, more suitable values of
these colours for TS2010 would be
Ambient 0.750, 0.750, 0.750
Diffuse 0.750, 0.750, 0.750
Specular 0.830, 0.830, 0.830
PEV's Trainz Tools.
All of the tool programs mentioned above are available for
free download from
http://www.members.optusnet.com.au/~villaump/pevsoft.htm
If you only have the mesh, then use my PM2IM program
with the "Zero Speculars" option set to make the specular
values 0.00, 000, 0.00. (black). Please note that the latest
version of my PM2IM tool allows you to adjust the
SPECULAR setting to any colour you wish. This give you
control over specular effect when the object is rendered in
the game. You should experiment with colours to find
what suits you best.
© Peter Villaume (PEV) 2010 5
893872400.007.png 893872400.008.png 893872400.009.png
 
Zgłoś jeśli naruszono regulamin