www.tombraiderforums.com

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Tomb Raider Level Editor Tutorials

Closed Thread
 
Thread Tools
Old 23-08-08, 01:27   #1
sapper
Archaeologist
 
sapper's Avatar
 
Join Date: Sep 2007
Posts: 1,543
Default A guide to remapping outfits

When importing new or modified meshes for an outfit in StrPix, sometimes the meshes need to be remapped for the outfit to connect properly in game (no stretched polygons).

Each vertex (point) in a mesh is numbered. Remapping is changing a vertex's number.
StrPix's remap dialog is used to change a vertex's number by putting the vertex's
current number in the "After" box and the number you want to change it to in the "Before" box. See Cornchild's tutorial on trsearch to learn how to remap using StrPix. Don't forget to "Recalc Normals" after you remap a mesh.



With some insights from T4Larson I've been able to formulate some rules for remapping Lara's meshes.


Lara's Skin Meshes

~ You remap the vertices which connect with the joint meshes or the ponytail/braid. These connection vertices are shown in yellow below.


-o0o-


~ The connection vertices, with the exception of the ponytail/braid connection, can be any number up to a maximum value. The maximum value cannot be higher than 127 and depends on the number of vertices in the mesh as shown in the table below.

-------------------------------------------------------------------------
Number of vertices |.......Connection vertices must not be higher
in mesh................|.......than this number
-------------------------------------------------------------------------
.........up to 255....| 127 ( i.e. vertices can be numbered 0 to 127)
-------------------------------------------------------------------------
........257 to 511...| (Number of vertices - 256 - 1) or 127 *use the lowest
-------------------------------------------------------------------------
........513 to 767...| (Number of vertices - 512 - 1) or 127 *use the lowest
-------------------------------------------------------------------------
........769 to 1023.| (Number of vertices - 768 - 1) or 127 *use the lowest
-------------------------------------------------------------------------
and so on.
Note: Meshes which have multiples of 256 vertices, that is, 256, 512, 768, 1024 etc, crash tomb4.exe.

Some examples:

A mesh of 557 vertices will have a maximum of 44 since (557-512-1) = 44 which is lower than 127. This means any connection vertex numbered higher than 44 must be changed to a number in the range 0 to 44 that is not already used.

A mesh of 400 vertices will have a maximum of 127 since (400-256-1) = 143 which is higher than 127. This means any connection vertex numbered higher than 127 must be changed to a number in the range 0 to 127 that is not already used.

A mesh of 128 vertices or less will not need to be remapped since no vertex will be numbered higher than 127.

A mesh of 257 vertices will have a maximum of 0 since (257-256-1) = 0 which is lower than 127. This means any connection vertex numbered higher than 0 must be changed to a number in the range 0 to 0. But wait... only one vertex can be numbered 0. The other connection vertices will always be numbered higher than the maximum allowed. This mesh will never join up properly in game.

TIP:
Avoid meshes with the number of vertices not much higher than 256, 512, 768, 1024 etc.
TIP:
A good way to remap a mesh is to start at 0 and number the vertices consecutively, 1, 2, 3, 4 etc, in a clockwise or anticlockwise way. You will know what numbers have already been used and by keeping the numbers as low as possible you will have the best chance of being under the maximum.
TIP:
If you find it difficult to get the current vertex numbers using StrPix, try trlcsoft's Wad Explorer. (new link)
-o0o-


~ The ponytail/braid connection vertices must be numbered 37, 38, 39 & 40 as shown below.


~ For Young Lara the ponytail/braid connection vertices must be numbered as shown below.

-o0o-



Lara's Joint Meshes


~ The joint meshes do not need to be remapped.

~ The maximum number of connection vertices allowed per side is 11.


-o0o-

The Swap Meshes
~ The scream head must be remapped the same as the normal head.

~ The weapon/flare meshes which include Lara's hands must have the hand
remapped the same as the normal hands.

TIP:
Remap the hands and head meshes in an easy to remember pattern.
-o0o-

If you have remapped your meshes according to these rules and the outfit still does not join up properly in game, the meshes are not in the correct position and/or the connection vertices of the skin meshes are not close enough to the connection vertices of the joint meshes. See this post.

Last edited by sapper; 31-05-09 at 02:44. Reason: Replaced dead link for wadexplorer
sapper is offline  
Old 23-08-08, 01:29   #2
sapper
Archaeologist
 
sapper's Avatar
 
Join Date: Sep 2007
Posts: 1,543
Default A way to remap with Meta (maybe)

From the remap rules you can see that if you number the connection vertices 0, 1, 2, 3, 4, etc you have the best chance of being under the maximum value allowed.

In a 3DFace DXF file the vertices in the first face (polygon) get numbered first. So if it's a triangle, for instance, the vertices in the first face will be numbered 0, 1, 2. The vertices in the second face will be numbered next. Any vertices in the second face that have the same co-ordinates as the first face will be ignored and the first unique vertex will be numbered 3. This is repeated for the third face and so on.

