Patron Wiki
Advertisement


If you wish to follow this tutorial to the letter, you'll need to download the example files first. This tutorial naturally cannot teach you to create 3D models; it is merely focused on using an existing model, importing it into the game and adding so it can be placed in the game world.

Let's first open the Watchtower_TM.blend blender file. In it you'll see 4 build stages, with the fourth one being the completed building.

Tutorial Model Img1.png


We'll also need the hit mesh. Without it, you won't be able to select the object in the game using the mouse. The hit mesh should be a simple, low-poly model that encompasses the entire object. The hit mesh model should have a material assigned, but the UV map and normals are ignored.

TutModel Img2.png

The next step is to separate the individual meshes by material; only one material per mesh. Then export each mesh as a separate .fbx file.

Tutorial Model Img3.png

Before exporting, double check that all mesh faces are oriented properly, triangulated, have well placed pivots and normals and applied scale and rotation. Additionally, the model should be facing the Y axis, with Z axis as up in Blender. The Material editor, which comes quite soon, has Z axis as forward and Y axis as up.

The image below shows the desired Blender export settings for static models (no bones / armature). A good practice is to create an export preset in Blender.

Tutorial Model Img4.png

Now that all the models have been exported, we'll go into the game folder. Data\Models\Buildings to be more precise. We'll create a new folder for the watchtower called Watchtower_TM. To keep things clean, and that's always a good idea, let's create a sub-folder called Mesh. Here's we'll export/copy all the model (.fbx) files exported from Blender. Later we'll be adding lights, particles etc. so it's good practice to keep everything clean from the start and on each step.

It's time to dive into the Material editor. Start the .exe located in the game installation folder.

Tutorial Model Img5.png
  1. Click on the New Assembly button
    1. Drag and drop fbx files to import them. For easier tracking, import one whole building stage set at a time.
  2. The imported models appear in the Assembly Properties / Elements panel
  3. Let's select the first model in the list
Tutorial Model Img6.png
  1. To save an imported .fbx model as a compressed (game-native) .mdl model, click on the Model Editor icon
  2. Then click on the Save As New Compressed Whale Model button

Save the .mdl into the same folder as the .fbx file. Once the .mdl file is don, return to the Material Editor and switch back to the Assembly Editor (shortuct: A) and repeat the process for all individual imported models in the list. Once all the models are handled, it's time to save the entire object, the assembly, as an assembly file (.asb).

Tutorial Model Img7.png
  1. Return to the Assembly editor (shortcut: A)
  2. Click on the Save Assembly button

Save the Assembly into the same folder we created earlier Data\Models\Buildings\Watchtower_TM . Repeat the same process outlined above for all the remaining building stages. If everything went as expected, this should be the situation inside the Mesh\ folder

Tutorial Model Img8.png

HINT: Right-click inside the folder, go to Group by and then select Type, to sort files in the manner shown in the image. This should make it easier to see if everything is in order, regarding files.

One level above, in the main folder, the situation should be the following:

Tutorial Model Img9.png

Great! We have all the parts, collected and contained properly in the assembly file. Let's open that .asb file in any text editor and tweak some things.

  1. Link the materials to the materials already in the folder
  2. Set the DrawDistance to 500. There is no need to render the model outside of the camera view. We can add LOD (level of detail) models to optimize model rendering.
Tutorial Model Img10.png

As a nice double-check, we'll load up the Watchtower_TM assembly in the Material Editor. Also open the PatronLog.txt to make sure there are no errors in there. If everything checks out, we should have a complete Stage_A model with textures.

Tutorial Model Img11.png

Resolve all the remaining assembly files (stages) in the same manner. The only exception is the final stage, WatchtowerTM_Final.asb requires several additional materials to be relinked.

  1. Doors
  2. Flowers
  3. Roof Clay
Tutorial Model Img12.png

It's time to finish up the final stage of the model (WatchtowerTM_Final.asb). First position the doors in their proper place. The door model has a specifically placed pivot so they could be opened properly. This is not required, though. The doors can be positioned by dragging the doors in their place or by typing in the position manually.

Tutorial Model Img13.png
  1. We've added a slight rotation to the doors so they look opened a bit. This is, of course, a thing of personal preference.
  2. Click on the Help button (shortcut : H) to get a list of helpful tips and shortcuts
  3. This is the list of available controls
  4. We can also enable the Show Coords (X, Y, Z) in the editor for additional help when moving models around
  5. Also, don't ignore the various view modes of the model editor

Next up is setting up the Frustum ball. The frustum must encompass the entire assembly in order for it to render properly in the game.

Tutorial Model Img14.png
  1. Toggle displaying frustum
  2. Frustum size

What remains is the AABB box, used when rendering shadows.

Tutorial Model Img15.png
  1. Toggle displaying AABB box
  2. Enable AABB box
  3. AABB box size

Don't forget to save the WatchtowerTM_Final.asb assembly. To make things faster, we'll simply copy/paste the Frustum and the AABB box into the other building stage assembly files using a text editor.

Tutorial Model Img16.png


Remember that hit mesh from the beginning? Yep. We're on it now. Export it from Blender and import it into the Material editor following the same steps we used before. This time, however, we only need the .mdl file. Proceed to add it into the assembly.

Tutorial Model Img17.png
  1. Click on the arrow to add a hit mesh. We'll be prompted for the hit mesh .mdl file
  2. Toggle displaying the hit mesh
  3. Save the assembly

It's good practice to double check if the path to the hit mesh .mdl is correct, by checking the file in the text editor. The hit mesh (collision) must be the last .mdl in the list.

Tutorial Model Img18.png

We're almost there Patron. All we need now is the After burn variant. If a raging fire burns down the building, this assembly is what will remain. To make the tutorial easier and quicker, we'll simply duplicate the Stage_A assembly and only relink the WatchtowerTM_A_FloorPlanks to the burnt material version, so it looks... well... like it burned up.

Tutorial Model Img19.png
  1. Set the material path to the new "burned" value

Let's now open the .bui (building) file and scroll to the bottom, to the BuildingStage section

Tutorial Model Img20.png
  1. Relink to the new build stages
  2. Add/relink to the new "burned" variant

Save the .bui file. The building is ready to be added into the game for usage and for that proceed to the Adding a watchtower to the game article.

Advertisement