The Urban Bar set will be used as an example throughout this article.
Read over the Installation Instructions from the Mesh Reconstruction Utilities documentation for information on how to enter commands at the command-line.
This article will explain:
- How mesh files organize the geometry of a set or facility.
- How to use the Mesh Reporting utility (r3-tm-meshreport) and MeshManip to identify set geometry.
- How to extract an object from a set using the Prop Extraction utility (r3-tm-extractprop).
- Expanding these concepts into creating a full mod-pack.
Mesh files organize geometry into
mesh groups and
meshes.
Ultimately, meshes are just a big collection of triangles in 3D space.
- Mesh Groups :
Sets and facilities typically use mesh groups to keep "interactive" objects separate, such as doors or chairs.
Each object that an actor can interact with therefore gets its own mesh group.
The land, and sometimes an invisible region (used to effectively expand the set's camera range in Advanced Movie Maker), also get their own mesh groups.
The remainder of the set or facility is contained in its own mesh group.
This final mesh group typically contains the majority of the geometry.
- Meshes :
Sets and facilities use meshes to keep geometry with a common texture together.
Even if the geometry is broken apart and strewn across the set, mesh files organize it into the same mesh.
While this type of organization can make modding difficult, it is useful for the sake of efficiency.
Each
mesh group is assigned its own number, starting at zero.
Each
mesh within a mesh group is assigned its own number, starting at zero.
The Mesh Reconstruction utilities can be used to further analyze meshes.
If an individual mesh is broken apart in pieces and strewn across a set, the Mesh Reporting utility makes it possible to isolate and identify these pieces.
We call each of these pieces a
3D Object.
Each
3D Object can be identified by some number
1. The Mesh Reporting utility can be used to discover this identifying number for each 3D object.
When creating a group of props extracted from an existing set, the best way to use the Mesh Reporting utility is with the following command:
r3-tm-meshreport -r set_bar.txt -xo set_bar.msh
- r3-tm-meshreport : The name of the Mesh Reporting utility.
- -r set_bar.txt : The "-r" option is used to indicate the filename of the text report that will be output. After running this command, you will be able to open the file "set_bar.txt" in Notepad for review. If this portion of the command was left out, the default filename of "r3-tm-meshreport.txt" would be used. This text report is of limited use, now that MeshManip has a 3D Viewer capability.
- -xo : The "-xo" option indicates that separate mesh files should be created for every Mesh and 3D Object in the set. If this portion of the command was left out, no mesh files would be created.
- set_bar.msh : The filename of the Urban Bar set. The mesh files output as a result of the "-xo" option will be placed in a folder named "set_bar". For a complete list of filenames for all the game's sets and facilities, see Appendix A and B in the Mesh Reconstruction utilities documentation.
1
The number assigned to each 3D Object in a mesh is actually the first vertex that is a part of that object.
The Mesh Reconstruction utilities isolate 3D Objects by tracing along all vertices connected (by faces) to some arbitrary vertex.
Reacher's MeshManip utility is not just a good tool for combining meshes together, it also provides a very quick way of viewing the geometry of a prop, set, or facility.
The many hundreds of mesh files output by the Mesh Reporting utility can be dragged into MeshManip, and quickly viewed by pressing CTRL+W.
You can also open the Urban Bar set itself in MeshManip.
Look in the "cache" directory created by the Mesh Reporting utility (and all other Mesh Reconstruction utilities), and you will find "set_bar.msh" there.
We are going to extract the bar counter from the Urban Bar set.
Open set_bar.msh in MeshManip. Open the branch that says "Groups (31)". These are the
Mesh Groups in this mesh file.
For now, ignore all the entries that contain "_sa_", "_land_", and "_invisible_" in their name.
That leads us to the last mesh group named "_ceiling_". It is group 30.
Press CTRL+W, select "One Group, All Meshes", and enter "30" in the Group box.
Move the scroll bars in the viewer until you have the bar counter in view, as illustrated below.
Now we want to find out which meshes contain geometry for the bar counter.
Select "A Single Mesh". Use the up and down arrows in the Mesh box to scroll through each mesh, from 0 through 52.
While doing this, take note of which mesh numbers seem to contain geometry for the bar counter.
Eventually, you will find that meshes 1, 2, 3, 7, 11, 12, 13, 14, 16, 17, 28, 37, 39, 40, 42, 45, and 50 all contain some sort of geometry for the bar counter.
Most other objects you'll want to extract are not this complicated, but that makes this a good example.
As a first step, try running the following command:
r3-tm-extractprop -workdata examples set_bar.msh p_example_bar -g 30 -m 1 2 3 7 11 12 13 14 16 17 28 37 39 40 42 45 50
- r3-tm-extractprop : The name of the Prop Extraction utility.
- -workdata examples : The "-workdata" option tells the application to output the prop into a specific folder. In this case, the folder will be named "examples".
- set_bar.msh p_example_bar : The mesh file to extract from, and the filename of the prop to output.
- -g 30 : The "-g" option indicates which mesh group we want to add geometry from.
- -m 1 2 3 7 11 12 13 14 16 17 28 37 39 40 42 45 50 : The "-m" option indicates one or more meshes to add geometry from.
Open p_example_bar.msh in MeshManip, press CTRL+W, and you will find that while it does include the bar counter, it also includes lots of extra stuff we don't want.
The next step is to identify which of these meshes contain extraneous geometry that should not be part of the bar counter.
Go back to set_bar.msh in MeshManip, press CTRL+W, and view Group 30, Mesh 1.
It contains the railing for the lights on the bar, but also the railing on the stage, staircase, and some other bits.
Look in the "set_bar" folder created earlier by the Mesh Reporting utility.
Scroll down until you reach the files named "group30mesh01vertex####.msh".
We only want the railing for the lights on the bar.
Open each of these files in MeshManip until you find that railing.
It turns out it's the first one, numbered 0.
This means you can amend the above command to the following:
r3-tm-extractprop -workdata examples set_bar.msh p_example_bar -g 30 -m 1 -v 0 -m 2 3 7 11 12 13 14 16 17 28 37 39 40 42 45 50
- -m 1 -v 0 : The "-v" option restricts the geometry extracted from a given mesh to include only the 3D Objects specified.
Continue this same idea with every mesh number.
If the mesh does not contain any extra geometry besides the bar counter, you do not need to do anything special with it.
Eventually, you will end up with a command like the following:
r3-tm-extractprop -workdata examples set_bar.msh p_example_bar -g 30 -m 7 11 12 13 14 16 28 42 45 50 -m 1 -v 0 -m 2 -v 0 7 -m 3 -v 3 15 39 63 67 79 697 83 135 -m 17 -v 0 55 99 287 -m 37 -v 0 339 -m 39 -v 3 123 0 19 15 474 -m 40 -v 0 7
- -m 7 11 12 13 14 16 28 42 45 50 : For meshes that do not contain any extraneous geometry, you can include them as a list (separated by spaces) after the "-m" option.
- -m 2 -v 0 7 : If multiple 3D objects in a mesh must be included, you can include those 3D objects as a list (separated by spaces) after the "-v" option.
- -m 3 -v 3 15 39 63 67 79 697 83 135 : For each such mesh, you should start a new "-m" option.
Simpler objects that aren't made up of so many different pieces are much easier to extract.
The only thing remaining with our bar counter is getting it centered properly, to make it easier to place in Advanced Movie Maker.
This can be done one of two ways:
- Open the prop in Blender. Go to View -> View Properties.
Left-click in the center of the prop. This sets the current 3D Cursor position, found in the View Properties box. Take note of the X and Y position.
Now go to View -> Front. Left-click along the bottom edge of the prop. Take note of the Z position of the 3D Cursor.
The X, Y, Z co-ordinate you took note of can be used by the "-cp" option, to be tacked on to the end of your command. I come up with the following numbers:
-cp -1.38 4.865 0.2
- Use the Prop Extraction utility's automatic centering ability.
This is done by figuring out which mesh number contains the most geometry from the edges of the bar counter.
Mesh 2 is a good example, as it contains the bottom walls of the counter.
Change the "-v" option to "-cv" to indicate that the prop should be centered automatically:
-m 2 -cv 0 7
You can also rotate the object so that it is facing forward, if you desire.
This can be done with the "-rpz" option, which expects the angle of rotation, measured in degrees.
Enter "r3-tm-extractprop" at the command line, or read the documentation, for a complete list of options.
When I create one of my "Complete Works" mod-packs, I tend to work through all the mesh groups and meshes in a single pass.
My first step is to hop in the game and get a good look at the set, keeping mental notes on every object I want to extract as a prop.
My second step is to run the Mesh Reporting utility, and get a good look at the set in the MeshManip viewer.
I then create a DOS Batch File that contains all the "r3-tm-extractprop" commands I'll need for the entire mod-pack.
As I work through each mesh group and mesh, I tack on the "-m" and "-v" options to each command as needed.
Using this method, I'm typically able to create an entire mod-pack of many dozens of props in 12 to 15 hours.
A DOS Batch File is just a text file.
You can use Notepad to create them.
When saving a batch file in Notepad, choose "All Files" under "Save as Type", and make sure you include ".bat" at the end of the filename.
Once you have created a batch file, you can run it on the command line simply by entering its filename!