So you see if we ensure the faces with the connection vertices are first in the DXF file they will have the low numbers.

The way to do this in Meta is to select the minimum number of faces that contain the connection vertices, invert the selection via the edit menu, then cut and paste via the selected menu. Now the faces which contain the connection vertices should be first in the DXF file when saved.

I used the word maybe in the title since this doesn't guarantee the connection vertices will have the lowest numbers. When StrPix saves a wad, the quads in the imported meshes are saved first and then the triangles, so the vertices in the quads get the lowest numbers.

In summary, for the connection vertices to get the lowest numbers,

a) the connection vertices must be in quads

or

b) there must be no quads in the mesh.

This technique will work most of the time, however, if the number of quads is low and the maximum value for the mesh is high.

Remapping using StrPix is still required for the ponytail/braid connection.

Last edited by sapper; 31-05-09 at 03:31.
sapper is offline  
Old 23-08-08, 01:30   #3
sapper
Archaeologist
 
sapper's Avatar
 
Join Date: Sep 2007
Posts: 1,543
Default Aligning the Joint & Skin Meshes

For an outfit to join up properly in TR, each connection vertex of the joint meshes must be close to a connection vertex of the skin meshes.

To check the connection of a skin mesh with a joint mesh in Metasequoia (Meta), open one mesh and then use insert to open the other.

Always open with scale settings Multiply 1 and Digit 2 so the co-ordinates of the vertices will be whole numbers. Multiply and Digit explained here.

Use the MOVE command with Abs pressed to see the co-ordinates of a joint mesh connection vertex and then check the co-ordinates of the corresponding skin mesh connection vertex.

At this scale, for the outfit to join in game, the X, Y, Z co-ordinates of the two vertices must be the same or only differ by 1.







The following pairs of meshes will be in the correct position with respect to each other when they are opened together in Meta.
Skin mesh -- Joint mesh (Wadmerger Mesh Number)
-------------------------------------------------
Pelvis -- JointPelvis (Mesh 0)
Left Thigh -- Left Hip (Mesh 1)
Left Shin -- Left Knee (Mesh 2)
Left Foot -- Left Ankle (Mesh 3)
Right Thigh -- Right Hip (Mesh 4)
Right Shin -- Right Knee (Mesh 5)
Right Foot -- Right Ankle (Mesh 6)
Torso -- Waist (Mesh 7)
Right Upper Arm -- Right Shoulder (Mesh 8)
Right Lower Arm -- Right Elbow (Mesh 9)
Right Hand -- Right Wrist (Mesh 10)
Left Upper Arm -- Left Shoulder (Mesh 11)
Left Lower Arm -- Left Elbow (Mesh 12)
Left Hand -- Left Wrist (Mesh 13)
Head -- Neck (Mesh 14)

To check other connections one mesh will have to be moved so it is in the correct position with respect to the other mesh.

The following table gives the standard offsets of Lara's meshes which you use to move the mesh to it's correct position. The mesh you move must be moved back to it's original position before it is saved.

LEFT THIGH/HIP ......is.. 42 LEFT ... 20 DOWN .. 2 FORWARD ..from the.. PELVIS
LEFT SHIN/KNEE ......is... 9 RIGHT . 185 DOWN .. 3 FORWARD ..from the.. LEFT THIGH/HIP
LEFT FOOT/ANKLE .....is... 1 RIGHT . 192 DOWN .. 8 AFT ......from the.. LEFT SHIN/KNEE
RIGHT THIGH/HIP .....is.. 43 RIGHT .. 20 DOWN .. 2 FORWARD ..from the.. PELVIS
RIGHT SHIN/KNEE .....is.. 10 LEFT .. 185 DOWN .. 2 FORWARD ..from the.. RIGHT THIGH/HIP
RIGHT FOOT/ANKLE ....is... 0 RIGHT . 193 DOWN .. 2 AFT ......from the.. RIGHT SHIN/KNEE
TORSO/WAIST .........is... 1 LEFT ... 49 UP ... 11 FORWARD ..from the.. PELVIS
R UPPER ARM/SHOULDER is.. 59 RIGHT . 142 UP ... 12 AFT ......from the.. TORSO/WAIST
R LOWER ARM/ELBOW ...is.. 10 RIGHT .. 95 DOWN .. 2 AFT ......from the.. R UPPER ARM/SHOULDER
RIGHT HAND/WRIST ... is... 1 RIGHT . 101 DOWN .. 1 AFT ......from the.. R LOWER ARM/ELBOW
L UPPER ARM/SHOULDER is.. 57 LEFT .. 143 UP ... 12 AFT ......from the.. TORSO/WAIST
L LOWER ARM/ELBOW ...is... 9 LEFT ... 98 DOWN .. 2 AFT ......from the.. L UPPER ARM/SHOULDER
LEFT HAND/WRIST .....is... 1 LEFT ... 99 DOWN .. 1 AFT ......from the.. L LOWER ARM/ELBOW
HEAD/NECK ...........is... 2 RIGHT . 198 UP ... 23 AFT ......from the.. TORSO/WAIST



