SR2030 Model guide using Blender 3.5[ | ]
First of all, I'd like to thank community user Nerei for all their help over the years with regards to this subject. Much of the game porting knowledge has been provided by them over time, and this guide would not have been possible without them.
This guide will cover the basic creation of a new model for SR2030. This will start with a basic model and some rules for use in Blender. The tutorial will then move onto generating the texture for the model, and then onto getting it converted ready for the game. The final step will be adding it to the game and then viewing it in game.
The tools required for this tutorial are all free and easy to acquire:
- Blender 3.5 (new versions should also work)
- Gimp 2.10 (or any editor that can export .dds format images)
- DirectX Model Viewer (mainly to preview our model) - GitHub - walbourn/directxtkmodelviewer: A SDKMESH/CMO model viewer using DirectX Tool Kit for DirectX 11
- MeshConvert (to convert the model from obj to cmo format) - Meshconvert · microsoft/DirectXMesh Wiki · GitHub
- A text editing program - notepad is good enough, but for this I will also use Visual Studio code
Creating the initial model within Blender[ | ]
I have made the initial model for this tutorial, but there are some useful tips for making it game ready for the SR series:
- Poly count should be ideally below 1000 poly’s (tri’s in Blender).
- The texture should be a power of 2, from 512 to 4096.
- If you want regional textures, you can only use a single texture map for the whole model.
So, to start with I'll block out our rough model - this is a simple model just for the tutorial, your model should look better than this. This will be a tank so that the process of adding turret rotation and fire points can be demonstrated. For simple vehicles with no moving turrets, only a single mesh needs to be created.
I have made this model as 4 separate parts - these will all need to share the same UV map so that we can use a single dds file.
To achieve this, do the following:
- Be in object mode
- Set the bottom window to the UV editor
- Select all the objects that require unwrapping (in this case, 4 parts)
- Go into edit mode
- Unwrap the model with your chosen method
For this tutorial I will use the “Smart UV Project” unwrap tool and will use an island margin of 0.05. I will also leave the default angle at 66 degrees. This will give me a UV map with the whole vehicle that I can then export to texture. I have also created a blank image of 1024x1024, this will be replaced by our texture eventually but for now is just a placeholder. For your own project, it is worth sorting the UV map into a logical map and optimising it to make best use of space, but for this tutorial we will just go with the generated one.
Now, all we need to do is to select the “UV” menu on the UV editor and then select “Export UV Layout”. This will prompt for a save path, in this tutorial the file is saved into the same folder as the blend file.
Creating the basic texture in Gimp[ | ]
Once you have the UV layout, and you are satisfied with it, then it will need exporting to an external program so that the texture can be drawn over it. From the previous step we now have our UV map.
First, open your chosen image editing program, for this tutorial we have Gimp 2.10. Once the program has loaded, locate and open your UV map. This is what the tutorial one looks like when loaded.
In the bottom left, you can see our image as the only layer. This tutorial isn’t going to teach how to do texturing, but at the very least a few other layers will be created so I can have a different colour for each section of the model. The names do not matter for these layers - they are there only for ease of texturing. After a short period of time, I now have my completed texture, ready for export back to Blender.
So, now we must export the image to a dds file. This is simple - go to “File” then select “Export As” and then assign a name but ensure that the file extension is changed to .dds.
Select a location and then press export, this will open another window with options to select. Below are the settings that are recommended for the export. Once set press export and then we are going back to Blender.
Applying the texture to the model[ | ]
Within Blender, the material will need configuring to use the external texture, this will require some default Blender materials being modified, otherwise the end result in game can be different.
Firstly, we will replace the old blank image we used on the UV unwrap to ensure the whole model has been correctly covered. In the UV editor within Blender, select “Image” and then select “Replace”. The locate and select the dds file exported in the previous section.
As can be seen in the above image, I have overlaid the texturing correctly.
However, this has not applied our overall texture to the model, we can see this if we simply try and render the model in Blender.
So, now we must create materials, and then apply the texture - we will create a single material and apply it to all 4 sections.
We will create the material on the hull section first, and then apply this material to the other 3 sections afterwards.
First, ensure that you are in object mode and then go down to the “Material Properties” section. Then select the “New” button which will generate a new material.
To ensure that our model uses the correct texture, we want to click on the yellow dot to the right of the “Base Color”, and then select image texture.
Then, you will have the option to open an image.
Click the open button, and then navigate to the dds file. I would recommend modifying the material settings to set the “Specular” value to 0, this will prevent the model from getting washed out once it's in game.
Now, when a render is run, the hull will now have the texture on it.
Now, we must apply this material to all of our sections - this is simple, just select each section separately whilst in object mode, and navigate to the material section. Select the “Link to Material” option instead of the “New” button, and then select the material that has been configured (in this case Material.005). Then ensure that the material is duplicated so that the exporter can recognize the different sections of the model. If the material is not duplicated it will show up as a single mesh.
Do this until all 4 sections have the same material, and then run a render and you should get a result with all sections textured.
The final step I would recommend, especially if any circles are involved, is to change the smoothing option - this will affect shadows. This can be modified by clicking “Object” and then “Shade Auto Smooth”. I did not change any settings on the popup.
Now, our model is finally ready for exporting from Blender.
Exporting the model to obj[ | ]
Within Blender, ensure that you are in “Object” mode. Then select just the model that you want to export. Then, go to “File”, then down to “Export” and then select “Wavefront (.obj)”. This will open the export settings window. The settings need configuring as below.
This will then export to the selected location and generate both the .obj, and a .mtl file. These are the files you will need (along with the .dds file) for the conversion process in the next step.
Converting the model to cmo[ | ]
The simple way of converting the model is to create a separate folder where you can place your obj, mtl and image files. This should have the meshconvert.exe located in the same folder (see the start of the tutorial for the download).
As you can see, there is also a batch file within this folder. This does the conversion on any obj files that are placed in the same folder - this can be useful for mass converting models to the correct format.
A batch file can be created in notepad, and simply requires the change of extension from .txt to .bat. Within the batch file this code needs to be used:
meshconvert *.obj -ne -cw -flipv -cmo
Now, having created the batch file, double click on it to run and the cmo file will be generated.
At the end of this, you will have a .cmo file. This file will need renaming to UNITxxx, the xxx should be replaced with the picnums ID, for this tutorial it will be 926 and hence the cmo file name should be UNIT926.
With the model viewer installed (see downloads at the start) we can now open our cmo file and verify it has been created correctly. To open the model, open the viewer first and then press the “o” key to get the open menu. The model should be something like the below.
As can be seen, the model viewer recognizes each sub mesh. If it doesn’t recognize all of these, then the export hasn’t been correct from Blender. Do note, if the model does not have a turret, then it does not need all the sub meshes.
Importing the model into the game[ | ]
The asset manager has not been updated correctly for SR2030’s use, and so this step will be done in a text editor - I will use Visual Studio code but notepad or notepad++ will work just as well.
To add our new model into the game, we need to do 2 things:
- Copy our files to the correct location
- Add the Picnum entry to the game
The correct location for the files is within the steamapps file location. Within the “Supreme Ruler 2030” folder, navigate through “Graphics” and then into the “Meshes” folder. Once here, this is the location where the texture file and the cmo file must be placed. Once here, the picnum file can then be modified, the DEFAULT.PICNUMS file also being located in this folder.
Model viewer controls, “y” to select, “u” and “i” to cycle.
The picnum is generated for the game using a very simple set of code. This is done by opening up and modifying the Default.PICNUMS file. Now for a simple model (with no sub meshes), you can simply use the code below with some modifications - the 926 would require swapping out for your own unit ID. The last word (“Griffin” in this case) should be changed to the name of your unit
926, 0, , , , , , , , , , , , , , , , , , , , 1, 0, 0, 0, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 2, 0, 0, 0, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 926, , , , , , 0.0085, , , 0, 1, Griffin
However, for our model it is slightly more complicated, and so I will generate code that will allow 4 sub meshes and also configure the rot point and the fire point too. You must use the model viewer to see which numbers are which for this config. In the below picture, you can see which numbers are which within the model - these are the numbers we are going to use for the assignment in the picnums file.
You can use the model viewer controls to cycle between then and this will highlight which area is which. Then, we will need to generate our line to put into the picnums file based on this information.
Having used the new asset manager to double check the values, we get:
926, 0, 1, 2, 3, , , , , , , , , , , , , , , , , 1, 1, 1, 1, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 1, , 1, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 2, 2, 20, 14, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 926, , , , , , 0.0085, , , 0, 1, Griffin
Do notice - I have modified a section to have 2, 5, 20, 14. These numbers should be changed depending on the function of the sub mesh.
2 = standard model
20 = turret rotation point (the center around which the turret turns)
14 = shot point (where the gunfire comes from)
Now, open the picnums file in your notepad of choice (I’m using the free Visual Studio code here), and then scroll down and copy that line into the file - don’t forget to save the file before opening the game up to check the model.
Viewing the model in game[ | ]
To view the model in game is very simple - Battlegoat added a very simple tool so you view different Picnums and also adjust the scale so that you can get your picnum to have the correct initial scale.
This tool is activated by selecting a unit and then pressing the “U” key. This will open the popup window as per the below picture:
Now, in the PICNUM box, type the number you put the number you used in the cmo file name, in this case 926.
That is the result - as can be seen the scaling seems to be ok. It is worth checking that the unit goes in the correct direction, and of course the turret works correctly. These can be modified within Blender if necessary by flipping directions or offsetting the model.
Directly adding the new model, to a unit in the unit DB[ | ]
Now we have a model that not only works in game, but also fits nicely. So, how do we get it to be shown up as our desired unit, and not only via the “U” key?
For this step, we need to locate the DEFAULT.unit file - this is located within the games directory, then “Maps” then “Data”.
Open this file (again I will use Visual Studio code).
Find the unit id that you want to modify, then simply replace the fourth entry in that line. In this case I would change the circled “779” for “926” which would then make the city use my new model.
Regional textures[ | ]
Regional textures are simple to create - they just require a slight name change.
For capitalized region codes simply just add the letter to the end of the filename - so for example UNIT926U.dds would create a regional texture for any units of that type used by the USA.
For lowercase region codes, you would need to add a “-” in front of the region code. For example UNIT926-q.dds would create a regional texture for any units of that type used by Iraq.
Tidying the whole project so it doesn’t get wiped on a game update[ | ]
The current setup is great for testing, but does pose issues when the game updates - the DEFAULT.UNIT and DEFAULT.PICNUM that was modified will be replaced by steam after any update.
This section will be completed in future.