Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: Learn-by-Example Modelling 01: Medieval Dagger

  1. #1

    Icon1 Learn-by-Example Modelling 01: Medieval Dagger

    Version: 21/01/2013

    This is the first Learn-by-Example, Step-by-Step tutorial on 3-d modelling and texturing of a series to come. The purpose of these series of tutorials is to share experience on the go as I work with various projects thus providing detailed guidance to those wanting to start modelling. And most importantly, there is lack of step-by-step tutorials with examples that are so needed to give a quick start for people interested in 3-d modelling. This series can be considered as complementary practice exercises to Alletun’s Unit Makers’ Tome of Knowledge.



    I want to clarify this important issue before we start: Throughout this tutorial I assume you have read the Alletun’s Tome of Knowledge, a must read for beginners. It explains the basic functions of MilkShape3D, Adobe Photoshop, modelling, texturing, many little need-to-know things, troubleshooting and much more. Please refer to it if something in this tutorial is not clear. Also, feel free to seek help in this thread.

    Section 1: Modding Environment Setup

    Part 1: Software and Tools Here is the list of main software programs needed for modelling:


    Download and unpack these tools and resources and put them together:




    Part 2: Unpacking M2TW You need to unpack the game before you can start modding. Here is how:

    Step 1: Disable UAC for M2TW folder. Follow detailed procedure by SigniferOne here.

    Step 2: Got to “…/Medieval II Total War/tools/unpacker/” and run “unpack_all.bat”. Make sure you have at least 7 GB of free space.

    Step 3: Inside “…Medieval II Total War/data/” delete “descr_geography_new.txt” and “descr_geography_new.db”. Otherwise the game will crash.

    Step 4: [Optional] M2TW by default will launch using its packed files neglecting any changes we make to the unpacked file. To force the game to load unpacked files add the following line in your medieval.preference.cfg:
    Code:
    [io]
    file_first = true
    This step is optional because you usually want to run the game from a separate mod folder. However, you will need to have the above code in your mod’s “cfg” file to force M2TW engine to load your mod’s files instead. In scope of this tutorial, this part is purely for your information since a completely functional mod folder is provided for download with this tutorial.


    Part 3: [Resource] Modeller’s Folder v1.0 Download

    Description:

    I assembled a simple mod folder with some resources. It comes as a supplementary material to my tutorials on modelling. It can save a good amount of time, as setting it up properly and launching without crashes can be difficult for less experienced. Of course modding can be done in the root directory, but it is not practical. Main purpose of this resource is to provide a head start for beginners.

    Contents:

    - A standalone mod folder, named “modellers_mod_v1.0”, with its own batch launcher and configuration file
    - Vanilla peasant model and four vanilla textures inside “workbench” folder for head start
    - Three basic knifeman animations
    - Texturing resources including various patterns and brushes for Photoshop inside “resources” folder
    - LithUnwrap 1.3. A freeware, old and robust UV-mapping tool. I included this here because it is hard to find permanent links to it.

    Features:

    - Whatever is changed inside does not affect any other mods or the original files
    - Very small size and all the missing files are launched from the root directory
    - Its own configuration file, where you can enable windowed mod, change graphics settings etc for testing your models

    Installation:

    Simply unpack the archive after downloading it from here. Put the contents inside M2TW root directory. You should now have the mod folder inside “…/Medieval 2 Total War/mods/” directory named “modellers_mod_v1.0” and the workbench folder with the additional contents inside the root directory.

    Test Run:

    Go to your new mod folder and run “modellers_mod_v1.0.bat” to see if everything works fine. Note that at this moment it is simply a vanilla M2TW launched from a mod folder. You can even play vanilla campaign, though it has no sounds. If you really want the sounds, you need to copy all the packs inside “…/Medieval 2 Total War/data/sounds/” to your mod’s “data/sounds/” folder.


    Section 2: 3D-Modelling

    Part 1: Introduction In this tutorial we will be making a basic medieval dagger, possibly used by bowmen. Before starting to make a model, it is always a good idea to find some reference material and do some research. In this case I only read some Wikipedia articles and searched for some images. However, if you are making something more important, a proper research should be done. Here is what we have for reference, though we need not stick close to these designs:



    Part 2: Model Setup I suggest taking a vanilla model of a peasant or something similar as a base to avoid unnecessary surprises. You can use the “peasants_lod0.ms3d” file provided in the mod folder. Note that it is just a vanilla peasant unit. Here you can decide to make the new model directly inside this file or separately. My personal preference is to create new parts in a separate file, later to be merged with the base file. From this point onwards, I suggest keeping all the files related to this tutorial in a single folder for you own convenience.

    Step 1: Open “peasants_lod_0.ms3d” in MilkShape and delete the groups inside “Groups” tab.

    Step 2: Save the resulting empty file separately as “dagger.ms3d”. This is done to retain the human skeleton and model comment.

    Step 3: Untick “Auto Smooth” button inside Groups tab.

    Useful Information:

    Using Auto Smooth will reveal mesh seams, which are very noticeable in game. Instead, use Face -> Smooth All (Ctrl + F) whenever you make changes to vertices. You will notice when you make changes to your model shadows are not updated. Pressing Smooth All will update all the normal, which are responsible for shadows and highlights. This option will still reveal seams, but we don’t mind having seams while making a new model. I will address this issue later in this tutorial. Just remember to always have Auto Smooth unticked.


    Part 3: Creating Simple Polygon We will start by making cylinder for the blade piece.

    Step 1: In the side-view window (right top quadrant) use the “cylinder” tool under “Models” tab to create a vertical cylinder with 2 stacks and 4 slices (i.e. sides) for the blade.

    Step 2: Rotate the cylinder to horizontal position using “rotate” function (F3) at 90o along x-axis. Here is what we got:



    Keep the 3D view-pane in either flat-shaded or smooth-shaded modes while working in Milkshape. You can change the viewing mode by right clicking.


    Part 4: Shaping the Blade Note that the cylinder tool does not create a hollow cylinder, but closes the both sides with an additional vertex, noticeable in 3d-view pane.

    Step 1: Select (F1, then press 1 for vertex selection sub-tool) the middle vertices indicated as red on the side-view.

    Step 2: Go to top-view and deselect (Shift + normal selection) the side vertices, so that only the middle vertex is selected.

    Step 3: Use “move” tool (F2), enter a small value (-0.01 in my case) inside z-coordinate. This will move the selected vertex, which will be the pointy end. Here is what we got so far:



    Step 4: Select the entire blade and use “scale” tool (F4). Keep y and z values at 1.0, change x to 0.1. This will make the blade thinner. Of course you can use “move” function to move vertices around to make the blade thinner, but this way it will not be symmetrical. I suggest making use of “scale” tool in most cases.



    Step 5: Now we need to give it a nice curvy shape. Move the vertices around using “move” tool by inputting values for the coordinates. Although, in this case it can be done just using mouse, it is a good practice to use coordinate values. Otherwise when it comes to more complicated models it is hard to be consistent and maintain symmetry. Also use “scale” to get the desired shape. Here is the outcome:



    Part 5: Hilt Use 5-stack 4-side cylinder as a base for the hilt. Again, rotate it by 90 degrees to place it along z-coordinate. Follow the similar steps until you arrive at something like this:



    Do not merge the two groups we just created (cylinder01 and cylinder02 in our case). It is a good practice to keep them separated until the very last moment, when all the modelling, UV-mapping and texturing is done. Also you can rename the groups into something more relevant like “blade” and “hilt”.


    Part 6: Materials Now, we need to assign materials for the hilt and blade.

    Step 1: Go to “Groups” tab and select both groups by double clicking on them, notice how they have “<No Material>” appended in their names.

    Step 2: Go to “Materials” tab, select “Attachments” and click “Assign”. Check if the groups have “<Attachments>” appended in their names.

    Step 3: Finally, don’t forget to save the file.

    Section 3: Texturing

    Part1: Introduction
    Here are some things you must know about textures before we start:

    • Each unit in game must have four textures, two main textures for each material, figure and attachments, and two normal maps that contain information about normals that are responsible for the 3d surface effect, and shining of metal pieces.
    • All this textures must have an alpha layer.
    • The textures are 1024x1024 pixels in size.
    • The textures are stored in .texture format in game, while the files we can edit in Photoshop are stored in .dds (DXT5 that supports alpha layers). These two are inter-convertible by “texture2dds” converter.



    Part 2: UV-Mapping First, all vertices must be assigned to a UV-map. In short, UV-map includes information on how the texture is wrapped around the model. Each vertex is assigned a location on the texture, thus neighbouring three vertices will form a triangle on texture, which will be displayed on the corresponding face. Although, MilkShape has its own texture coordinator with UV-mapping capability, it is rather limited and has inconvenient controls. Therefore, my personal preference is to use LithUnwrap.

    Step 1: Open LithUnwrap and go to File -> Model -> Import -> select your .ms3d file.

    Step 2: Go to “Groups” tab on the right side, right click on “blade” group and press “select”.

    Step 3
    : In the ribbon tabs on top go to Tools -> UV Mapping -> Decal. Choose “x-right” and “scale to mapping space”. The resulting UV map will resemble the shape of your blade, though it will appear too big.

    Step 4: Right click on it, scale -> arbitrary -> click on 0.5 twice.


    Step 5
    : Repeat the steps for the hilt and place it next to the blade, though it may need to be scaled down more. Do not place the two groups adjacent to each other just yet.

    Step 6: To save go to File -> Model -> Save -> choose MilkShape .ms3d format -> give it same name as the source file -> press save -> press ok to replace. In my case I placed them on top right corner:



    Part 3: UV-Map Extraction Next, we need to extract the UV-map information, which will be very handy when texturing. Although for this kind of simple work we can just use a screenshot (like the one above) from LithUnwrap as a reference in Photoshop, it is still a good practice to know exact location of vertices on texture. For this purpose we will use GOAT’s Write UV-Maps to DDS function which generates a .dds image file for both materials’ textures “figure” and “attachments”.

    Step 1: Open “GameObjectApplicationToolbox_v1_1.py”.

    Step 2: Press on “Write UV-Maps to DDS” button.

    Step 3: Select your .ms3d file

    Step 4: Open the generated “dagger_attachments.dds” in Photoshop

    Here is what I got in Photoshop:



    Part 4: Texturing the Blade Here things will get more interesting. Open the “dagger_attachments.dds” file that contains UV-mapping information we generated earlier. In this case since there are no other attachments we will work directly inside “dagger_attachments.dds”:

    Step 1: Duplicate the base layer by pressing Ctrl + J and delete the “background” layer. Now you can insert other layers below the UV-map layer. Create a new layer below, and then fill it with solid black using bucket tool (hotkey G). Also tune down the opacity of the UV-map layer to see through.

    Step 2
    : Create a new layer and use “polygonal lasso tool” (hotkey L) to make selection around the blade with 2-3 pixels of extra space and fill the selection with base colour, light grey in this case.

    Step 3
    : Create a new layer on top of light-grey layer, but the shape was filled with darker grey this time.

    Step 4: Keeping the selection, use eraser tool (E) at low opacity (20%) with some irregular brush (i.e. not a simple circle). Erase the dark-grey layer where near the cutting edge. To make it look more natural you can add noise by going to Filters -> Add noise -> Uniform Noise at 1px. Also change brightness, Edit -> Adjustments -> Brightness/Contrast, of the two layers to achieve something like this:



    There are many ways of texturing models. This part is artistic and highly depends on your drawing skills. I am not good at drawing, but in case of a simple dagger, it does not really matter. You can choose to follow the same procedure, or create your own. The simplest way would be to create a dark layer and simply paint with white brush on top. However, I find the above-mentioned technique more suitable. If you have plenty experience with Photoshop you can probably make textures better than the ones in this tutorial.


    Part 5: Texturing the Hilt Next comes texturing of the hilt. The most typical hilt would be made of wood. We can also add metal rings on both sides of hilt to make the sides stand out.

    Step 1: Create a new layer. Always work on several layers. Select a rectangle (M) and fill it with light brown colour. Go to “…/Medieval 2 Total War/workbench/resources/Patterns and Brushes for Photoshop/” open all the files inside. This will load them into Photoshop.

    Step 2: Double click on the area shown in the picture, add a wooden pattern of your choice, and set the blending mode to “Multiply”. Multiply ignores white areas and makes dark areas even darker. This allows using the fill colour to saturate the image, while retaining the wooden pattern.

    Step 3: Add two grey rectangles. Do not forget to work in separate layers.

    Step 4: Make them look more realistic with a brush.

    Step 5: Add nails or something similar of your choice. The goal is to make the hilt look more appealing.

    Step 6: Add a layer between metal rings and wooden hilt. Add highlights and shadows. Place the hilt and blade pieces together.

    Step 7: Draw some scratches using special brushes on a new layer. Scale it down if needed, change blending mode to “Overlay”. Use different scratches for the hilt and blade. Adjust shadows and highlights, and sharpen if necessary, until the texture looks just nice.



    Step 8: There must be an alpha layer in the texture file. For that go to “Channels” tab in Photoshop, press the small square icon below, which will create an alpha channel. Make sure it is all white so that all parts of the texture will show up in game. The alpha channel of the main texture file is responsible for opacity. We can make use of black and shadows of grey to completely or partially hide certain areas. After finishing the texture save it as “light_peasants_attachments.dds” format with alpha layers enabled DXT5 setting.


    Part 6: Normal Map Now we need to make the normal texture. You can read on what normal textures are in Alletun’s Tome of Knowledge. The easiest method is to use Nvidia’s Normal Map Filter, which comes with Nvidia Developer Tools you must have downloaded earlier.

    Step 1: Open your .dds texture file -> save as “light_peasants_attachments_normal.dds” -> desaturate (Ctrl + Shift + U) -> Brightness/Contrast -> slightly increase contrast -> Filter -> Nvidia Tools -> Normal Map Filter -> Set Scale to 5 and Alternate Conversions to Max (RGB). Important thing to know, this filter must be used only on a single layer, which must be the background layer. If you have many layers, flatten the image first.

    Step 2: Press ok. This will generate a pink-violet normal map. Notice that darker areas are coming out of the surface, while brighter areas are sunk inside. This is what we want in this case. Note, however, that usually we want this to be other way around, in case of armours or other clothes. Thus the usual value should be negative. The scale can be different, but I find that 5 is just nice. You can also use Biased (RGB), but it is not consistent with the bumps.



    Part 7: Normal Map Alpha Channel The normal map is only half way done. In game, the engine will make use of alpha channel of normal map to know which parts to highlight. In our case, we want the sharp end be shiny in game.

    Step 1: Currently our texture does not have an alpha channel. For that go to “Channels” tab in Photoshop, press the small square icon below, which will create an alpha channel.

    Step 2: Hide the alpha channel by pressing on the eye icon, activate the RGB channels. Go back to layers tab, right click on any of the layers -> flatten image. Select all (Ctrl + A) then copy to clipboard (Ctrl + C) and undo merging of layers (Ctrl + Alt + Z). Go to your channels, activate your alpha channel and paste your texture (Ctrl + V).

    Step 3: Now we need to delete the wooden parts, because only metal parts should shine. Then go to Image -> Adjustments -> Brightness/Contrast -> decrease brightness, increase contrast. Otherwise the metal will be too shiny and look unrealistic. Save the file.



    Part 8: Texture Files We have not made any changes to the peasant body, hence we will use vanilla textures. Locate the “figure.dds” and “figure_normal.dds” in the workbench folder, then rename the textures to be consistent:
    • light_peasants_figure.texture
    • light_peasants_figure_normal.texture
    • light_peasants_attachments.texture
    • light_peasants_attachments_normal.texture




    Section 4: Finalizing the Model

    This section covers more subtle details of modelling. We still need to make adjustments to the model and the UV-maps. Also, we need to assign our dagger to the skeleton.

    Part 1: Loading Textures in MilkShape We now need to load the textures in Milkshape. Open your model, go to Groups tab and click on attachments. There select the upper box with “<none>” on it. A dialog window will pop-up, where you need to select your texture. The model is now textured, although in my case I encountered a little problem due to shifting of the hilt texture:



    Part 2: Texture Coordinate Editor This can be fixed in Milkshape. Select all (Ctrl + A) and open Texture Coordinate Editor (Ctrl + T). There you can use familiar tools of moving, scaling, and rotating to fix the UV map. Important thing to note, you can zoom in by using scale button. Also it is a good idea to make final changes to the model itself. In this case, I decreased size of rings and made some final adjustments:



    Part 3: Merging with Main Model We can now merge the two parts together.

    Step 1: In the Groups tab, double click on each of them to select, and then press Regroup. This will merge both parts into a single group.

    Step 2: Change the name to “dagger”, hit Rename button. The model is practically done. We are only left to merge it with the base model of a peasant in case if listened to my suggestion and made your model in a separate file. If not, you can skip this step.

    Step 3
    : Open GOAT and press on “Ms3d Merge”. First select the “peasants_lod0.ms3d”, then the file with dagger. GOAT will produce a separate file called “peasants_merged_lod0.ms3d”. Rename it to “light_peasants_lod0.ms3d”. We must include “_lod0” – level of detail in the file name. This tells the game this is high detail model. If you encounter an error and GOAT does not produce any new files, post the error image in the tutorial’s thread.


    Part 4: Placing the Dagger
    We now need to remove unnecessary pitchforks and fit the dagger in the right had.

    Step 1: Open the file and delete all the pitchfork groups. The knife animations will not work well with spear-type weapons, and besides, they do look quite bad. Notice how our blade is just hovering in the air after merging.

    Step 2: Use move, rotate and scale tools to fit the knife inside the peasant’s right hand.



    Part 5: Fixing Split Mesh Seams
    Now, since we are done with alterations to vertices, we can fix the seams. Seams come about due to normals of adjacent surfaces having different values, which affect shadows. This usually happens when only half of a model is made, which is then mirrored around its axis of symmetry, a common practice by modellers. Normals are by default perpendicular to surfaces. Thus some normals coming from the same location can have different values.

    Step 1: You should have downloaded Align Normals and Extended Manual Edit extension for MilkShape by now. To install, unpack and place the .dll files inside MilkShape’s directory located inside Program Files.

    Step 2
    : Now open your model in flat-shaded view. You should have Align Normals and Extended Manual Edit utilities now available in Vertex menu. To fix all the seams and broken normal, simply select all (Ctrl + A) and press Align Normals. Notice how the model looks much better now. This extension finds vertices placed exactly at the same place, and equalizes their normals. Note that there are other workarounds out there. However this method is the most practical. I am pretty sure even experienced modellers will find this utility very useful.



    For more experienced – Extended Manual Edit:

    Extended Manual Edit is just a more powerful version of Manual Edit that comes with Milkshape. It can be very useful for changing location, normals, and bone weights and so on manually. This can be especially useful when you want to know how many vertices you selected or to change position of a particular vertex located very close to other vertices.



    Part 6: Bone Assignments and Group Comments
    We have placed the dagger in place, but the game will not know how to animate it. In this case, we need to assign the dagger to the joint “rhand”. Any of the weapon joints will work just as fine. These are not used by the game, but are child joints of the joint “rhand” and move identically with it.

    Step 1: Joints tab -> tick Show Skeleton

    Step 2: Groups tab -> double click on the dagger group -> Joints tab -> choose “rhand” from the list and hit assign.

    Step 3: We also need to give a comment to the group. Go to Groups -> click on the dagger group -> press comment and type in the following:

    Code:
    primaryactive0
    dagger
    0

    Step 4
    : Select the dagger group -> go to Joints tab -> press “show”. This will indicate the bone the selected vertices are assigned to.



    Step 5: Finally, save the file as “light_peasants_lod0.ms3d”. Don’t forget to convert the model into .mesh format using GOAT. Upon successful conversion GOAT’s command line will display “ms3d to mesh conversion complete”. If unsuccessful, check if all groups have proper comments, including model comment in Model tab, where should be 4 lines of numbers. Check, if you accidentally deleted the skeleton, by ticking the show skeleton button. In any case, you should not have any issues, if you use a vanilla model to start with. It has the right skeleton and the main model comment.

    Information on Group Comments:

    “Primaryactive0” is the group’s category. We are telling the game, that this is the primary weapon the peasant will use. If we make another weapon, give it “primaryactive0” attribute, then the game will load two types of weapons separately on different peasants. M2TW engine will understand that these two weapons are in the same category, and should not appear simultaneously on the same unit. Other important categories include “secondaryactive0”, recognized as side weapon, and “shield0”, recognized as shield. We can make our own categories, such as “bag”, “head”, etc. anything will work fine, but when dealing with weapons stick to the above-mentioned three. Second line of group comments is simply a group’s name. Third line is quite interesting. 0 means it will appear on every unit or only on half or one third, when there are two or three groups in the same category. Another possible value is 1, which will tell the game to only load this group on few units. For example if we place 1 on our dagger, only 5-10 out of 100 will be wielding it in game.


    Section 5: Optional - Animations in MilkShape and Fixing Glitches

    Part 1: Loading Animations in MilkShape It is simple to make bone assignments for weapons. However, when it comes to more complicated parts, for example armpits and thighs, the model can look glitchy and weird, when bone assignments are not carried properly. The process of assigning bones can be tedious and many trials and errors may be required. Typically, to test bone assignments one would load the model in game, but that is time consuming. Instead, unpacked animations can be imported directly into .ms3d file and tested in MilkShape. For modelling purposes, only few animations such as walking and stabbing are enough to check bone assignments. Therefore, I included few basic animations inside the “…/workbench/anims/” folder.

    Step 1: Open GOAT, press “Animmerge” -> select your model file -> select “MTW2_Knifeman_ready_hf_idle_1.cas” -> set 5 frames per second in the third window. GOAT will produce a new file with a long name.

    Step 2
    : Open the file, click anywhere inside the 3D view-pane, hit “Animate” in the lower right corner. Play the animation and check whether the model is working as expected. You can see in the picture below that my dagger is working just fine. Also it is hard (no pun intended) not to notice how the pelvis area is not assigned properly to the bones. This is legacy from vanilla models. Amongst other issues, the head is not joining properly with the body. I will try to fix these issues in the next section, which is completely bonus material and not something to be pulled off by complete beginners. Well, the choice is yours.



    You can make changes and save the model that has animation in it without any worries. The animations are not stored in .mesh file upon conversion.


    Part 2: Neck Area Gap Fix We will first fix the little gap around neck area. I would like to use this opportunity to show the Extended Manual Edit function:

    Step 1: If you zoom in close around neck area and disable wireframe (right click on 3d view-pane -> wireframe), there is a slight gap between the head and the body. I assume you have Extended Manual Edit extension that comes together with Align Normals mentioned earlier in this tutorial. Select any of the adjacent vertices that cause the gap, go to Vertex -> Extended Manual Edit. Look for XYZ coordinates. You will notice there are some subtle differences in values. You will also notice there are 3 vertices instead of expected 2. Do not try to weld them together, as this may lead to problems later. Never weld vertices across different groups, head and body groups in this case.

    Step 2: To fix the gap, go to Vertex, press Snap Together (Ctrl + N). This will recalculate position of the vertices and take average values of all the selected vertices. Repeat this procedure with all pairs of vertices around the neck area.



    Part 3: Pelvis Area Bone Assignments Fix Now, we will try to fix the bone assignments around pelvis.

    Step 1
    : Open the model file that does not have animations in it. If you only have the file with merged animations in it, you can use GOAT to convert it to .mesh and back to .ms3d. As I mentioned earlier, the animations are not stored in .mesh format. Now activate animation mode, go to Joints tab and double click on joint “rthigh”. Then use Rotate (F3) to rotate the right leg in the side view. Do the same with “lthigh”, until you have something like in the image below. You will clearly notice how the area between legs is not looking right. The dude obviously just woke up.

    Step 2: Deactivate animations mode, and check the bone assignments. The problem is due to the vertices being assigned to two thighs, which add up when squatting. To fix this, we can add third bone pelvis, and assign 50% of weight to it. The others will automatically reassign to maintain the total weight of 100% due to Adjust Other Weights feature.

    Step 3
    : Finally, activate animation mode to check the changes. After finishing all the adjustments, do not forget to convert the model into .mesh format for testing in game.


    Section 6: Text Editing

    Good news, at this point our models and textures are all done. Bad news, the game does not know about our new peasant unit. To keep it simple, we will be adding the new peasant unit to England only. To open .txt files with Notepad++ right click on a file and press “Edit with Notepad++”. Most importantly, you must be familiar with “export_descr_unit.txt” (EDU) and “battle_models.modeldb” (MDB) files. Alletun’s Tome of Knowledge explains them well. I also suggest reading the excellent guide on EDU by Mythic_Commodore here.

    Part 1: Placing Files in Our Mod Make sure you have all the mesh and texture files ready:

    • light_peasants_lod0.mesh
    • light_peasants_figure.texture
    • light_peasants_figure_normal.texture
    • light_peasants_attachments.texture
    • light_peasants_attachments_normal.texture

    Step 1: Place all these files in “…/mods/modellers_mod_v1.0/data/unit_models/tutorial_units/”

    Step 2: Go to “…/mods/ modellers_mod_v1.0/data/” and open EDU with Notepad++.

    Step 3: Go to “…/mods/ modellers_mod_v1.0/data/unit_models/” and do the same with MDB.


    Part 2: EDU In EDU, find the entry for Peasants. You can use “find” tool (Ctrl + F) to look for “; Peasants”. Copy the entire entry and paste at the very bottom of the file. Below is the entry for our new peasants, where parts different from vanilla peasants are shown in red colour. If you could not find the vanilla peasants entry, directly copy the entry below.

    Code:
    type                   Light Peasants
    dictionary                      Light_Peasants      ; Peasants with daggers
    category                        infantry
    class                              light
    voice_type                     Light
    banner faction                main_infantry
    banner holy                    crusade
    soldier                           Peasants, 60, 0, 0.8
    attributes                       sea_faring, hide_forest, can_withdraw, is_peasant, peasant
    formation                      1.2, 1.2, 2.4, 2.4, 6, square
    stat_health                     1, 0
    stat_pri                         4, 0, no, 0, 0, melee, melee_simple, piercing, spear, 25, 0.6
    ;stat_pri_ex                   0, 0, 0
    stat_pri_attr                  no
    stat_sec                         0, 0, no, 0, 0, no, melee_simple, blunt, none, 25, 1
    ;stat_sec_ex                   0, 0, 0
    stat_sec_attr                  no
    stat_pri_armour                         0, 3, 0, flesh
    ;stat_armour_ex             0, 4, 0, 0, 3, 0, 0, flesh
    stat_sec_armour             0, 0, flesh
    stat_heat                       2
    stat_ground                   1, -2, 3, 2
    stat_mental                    1, low, untrained
    stat_charge_dist              30
    stat_fire_delay                0
    stat_food                       60, 300
    stat_cost                        1, 110, 90, 65, 50, 110, 4, 20
    armour_ug_levels            0
    armour_ug_models               light_peasants
    ownership                      england
    era 0                             england
    era 1                             england
    era 2                             england
    ;unit_info                      4, 0, 3
    Line “soldiers” is the animation reference to entry in MDB file. The game will look for the stated unit and use its animations. In our case we will need to create our own entry or use any unit that has MTW2_Knifeman_Primary animation. Line “armour ug models” refers to the MDB entry the game will look for the model and textures. The other lines are of no concerns to us in the scope of this tutorial.


    Part 3: MDB
    In MDB, in the top-most line increase the number of entries by 1. This is a very important step.

    Code:
    22 serialization::archive 3 0 0 0 0 704 0 0
    Find “8 peasants”, copy the entire peasant entry and make a duplicate at the bottom of the file. If you have familiarized yourself with the MDB file, you know that it contains information on 3D model, 2D textures, and animations. In the first few lines of our entry, we will be indicating path to our mesh file. The numbers that come after the directories are the square of the distance at which the particular level-of-detail model loads. Since we only have lod0 model, we need to delete all the rest and increase its distance number. Also, since we are making a new unit only for England, we can reduce the size of the entry by deleting all the other faction’ lines. Don’t forget to change paths to textures as well. MDB is very sensitive and must be filled very accurately. Pretty much most of the lines have changed and the resulting entry looks as follows:

    Code:
    14 light_peasants 
    1 1 
    51 unit_models/tutorial_units/light_peasants_lod0.mesh 6400 
    1 
    7 england 
    56 unit_models/tutorial_units/light_peasants_figure.texture 
    63 unit_models/tutorial_units/light_peasants_figure_normal.texture 
    49 unit_sprites/england_Dummy_EN_Spearmen_sprite.spr 
    1 
    7 england 
    61 unit_models/tutorial_units/light_peasants_attachments.texture 
    68 unit_models/tutorial_units/light_peasants_attachments_normal.texture 0 
    1 
    4 None 
    18 MTW2_Fast_Knifeman 
    0 
    1 
    18 MTW2_Knife_Primary 
    0 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002


    Part 4: Test Run and Troubleshooting Open the “modellers_mod_v1.0.bat” and, if you did everything correctly, the game will launch. There go to Custom Battle and play as England with the new “unlocalized placement text” unit. It will have a Rome Total War peasant unit card, which is used by default if there is no specified unit card. Check, if the dagger is sitting properly, play the battle and save the game as “test”. Make some screenshots in the process.

    Troubleshooting:

    1st Option: the game crashes immediately after launching -> the problem is in MDB file. Make sure you have increased the model count from 703 to 704 or whatever the number you have there by one. Check that the first line of every entry corresponds to the number of characters in the line. Notepad++ offers excellent information, including number of characters, upon selection of text. If nothing helps, go to EDU, change the armour_ug_model line back to “peasant”. Run the mod, if the game launches fine, then the problem is with the new entry in MDB. This also indicates the animations indicated in “light_peasants” in MDB are fine. You will see the vanilla peasants with pitchforks using them like knifes.

    2nd Option: the game crashes during custom battle loading screen -> the problem is in the mesh or texture files or the path to file is incorrect in EDU. Simply put, the game is unable to find the files to load. Check you have the 5 files placed in the correct folder. Check file and folder names. Check the path in EDU. If nothing helps, go to you mod folder and open system.log.txt. Look for key words there, something like “…line 13657 light_levies_mesh could not be loaded…” these can give a hint on what is wrong. Finally, you can post the system.log.txt in the tutorial’s thread.

    3rd Option: the custom battle loads fine, only the units look weird, with arms spread to sides or very shiny textures -> the problem is in the 3d model. In case of stiff-man syndrome, most likely some comments are wrong or missing. Another possibility, some vertices are underweighed or unassigned. You will have to go back to Milkshape and fix them. Check comments first. Then go to Vertex -> Unimesh Select Underweighed Bones. If some vertices become red, you have to reassign them to bones. In case of very shiny model, the problem is with the normal. The game applies too much light on them. To fix simply select all and use Vertex -> Align Normals. Same goes for weird shadows and highlights on some parts of the body. Sometimes it can be necessary to assign entire model to bone pelvis first, then manually reassign all the vertices.


    Part 1: Optional - Quicker Test Running with Cinematic Editor Cinematic editor is a very convenient way of testing models in game. We don't have to go to Custom Battle and play a new one every time. Instead, we can save a replay and use cinematic editor to straightaway load the replay without need to go to main menu.

    Step 1:
    Place the 4 files that come with cinematic editor in your M2TW root directory.

    Step 2: Open the “cine_ed_edit.cfg” and indicate the correct path to your mod and replay file in the replay and features sections:

    Code:
    …[replay]
    play = 1
    file = D:\Games\Medieval II Total War\mods\modellers_mod_v1.0\replays\test.rpy
    camera = D:\Games\Medieval II Total War\mods\modellers_mod_v1.0\cameras\
    show_battle_ui = 0
    info = 0
    
    [features]
    
    editor = true
    mod = D:\Games\Medieval II Total War\mods\modellers_mod_v1.0\
    Step 3: Open the “cine_ed_edit.bat” in Notepad and indicate the correct path there as well:

    Code:
    kingdoms.exe --features.mod=mods\modellers_mod_v1.0 @cine-ed_edit.cfg
    Step 4: You can now launch “cine_ed_edit.bat” and the replay will be launched in windowed mode without need to go to the main menu. This is a quick way to test models in game. Also, there is an additional toolbar below much like a video player. The main advantage of cinematic editor is that you can rotate camera as you like and make screenshots like these:



    You can read more about its features and find links to tutorials on YouTube here.

    Section 7: Troubleshooting GOAT v1.1
    For Windows 8 Users here is a solution by Jox25:
    Quote Originally Posted by Jox25 View Post
    In Python directory i've found file named IDLE (Python GUI). I'm started it then i'm pressed: File->Open(Ctrl+O)->GOAT.py and pressed F5(run module). It works. Important: All files from archive must be together(Library,Tollbox,*.ini)
    Possible Errors and Causes Error: 'ms3dObject' object has no attribute 'lodname'
    Cause & Fix: The model name must have level of detail indication. Simply add "_lod0" to the model name and from now on make it a habit. Other lods are lod1, lod2, lod3, which are usually not used in mods.

    Error: 'Ms3dObject' object has no attribute 'isregular'.
    Cause & Fix: The model comment is missing (under model tab). Can be fixed by copying the missing comment from another unit.

    Error: 'empty string for float ()'.
    Cause & Fix: The main model comment has empty lines in it. Simply delete the empty lines. The comment must consist of four lines of numbers followed by separator "\". Here is an example:
    Code:
    0.00508303847164
    0.233899950981
    0.366608440876
    1.31867194176
    /
    Error: IndexError: list index out of range or AttributeError: 'ms3dObject' object has no attribute 'groupcommentsection'
    Cause & Fix: Group comments are missing. Check if all groups have comments.

    Error: -128 < byte count <= 127
    Cause & Fix: None of the vertices are attached to the bones. Make sure you have rigged the body to the skeleton.

    Error: unpack requires a string argument of length 1
    Cause & Fix: Some groups are not assigned any material.

    Generally when working with models it is a good idea to test it in GOAT after making big changes. Especially after merging different parts.


    I hope this tutorial will overcome the barrier to modelling for M2TW and get more talented people involved in modding. I will look forward to make more tutorials, less detailed, more on the general procedures and outcome. Here are some ideas for future tutorials:

    • More weapons such as swords, spears, bows
    • Detailed implementation of bow string animation
    • Making better normal maps

    Please leave feedback and suggestions, point out mistakes, post your works, and of course feel free to ask to help.

    Attached PDF version.
    Attached Thumbnails Attached Thumbnails [Tutorial] Learn-by-Example 01 - Medieval Dagger.pdf  
    Last edited by G|I|Sandy; May 18, 2015 at 01:28 AM. Reason: Fixed some mistakes

  2. #2
    BM309K58SMERCH's Avatar Centenarius
    Join Date
    Feb 2012
    Location
    Gensokyo
    Posts
    879

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    This is excellent! An extremely helpful tutorial! A must read for every beginner wanting to jump head-first into modelling. I also highly appreciate the texturing part as I have difficulty texturing a simple metal blade.
    I must say, the cinematic editor seems out of place in this specific tutorial, but it summarized everything you need to know about it in 1 simple paragraph.
    Thank you very much for this.

  3. #3
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Excellent tutorial for those who start with modelling! Have a rep

  4. #4
    Kahvipannu's Avatar Bring me Solo & wookie
    Join Date
    May 2009
    Location
    Finland
    Posts
    3,671

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Excellent tutorial, very well written. +rep

    If your ok with suggestions, you could add Milkshapes own "texture coordinate editor", using it isn't as effective as Lithunwrap, but a lot simpler and most of times enough.

  5. #5

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Call me crazy but how do you open the GOAT tool? When I try it says it is unrecognizable file type?

  6. #6

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Emperor Hantscher,

    You need to have python installed. GOAT hasn't been updated for quite some time, so it only works with older versions of python. If I remember correctly you need 2.6.8 from this list: http://www.python.org/getit/releases/ .

    Sandy

  7. #7

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Ok I will try that, I'm on my phone now so I can't do anything just yet. Great tutorial btw I've been looking for a basic tutorial to start learning how to model for m2tw. Hopefully once I figure out this GOAT thing I'll be able to figure out the texturing bit.

  8. #8

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Hmmmm, Python is a little to complex for me it seems. I download, extracted the zip and it created The Python folder and all subfolders and the thousands of tiny files....but now what? There is no exe or anything and I still can't get GOAT open. Is there any alternative to convert my UV Map to .dds?

    I will post this in the GOAT folder aswell, I might get a faster response here.


    EDIT Problem solved....I was downloading the wrong file(source code instead of the installer.msi)
    Last edited by Emperor Hantscher; May 08, 2013 at 09:39 PM.

  9. #9
    Mr.Jox's Avatar WHY SO SERIOUS?!
    Join Date
    Mar 2013
    Location
    Crimea
    Posts
    2,362

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Can someone help me: I can't do this step: Step 1: Open “GameObjectApplicationToolbox_v1_1.py”.
    I'm installed much of Python versions and tried to open this file but i didn't get any results.. Just there are appearing a console window for a second then it's disappearing..

  10. #10

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Jox25,

    I have a 64 bit system, Windows 7. GOAT v1.1 works without any compatibility issues. I downloaded Python from here: http://www.python.org/download/releases/2.6/, the x86 MSI installer.

    It is a very old version (2008). 2.6.8 is 2012. I still think it works on 2.6.8. Anyways try 2.6 from the link above.

    Sandy
    Last edited by G|I|Sandy; June 14, 2013 at 10:15 AM.

  11. #11
    Mr.Jox's Avatar WHY SO SERIOUS?!
    Join Date
    Mar 2013
    Location
    Crimea
    Posts
    2,362

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Didn't help.. May be something with PC or .. ? I'm using Win8 x64 and i've got a notebook
    Last edited by Mr.Jox; June 14, 2013 at 10:58 AM.

  12. #12
    T&D's Avatar Vicarius
    Join Date
    Dec 2009
    Location
    Shoe store...
    Posts
    2,843

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    This is for win 7 i think brow.

  13. #13

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Jox25,

    You can try to change the compatibility settings. Locate where your python is installed. Find the .exe, right click, go to compatibility, make it XP or Win 7. You can also force it to open as administrator. If this doesn't help, try searching for general issues with python and Win8. Search for "python 2.6 on Win8 not working" or something similar.

  14. #14
    Mr.Jox's Avatar WHY SO SERIOUS?!
    Join Date
    Mar 2013
    Location
    Crimea
    Posts
    2,362

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    So i've found another way to open this file:
    In Python directory i've found file named IDLE (Python GUI). I'm started it then i'm pressed: File->Open(Ctrl+O)->GOAT.py and pressed F5(run module). It works. Important: All files from archive must be together(Library,Tollbox,*.ini)

  15. #15
    Mr.Jox's Avatar WHY SO SERIOUS?!
    Join Date
    Mar 2013
    Location
    Crimea
    Posts
    2,362

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    I have got a problem. I'm doing this step: Step 4: Open the generated “dagger_attachments.dds” in Photoshop. When I open x_attachments I didn't get any images(only black background). If I open x_figure I'm getting a picture with mine blade & hilt(like at screenshot)

  16. #16
    Mr.Jox's Avatar WHY SO SERIOUS?!
    Join Date
    Mar 2013
    Location
    Crimea
    Posts
    2,362

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    I have got a problem. I'm doing this step: Step 4: Open the generated “dagger_attachments.dds” in Photoshop. When I open x_attachments I didn't get any images(only black background). If I open x_figure I'm getting a picture with mine blade & hilt(like at screenshot)

  17. #17

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Jox25,

    This means your dagger is assigned to material "figure" and not "attachments". You can double click on your dagger group under Groups tab in Milkshape, go to Materials tab, select Attachments and hit Assign. Notice how your material near the group's name changes to <Attachments>. Then generate the UV-maps in dds again, your figure will be black, attachments will contain your dagger.

    Sandy

  18. #18
    Mr.Jox's Avatar WHY SO SERIOUS?!
    Join Date
    Mar 2013
    Location
    Crimea
    Posts
    2,362

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Thanks it's helped. lol look what i've got:

  19. #19

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    Jox25,

    Simply select your dagger group (double click on it, it wil turn red) then Scale it down under Model tab. You can then rotate it and move around to fit into the hand. Dont forget to assign the dagger to bone_rhand. Otherwise it will not be animated.

  20. #20
    Mr.Jox's Avatar WHY SO SERIOUS?!
    Join Date
    Mar 2013
    Location
    Crimea
    Posts
    2,362

    Default Re: Learn-by-Example Modelling 01: Medieval Dagger

    I know and i did it Just why it became so big?

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •