QuickShadows Tutorial.pdf

(539 KB) Pobierz
Tools for Asset Repair by PEV Image by Alberte Zato
QuickShadows for TS12
This is an amended version of an article originally written
for John King's Trainz Resources Newsletter.
temp.XML file which is then converted to IM by Auran's
TrainzMeshImporter program. Auran's policy of having
their own software make all game content is thus
maintained. The TMI is included in the installer program.
Introduction
The shadow mesh (“shadow.im” or any other name set by
the user) is created in the same folder as the parent mesh
and requires no textures. It uses the "m.notex" material
that takes its colour from the light settings in the material.
The “m.notex” material is made two sided by default so
that all planes of the “Simple Shadow” mesh are always
visible when viewed with my Trainz Mesh Viewer tool.
The QuickShadows tool is provided to the Trainz
community for the generation of shadow meshes without
having to use 3DSMax, Gmax or Blender.
Many rolling stock items downloaded into TS2009 and
later show errors caused by missing shadow meshes, and
now TS12 has a runtime device that checks the polygon
count of shadow meshes. If a shadow mesh has more
than about 1300 polygons it is ignored and a crude box is
substituted, much to the annoyance of many users.
No 3D modelling or image manipulation programs are
required to make the shadow. The shadow mesh may be
moved within the asset folder structure (eg to a shadow
folder) and, of course, the shadow mesh will need to be
specified in the shadow container in the mesh table of the
config.txt file. Refer to the Content Creators' Guide for
Trainz Classics for advice on asset folder and file layouts.
CCGTC can be downloaded from the Auran web site.
The original QuickShadows was conceived to provide a
box shadow or a full black-only copy of the original mesh.
With this limitation set by TS12 it seemed appropriate to
try to provide a method to build a simple shadow mesh
that could still be a reasonable representation of the
shape of the parent object, in most cases some piece of
rolling stock. Some method for maintaining some detail,
yet utilising a reasonable degree of polygon reduction
needed to be found.
Using the QuickShadows Program
Installation
The new process in QuickShadows looks at every triangle
outline (its lines) and establishes a profile on a grid, and
then applies a poly reduction technique to the result. This
process is repeated for a number of planes (up to 6) to
create an inside-out shadow mesh; meaning the side
nearest the cast shadow does most of the work. A
completely different approach to the normal shadow
construction. The shadows made with this method have
no top plane (or roof) .
If you don't have this program, please download its
installer program (PEV_QuickShadows_setup.exe) from
my PEVSoft Download page.
http://www.members.optusnet.com.au/~villaump/pevsoft.htm
Run the installer and the QuickShadows 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.
Shadow meshes for average sized locos and wagons with
reasonable detail can be made with less than 1000
polygons.
TrainzMeshImporter.exe is included in the setup program.
It may require a further download from MicroSoft (See
below)
The above method makes the new “Simple Shadow
Mesh”. The original “Box Shadow” and “Full Shadow”
options are still provided. If used with AssetX a fourth
option of an invisible shadow mesh is also available.
If you have TS2009 or later, QuickShadows will create
'OpenWith' macros for Content Manager 2 and 3 to allow
you to run QuickShadows directly from the Content
Manager for each Trainz version
For all its options, QuickShadows.exe creates a
© Peter Villaume (PEV) 2011 1
893872402.019.png
Making a Box Shadow
On first launching QuickShadows it will check that the
OpenWith macros for the Content Managers have been
set up. The program generates these automatically if it
finds TS2009, TS2010 and/or TS12 installations in the
default locations. Once done this process is not repeated,
until the user selects Open With from Setup in the main
menu.
When opened from a short cut, the program will await a
file open instruction from the user.
If you choose Open With, the program scans your PC for
Trainz installations. If it finds any in the default locations,
the OpenWith macros are automatically installed.
If a default installation is not found, the program presents
you with a Find Folder dialog. If you do NOT have the
Trainz version requested then press the Cancel button.
Otherwise locate the TS2009 or TS2010 or TS12
application folder as requested and select it. The
OpenWith macro will be automatically placed into the
selected Trainz installation.
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's or IM's will be visible. Select a mesh
to make a shadow for.
Opening a File
The program will confirm your mesh choice and show a
notice suggesting you press the Make Shadow button to
proceed.
The program can open .pm and .im files only.
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 can be opened.
When a file is opened the program shows a notice
suggesting you press the Make Shadow button to
proceed.
Before doing so you need to select a shadow type from
the Action List at the top right of the program window.
If the "Box Shadow" option is selected from the Action List
then the program will make a box shadow mesh. (as in
the figure to the left)
For a shadow mesh to be successful it needs to not
protrude through the skin of the parent (or default) mesh.
For the box mesh, independent scaling factors are
provided for length, width and height. Because the
shadow mesh box size is created from a bounding box for
the parent mesh it is highly likely that the mesh will be too
large. Use the scaling factors to reduce the size. A
Scaling factor of 1.0 is full size.. Use decimal fractions (eg
0.8) to reduce size.
To make a shadow press the Make Shadow button.
The Exit option closes the program.
© Peter Villaume (PEV) 2011 2
893872402.020.png 893872402.021.png 893872402.022.png
A hidden scale factor is included so that the shadow of a
rectangular object is slightly smaller than the object, This
is intended to prevent any rendering conflicts that can
cause the dreaded phasing effect in the game.
Making a Simple Shadow ** NEW for TS12 **
When opened from a 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's or
IM's will be visible. Select a mesh to make a shadow for.
Press the "Make Shadow" button and shadow.im mesh
will be created. When completed the program will tell you
that the shadow.im file has been created.
The program will confirm your mesh choice and show a
notice suggesting you press the Make Shadow button to
proceed.
Choose the Simple Shadow option from the Action List at
the top right of the program window.
If the shadow mesh is offset from the main mesh when
you view it in Trainz, the box shadow can be moved using
the X, Y, and Z Displacement values. These values are in
metres.
The simple shadow can consist of up to six (6) shaped
planes.
An Example
Let us now make a shadow using Paul Hobb's excellent
LNER Gresley A3 steam loco as an example.
For example, if the shadow is too low, you can move it up
by entering a positive value into the Z Displacement box.
This is common where the parent mesh has a small
portion that is higher than the remainder of the mesh, eg a
post. Note that this feature is only available for the box
shadow.
The "Zero All" button can be used to make all
displacements zero. Note: the displacements default to
zero when ever the program is opened. These values are
not stored for later use.
From the file open dialogue select the mesh with the
highest level of detail and open it. It doesn't matter if the
parent mesh has a huge number of polygons.
QuickShadows creates a fixed number of polygons for
each plane it generates and then does poly reduction on
that plane as it is drawn.
Files opened by double clicking in Windows Explorer can
automatically have a shadow mesh created if the "Auto
Make" option is SET (checked). The program will close
automatically after a short pause if the "Close on Done"
option is SET.
Turn off all the plane “Use” options and press the “Make
Shadow” button.
The shadow mesh is created in the same folder as the
parent mesh. It does not require any textures.
© Peter Villaume (PEV) 2011 3
893872402.001.png 893872402.002.png 893872402.003.png 893872402.004.png
The floor plane and longitudinal centre line plane form the
backbone of the shadow, as shown.
Here we have the shape of the back of the cab and cab
steps at the back extremity.
To get closer to the true shadow shape we also need to
enable the Side Planes and re-make the shadow.
Note that in this example the floor plane offset is 1.6m
above the lowest extremity and no front, back or side
planes are used.
If we now enable the front plane we can move it to the
correct location. Press the Make Shadow button again
and the mesh will be rebuilt.
The shadow cast to the side to the loco will now show the
cab correctly.
In the Mesh Viewer rotate the shadow mesh around to
ensure that there are no gaps between the planes. In this
case we will have a gap at the rear of the cab as below.
Here we have the front plane with zero offset; just
showing the buffers and coupling or hose. Now we
change the Front Plane Offset to 1.65m, and make the
shadow again.
Adjust the Back Plane offset to 0.4m and re-make the
shadow.
The two views above show the front plane now in the
shape of the front of the boiler located just where the
boiler shape commences. With the sun behind the loco it
will now cast a shadow of the boiler correctly.
Now we enable the Back Plane with zero offset and make
the shadow again.
It is advisable to have a small offset of say 0.05m for the
© Peter Villaume (PEV) 2011 4
893872402.005.png 893872402.006.png 893872402.007.png 893872402.008.png 893872402.009.png 893872402.010.png 893872402.011.png
Side Planes. This ensures that any gaps caused by the
point sampling method are closed up.
Scaling factors are provided to adjust the overall size of
simple shadow meshes. It is recommended that the width
and height scales be less than 1.00 ( I used 0.95 in the
example above) to prevent any rendering conflicts that
can cause the dreaded phasing effect in the game. In
most cases it is better to leave the length scaling at 1.00.
These scaling factors are different from those for box
shadows and are stored for later use.
In this case the cars have bellows passageways
connecting them, so the roof of the car commences about
0.4m from the ends. Set the Front and Back Plane
Offsets to 0.4m.
This completes the shadow mesh for Paul's A3. Poly
count is 659 in this case.
The checking of the progress of your mesh build can be
done if you connect Trainz Mesh Viewer to
QuickShadows. (see Setup section later). If you have set
up the mesh viewer to check the shadow it will be opened
immediately on completion provided that the Close On
Done option is NOT set.
The Side planes can now be enabled (again with the
0.05m offset)
Another Example
Now let us build a shadow mesh for a regular shaped
passenger car. I have chosen the BR MK1 Crimson and
Creams for this example.
The BR MK1 shadow mesh is complete.. poly count 480.
Footnote: The MK1 cars have roof ventilators that put little
bumps in the top of the profile. This raises the poly count,
as shown below:
Again we start with plane options all off and we get the
following.
Because the car is symmetrical we can turn on the Font
and Back planes together.
© Peter Villaume (PEV) 2011 5
893872402.012.png 893872402.013.png 893872402.014.png 893872402.015.png 893872402.016.png 893872402.017.png 893872402.018.png
Zgłoś jeśli naruszono regulamin