Example

Import the Torso, Waist and Pelvis meshes into Meta.
The Torso and Waist meshes will join up as discussed above but the Pelvis will not.


I choose to move the Pelvis since I will only have to move one mesh.
From the table above, the Torso mesh is 1 unit to the left of the of the Pelvis, 49 units above the Pelvis and 11 units forward of the Pelvis.
This means the the Pelvis is 1 unit to the right of the Torso, 49 units below the Torso and 11 units aft of the Torso.
In Meta, select the Pelvis and press the MOVE button.
Looking at the meshes in Meta we see that right is the positive X direction, down is the negative Y direction and aft is the positive Z direction so use the following numbers in the Rel X, Y, Z boxes and press OK.

X = 1
Y = -49
Z = 11





To move the vertices of the Waist so they perfectly match the vertices of the Pelvis:
~ Make sure Rc is enabled.
~ To make things easier disable Ln and Fc.
~ Press the MOVE button and the Abs button in the MOVE dialog.
~ Select the vertex on the Pelvis where you want to move the Waist vertex.
~ Rectangle select (press and hold the left mouse button and drag a rectangle) the Waist vertex you want to move. X, Y, Z in the Abs boxes should not change.
~ Press OK





When modifying the meshes, Rectangle select the vertices at the connections to make sure you move both vertices together. It is also a good idea to set grid to 1 and enable snap to grid.





The Torso and Waist meshes can be saved as normal but the Pelvis must be moved back to it's original position before it is saved. Select the Pelvis and in the Rel boxes of the MOVE command dialog use the negative of the numbers you used before.

X = -1
Y = 49
Z = -11



All meshes are saved with Multiply 1 and Digit -2.



Last edited by sapper; 22-06-09 at 12:57.
sapper is offline  
Old 01-09-08, 03:15   #4
sapper
Archaeologist
 
sapper's Avatar
 
Join Date: Sep 2007
Posts: 1,543
Default

Note:
Positioning the meshes in the shareware version of Meta is slightly easier but this version of Meta cannot save to DXF. You have to save as MQO then open the MQO in the freeware version to save to DXF.

To move the mesh, select it, then press the LOCAL button. Press the PROPERTY button in the dialog and change the X, Y, Z position to the numbers you want. To return the mesh to it's original position change the X, Y, Z position in the PROPERTY dialog back to 0, 0, 0.



-o0o-

The table above gives the position of a mesh from it's parent mesh. To get the position of a mesh from a different mesh just add the offsets for each mesh between the two meshes.
For example the Head's position with respect to the Pelvis is obtained by adding the Head's offset from the Torso to the Torso's offset from the Pelvis. Assign right positive, down positive and forward positive.

left/right position = -1 plus 2 = 1 (1 right from the pelvis)
up/down position = -49 plus -198 = -247 (247 up from the pelvis)
forward/aft position = 11 plus -23 = - 12 (12 aft from the pelvis)


This way you can assemble Lara in Meta.



-o0o-

If you have moved Lara's meshes in Wadmerger, the table of offsets above may not apply. In this case obtain the offsets using WAD Explorer. This link is dead but I will leave it here in the hope that IceBerg's site returns someday. You can download Wad Explorer here.




-o0o-

DXF2MQO has a feature which will position a mesh at the required offset. Use this feature with the shareware version of Meta. DXF2MQO can still be used with the freeware version however to convert a StrPix DXF file to a Meta MQO file and preserve the texture info.

Download a flash tutorial here showing how to use DXF2MQO to avoid retexturing in StrPix. View Bedazzled's Golden Rose and Pedestal flash tutorials here at TRF first since the DXF2MQO tutorial can be substituted for parts 3 and 4. The screen captures in the tutorial are 800 x 600 so best to view in a higher resolution. Note the tutorial was made using Wink so the tutorial is best viewed by opening the HTML file in a flash enabled browser.

MQO2DXF is a program to convert an MQO file to a DXF file compatible with StrPix.


-o0o-

Version 1.4 of Editwad can export LaraSkin and LaraSkinJoints together to the same MQO file so the connections can be checked in Metasequoia.

-o0o-

A quick way to check if the meshes are positioned correctly is to open the TR4 file in TRViewer and view Lara_Skin.

-o0o-

Unfortunately Wadmerger's MQO export is not accurate enough to check the connections. Select Lara_Skin, press EXPORT, change .trwad to .mqo and save. Repeat for Lara_Joints then open together in Meta. Scaled at Multiply x 1 Digit 1 so for the vertices to be close enough to work, each vertex must be within 0.1 of each other. Outfits that are known to work show gaps bigger than 0.1 using this method.
-o0o-

Last edited by Titak; 09-09-15 at 16:27. Reason: add info & link for editwad 1.4
sapper is offline  
Closed Thread

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 10:26.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.