1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

Modeling tips

Discussion in 'Modding' started by Sacman, Jan 22, 2016.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Sacman

    Sacman Trainee Engineer

    EDITED after I spent all day doing this.

    Last night I spent several hours learning some of the ins and outs of modeling for ME. I'm sure that a lot of this is exactly the same as SE but not everyone plays both so I thought I would share some of what I learned. All of this was done modifying existing game models. This is a great way to start learning the process.

    What I did was make thin planks using the existing timbers and make small barrels from the standard ones. I used Blender for the modeling and Photoshop for texturing. Since I was using the existing textures, I merely had to open the block_sheet_de.dds texture in Photoshop and save it back out as a PNG so I could use it in Blender. The texture is found in the Game Content folder. Almost all of the blocks use the blocksheet texture map.

    You will have to have the ME Mod SDK to create new models for ME. The tools in the MOD SDK include the ModelBuilder and the ModelViewer. Both of these are needed. You will also find a folder called Original Content. This includes the original FBX models of all current in game items as well as some that aren't in the game like ladders.

    When you import one of these FBX models into Blender, the material and texture will be broken so you will have to update it. Just delete the existing one and add the new one. If, like in my case, you are trying to make thin planks from the existing timbers, you only have to set this up once to use it for all 10 sizes of the new planks. I did not try to scale them by hand, I just imported each of the FBX's for the timbers and then scaled the Z axis to 1/4 the original. Even with the broken textures, if you add in the same block_sheet texture, when you UV unwrap the model, the components will line up correctly on the map so you don't have to move the UV's around.

    Blender has a bit of a learning curve but being completely free makes it worth it. It is extremely powerful for what it is. This is not a blender tutorial but there are some critical things that you need to know. The original FBX files do not always conform to how they handle models now in the game. For example, if you import the woodbarrel.fbx model, the center point of the barrel is not at the world origin. However, if you were to look at the actual game model (woodbarrel.mwm) in the ModelViewer, you will see that it should be. So for now, make sure that the center of your model is at the world origin (0,0,0). To make the learning process easier, you should start this with models that are generally symmetric so that the center point is easily identifiable.

    Once your texture is assigned and your model is where you want it to be (I can go into detail on how to assign textures to UV's but you can find YouTube videos on this) you are ready to export it. There are some features of the export that are critical. First is the type of export. I am not at the right PC at the moment but you need to choose the ASCII format for export. There are only two options and one is not ASCII. You must select, 'export selected only' and make sure your item is selected in the main Blender window. Out of the options of what to export, select only the Mesh. Turn off animations. And the most important part is the scaling. For some broken reason, ME scales every model to a factor of .01. I am struggling with the logic of this since everything I have ever known says scaling costs overhead. So why would they scale every model? Anyway, this is critical because the default scale of the export is 1. If you export this way, the game will subsequently scale your model down to .01. Makes for a tiny model :) So change the scale factor to 100 to offset this. Now export the model.

    If all went as planned you are done with Blender. But if you are like me you screwed something up in the texturing and will have to do it about 3 more times before you figure out the process. Or you forget to scale it and end up with the model in game and you can't see and don't know why so you have to back all the way up to Blender and go again. This is why the ModelViewer is your friend.

    One more quirk of this process is that Blender does not export the FBX in a version that ModelBuilder recognizes. There may be a plugin for it but I found it safer to use the AutoDesk conversion tool. This tool converts FBX models to the 2013 format which ModelBuilder does recognize. You can find it here : https://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=22694909

    This tool is very simple to use and self explanatory. The only thing I would caution is to allow it to create its own folder in the same directory as your source models when it converts. It will save you some confusion. You can batch convert which is nice when converting 10 plank sizes.

    Keep everything straight at this point. I would strongly recommend a folder somewhere called ME Models with subfolders for everything you are building. I would save the blender file here as well as the base textures (the PNG not the dds files) as well as the XML's you have to create. When you run the conversion tool, it will create a subfolder within this folder for your converted FBX Files. I leave them in that folder for now because you will need the original FBX later.

    Before we can move on to creating the model, you have create an xml file for it. I would strongly recommend getting GEANY. It is a free software that is better than Notepad++ for viewing and editing XML files because it color codes the branches which Notepad++ does not. But you can simply use a text editor. For this stage a Text Editor like notepad is fine because the XML file is short and easy to follow. Later, when adding a new model to the game, notepad is just not good enough. Either way, create a new file in notepad, Geany, or Notepad++. Paste in the following:

    <?xml version="1.0"?>
    <Model Name="Default">
    <BoneGridSize d2p1:nil="true" xmlns:D2p1="https://www.w3.org/2001/XMLSchema-instance" />
    <Parameter Name="Centered">false</Parameter>
    <Parameter Name="RescaleFactor">0.01</Parameter>
    <Parameter Name="RescaleToLengthInMeters">false</Parameter>
    <Parameter Name="SpecularPower">10</Parameter>
    <Parameter Name="SpecularShininess">0.8</Parameter>
    <Material Name="01 - Default">
    <Parameter Name="SpecularIntensity">0</Parameter>
    <Parameter Name="SpecularPower">2</Parameter>
    <Parameter Name="DiffuseColorX">255</Parameter>
    <Parameter Name="DiffuseColorY">255</Parameter>
    <Parameter Name="DiffuseColorZ">255</Parameter>
    <Parameter Name="Texture">Textures\Models\Cubes\large_assembler_de.dds</Parameter>
    <Parameter Name="NormalTexture" />

    There are two pieces of info you MUST change for this to work. First is the Material Name and second is the Texture. First we will tackle the texture. This was super confusing to me for a long time but I finally figured it out. All you want to change in the line is the actual name of the _de texture. If you are using the default blocksheet texture, it should be 'block_sheet_de.dds' Leave everything else alone. The modelbuilder knows where to look if you have left the Texture\Models\Cubes\ part as is. The textures don't even have to exist at this point. You just have to know where they are going to be and what the names are.

    Supposedly if you leave the NormalTexture part alone, the ModelBuilder is supposed to find the rest of the texture components like the CM, NS, NG etc and fill them in for you. That has not worked for me so I have added them manually. The easiest way to figure this out is to open the existing game model in ModelViewer and see which textures it uses. And then add them to the xml. So in the case of the normal texture, that line would look like this:

    <Parameter Name="NormalTexture">Textures\Models\Cubes\large_assembler_ns.dds</Parameter>

    For the color metal texture it would look like this:

    <Parameter Name="ColorMetalTexture">Textures\Models\Cubes\large_assembler_cm.dds</Parameter>

    The parameter name is critical. It will break the build if it is wrong. In the modelviewer, look at the various texture names, what goes in the XML is the exact same wording with no spaces.

    The other part of the XML that has to be changed is the Material Name. If this is wrong, you will get a black model every time. You can get this info from Blender but I find it confusing so the best bet is to take it directly from the FBX file. So right click on the original FBX and open it in Geany, Notepad, or Notepad++. The converted FBX won't work since it is binary, you have to look in the original ASCII one. Do a search for Material:: yes there are two colons on purpose. the name that is given after this is exactly what needs to go in the XML. It is still confusing to me but the whys don't matter as much as that it works when it is right. So copy and paste this into your XML. So mine looks like this:

    <Material Name="blocksheet__block_sheet__PNG">

    Save the file as an .XML using the exact same name as your FBX file. So if you called your exported model, smallbarrel.fbx, the XML must be called smallbarrel.xml. If these do not match you get a black model in the game.

    At this point in your folder you should have a folder with the 2013 FBX conversion files , the original FBX files and the XML file. You may also have the .blend file here if you saved it. You may or may not have the texture file here. It is less critical where this file resides and a common location may be better if you are using the block_sheet file.

    It's ModelBuilder Time! I find it is easier to copy the two files (FBX and XML) from your model folder to the main game content folder. Don't forget it's the converted FBX. I don't think you have to but it works for me so do it that way until you figure out how to do it another way. There are no other files in this folder normally so when you are done you can delete anything you created there.

    Open ModelBuilder. This software has 4 file paths you must set in order for this to work. First, at the top left of the screen , you will see a VRage Editor tab. Click on this. This will bring up a screen with Plugins and Settings in the upper left. Click on settings. In the settings dialog there are two file paths to set. As you can see, they are set to somewhere on a KeenSWH PC. Not good for us. You need to change both of them. The first is the path to the mwmbuilder.exe file. There are two places to find this. You want to make sure you choose the right one. It is located in the plugins folder of the ModelBuilder tool folder. Find this file and select it. The second one is the FBXSceneTreeViewer. This file is in its own tool folder. You probably saw the folder on the way to the Modelbuilder folder. There is only one file in that folder. Select it.

    Close the settings and go back to the Modelbuilder tab at the top left.

    There are two paths that have to be set on this screen as well. One of them is obvious. The output path is where you want your finished model to end up. I personally point this to my model folder that I created to save everything. This keeps everything together.

    The other path called content led me on a wild goose chase for a long time. For our purposes, this is where your FBX files are that you want to convert. However, this is also what defines the texture locations when the model is built. If you are using the default block_sheet, it will be in the textures\models\cubes folder under this main content folder. If you are using a mod with its own textures, they will reside in the textures\models\cubes folder within you mod folder. So either way it works but you must set this to the game\contents fodler. This is why I put my fbx and xml files in the content folder. The part where you add your FBX to the builder is also linked through this path which is why it is better to put your FBX and XML in the content fodler. So it should look something like this:

    c:\program files (x86)\steam\steamapps\common\medievalengineers\content

    Once all 4 paths are set, check the box that says force rebuild. This is not necessary but if you find you have a mistake in your xml file for example and it builds the model with no textures, you would have to go to the folder and delete it to make it build it again. If you don't select force rebuild and it sees the mwm already exists, it will not build it again regardless of changes you make to the xml.

    You can elect to have it export xml which is not a bad idea but I don't do this. I verify my build in the modelviewer before I try to bring it into the game.

    Now go to the top box and scroll down to find your fbx. You can batch build as long as all of your xmls and fbxs are there. Select the fbx(s) you want and click 'add to build'.

    Click BUILD in the top menu bar.

    You will get a very fast console window popup and after a couple of seconds, the mwm file should appear in the folder you selected as output. If the file doesn't appear, there is a mistake somewhere. If you go to your modelbuilder folder, there are three txt files created to help you troubleshoot. I am going off memory, but the one with err in the name should be empty. Open it to check. The second one in the list will tell you that model build info. A useless file since it really just tells you how much time it took. The third file will always tell you it cannot find the materials directory. This is fine and you can ignore it. However, if there is another line of information about being unable to find the diffuse texture then you have a problem. It is most likely in the configuration of the model builder but it could be in the XML.

    The best way to check and see if things worked like you expected is to use the ModelViewer. Open this and load the model you just created. Wait for it....no textures!!!!! crap what did I do wrong. Do everything again...no textures....crap....repeat....crap....

    That was me for about an hour. Don't stress. The modelviewer will not show your textures if you open it from the content folder or your custom model folder or anywhere except in a game approved models folder. You can trick it. Move your mwm into the correct models folder in the main game directory and then load it and you will see the textures. So for the smallbarrel, it would go in content\models\cubes\small.

    What's more important is that you can see the textures are assigned by looking at the model properties below. You will see the name of the material you set in the xml minus the actual texture name (for me this is blocksheet). Click on that. In the section below, scroll down until you see the various textures. While they don't all need to be filled in, you need to see at least the diffuse texture (the de). This is the regular colored image. In most cases you should at least have the normal map as well. If they are there, then you are ready to add your model to the game. Each of the blanks that you expect to have data should say content\textures\models\cubes\blocks_sheet_de_dds or the equivalent. If it does not say this or something very similar, you have made a mistake that will result in a black model in game. Back up and find your error.

    A couple of last notes before I end. By using the default block_sheet texture map, you do not have to add the textures into your mod folder. The game knows how to find them if you have done everything the way I explain it. Speaking of mods, all additions to the game must be done in the form of a mod. You cannot simply add this model to your game models folder and hope for the best. You also can't just modify a game default sbc file. You must create all of this in a mod folder. That is for another stupidly long post but in case you didn't realize it, you can create local mods. You don't have to upload a mod to the workshop just to download it again. This makes it easier to troubleshoot and perfect before you post it up to the workshop.

    And one more, you will likely run into placement issues when you try to place the item in the game. The barrel floats above other things for example. I will address this in a later post.

    Sorry for the egregiously long post but I hope it will encourage others to start making models for the game. It seems overwhelming but it is not nearly as bad as it reads. Once you've done it a couple of times it will seem easy. I did all the painful work of figuring it out for you.
    Last edited: Jan 24, 2016
    • Like Like x 1
  2. Sacman

    Sacman Trainee Engineer

    A follow up with all I learned today.

    Back in the good old DX9 days, you could get away with just a Diffuse texture. You would usually add a Normal Map to make it look like the texture is really on the model but you didn't have to. So today, I was making a completely new model to see if I understood the workflow. Most of it is exactly as described above. So why did it take me about 7 hours to get a textured model in the game??? Hopefully this will help you avoid the confusion I ran into.

    I tried so many times to texture the model, export it, convert it, and load it into the game. It doesn't help that my load times are about 3 minutes. Loading over and over and over and over again tends to eat up time. I don't know if it was in the roadmap or during his live stream but Marek said they are going to work on pre-loading many of the standard assets during the initial load so that loading worlds won't take as long. Sure wish they had already done that after the day I have had.

    Anyway, every time I loaded the game, the model was black. No hint of texture that I could see. I was using a custom texture and applying a Diffuse and a Normal. I thought the normals on the model were inverted but that wasn't the case. I thought maybe it wasn't saving the UV's with the model. Nope. I thought maybe I had changed something in the FBX converter. Nope. I thought maybe I had the texture files in the wrong place but I have found that it doesn't matter when building as long as they are where they need to be when you run the game.

    I took a standard cube and textured it with my texture and loaded it. Black. My original model was made of two object joined together. I thought maybe the modelbuilder didn't like this so I tried another run with a single cube, 2 grouped cubes, and 2 joined cubes. Still all black.

    Finally I pulled the Timber4 from the original content folder and textured it with my texture, built it with the diffuse and normal applied and loaded the game. Still black!

    However, this is what finally pointed me to the texture being the problem. I knew the timber worked because i used it to make my thin planks.

    So here is what I have learned. There are the following textures associated with each model: Add Maps, Alpha Mask, Color Metal, Diffuse, Normal Gloss, and Normal. he only one I know you don't have to have is the Alpha. Plan on having all of the others if you are going to use your own texture. I am not even certain that they are all required but I know now that it works if you use them all.

    What the hell are all those anyway you may ask and so did I. It took a bit to understand it at the minimal level I have. I will link to the place I went to but I found it a bit confusing. So between that sight and what I am about to add hopefully you will become more knowledgeable than I am.

    It's important to point out that the modelviewer will show textures with just diffuse applied. I can only assume that the modelviewer is still using DX9. You can imagine how that added to my frustration since I could see the textures in the viewer but they were black in game.

    First here is the link: https://steamcommunity.com/sharedfiles/filedetails/?id=395248715

    Here is how I understand it.

    First the Diffuse is just your regular color map. No alpha channel expected or required. It is simply all of the colors in the pretty picture.

    The normal map is almost useless in DX11 but you can still create one. If you don't want to, just save an image of the same dimension with the color set to 127,127,255. Should be a light blue.

    The Color Metal (cm) map is made up of 2 parts. First is the regular RGB part or what you see. This is the same as your color map. The second part is the alpha channel. This alpha channel sets the look of the metal. White is metal and black is non metal. In Photoshop, the Alpha channel defaults to all white so you need to go change it even if you don't have any metal in your texture. So for non-metal set it to black. For metal set it to white. I do not know if shades of gray have an affect here but I would suspect they do.

    The Normal Glossy (ng) texture is also made up of two parts. First is the normal map. If you created one for you normal map then use that and you have to modify the Alpha channel for this one as well. This alpha channel sets the glossiness of the texture. Black is no gloss and white is super glossy. The easiest thing to do here is to set it to full black and come back and change it later if you think you need it. Shades of gray do work here.

    The Alpha map sets transparency. Consider the rare time this will be needed. The scrap branches use an alpha map. I'm sure there are some other models that do but generally models made from wood and metal are going to be better off modeled than using an alpha channel. However if you do need it, you will use black and white. Where black is opaque and white is transparent. I think....it might be the other way but you will figure it out pretty quickly.

    The ADD (add) map is the last one and I found it the most difficult and I still don't really understand it. First you need to turn off the green and blue channels. They are not used. This leaves generally a red tinted version of your texture. The level of red drives the Ambient Occlusion. If you open the block_sheet_add.dds file you will see that it is a slightly lighter shade of red than if you simply turn off the G and B channels. I am not entirely sure where this needs to go so you will have to test it yourself. This map also uses the Alpha channel. The alpha channel in this one apparently lets the color be changed while the model is in game. It is called the custom color map. I can only imagine that this is the way the coloring is allowed in SE. It probably is also what allows the Peasants to be different colors now. So instead of making a bunch of different textures, the can use one and set this alpha channel to white for any part of the model that can change color. For our purpose, set the Alpha to black. I don't think we have access to anything that would allow us to change color in game.

    Make sure you have all of these textures saved in you mod folder. You cannot just stick them in the game contents folder. In this kind of situation, you should have a folder named for your mod. In my case it was Signs. Inside this folder you Must have a Data folder (has your modified sbc file(s) in it), a Models folder, and a Textures folder.

    The Models folder will contain levels as well and they need to match what the game content\models folder has. In my case it is Signs\Models\Cubes\Small\sign01.mwm.

    The Textures folder will contain levels as well. First you will have a GUI folder that needs to have an image that will show up in the G menu. Initially I would just use an exiting one while you test. This should also match the game content folder levels. In my case it is Signs\Textures\GUI\Icons\Cubes

    Also within the Textures folder you will have the path to all of the textures you created. As with the others, this needs to follow the content folder structure. Signs\Textures\Models\Cubes\*all of my textures*.

    Whew!!! It was a long day. But I have planks, baby barrels, and now signs in my game. The signs look like crap though so I need a re-design. I actually played for a while this evening so maybe tomorrow...
  3. Tristavius

    Tristavius Senior Engineer

    CM: Colour/Metal

    RGB: Your colour map. This differs slightly from the classic diffuse in that it has no shading information! Mostly this will now be big blocks of colour and tends to actually be a very simple texture, compared to the more traditional diffuse.

    Alpha: Metal... nice and easy. White for metal, black for not metal. It is very rare to use in between values and usually only around areas of rust and the likes. In most circumstances it will just be one or the other.

    NG: Normal/Gloss

    RGB: A normal map, the same as in the old DX9 style workflows except the Green channel should be inverted. A DX9 normal map usually shows an area which in-game will be raised as looking indented on the texture. The DX11 type will look raised both in game and in the texture. (A quick and dirty way to tell which is which).

    Gloss: A bit of an odd one as most PBR workflows which use metal and colour map use roughness instead. If you're using a PBR design program like Substance Designer you may find yourself with a roughness map instead of a gloss. The good news is, one is just an invert of the other so it's very easy to switch. Quite simply, this dictates how reflective a surface is. This is where you'll likely end up putting a lot of your detailing, much the same as a specular map from the DX9 workflow.

    ADD: (Additional?)

    Red: The red channel is used for ambient occlusion. Won't go into detail on AO here... in short it mostly replaces the need to adjust the shaded areas on a diffuse. 0% red means totally occluded (should never really happen and texture would just be black). 100% red means no occlusion at all - the default state for most textures.

    Green: The green channel is the emissive... might not even be used in Medieval and I don't think there's very much which actually glows. Anyway, 0% = no glow, 100% = very strong glow.

    Blue: Not used, always set to 0%.

    RGB Summary: If you have no emissive needs and you're not bothering with the more advanced AO, just set the whole RGB to FF0000 (red). Any emissive areas can be painted FFFF00 yellow, or better yet an orange like FF6600 as full emissive is way too strong usually.

    Alpha: Colour Map. White areas will be re-coloured in game as per the colour selection tool. Black areas will not be. No in between values needed, I believe they get rounded so just black or white. Note that any areas being re-coloured should be grey in the Colour Map (RGB of the CM). The value of this CM grey determines the shading of the colour, not the Alpha of the ADD.

    My knowledge is from SE, but should be applicable to ME as well.
  4. Threule

    Threule Trainee Engineer

    Somehow I followed this tutorial but I cannot get my models to not be a black box
  5. effe

    effe Apprentice Engineer

    hi there @Sacman,

    Thanks for your very precise step by step guid.

    I have been creating a 3D model sort of playing around your idea in a different way, more using the textures but building my 3D model from the scratch. For the rest and from FBX export to model builder i have followed your tutorial steps. The trouble is when i reach the final BUILD step and got to this point : "You will get a very fast console window popup and after a couple of seconds, the mwm file should appear in the folder you selected as output."

    I get the fast pop up but the mwm file is not being created. Modelbuilder creates the three files you mentionned, trouble is, he generates them totally empty with 0 kb size. To get rid of the usual stupid windows problem about "admin rights" one may have on his own computer, i have tried to run Model Builder as admin and got a bad windows error message that says something like : Windows can find "Bin\VRageEditore.ex. Please verify that you have entered the correct name and try again". I am not using Space Engineers. Could it be that there is a modding component that is being installed by SE and not by ME? I have download the whole ME SDK package so i am really not quite sure this can explain. On top of it, there are plenty of vrage editor applications at my second hard drive where ME and ME SDK stands and it's a message i dont get when running Model Builder normally. So i suspect the problem is somewhere else.

    I have done some local searches on Vrage* at c: There s a setting modelbuilder xml that looks properly set with the correct paths and so. Can it be somewhere related to my blender model? That would help if this error log files would say something. Aside, i run windows 10.

    Not sure you can help, maybe a inhouse programmer if not? :)

    Thanks anyway for the work through.

Thread Status:
This last post in this thread was made more than 31 days old.