Workers & Resources: Soviet Republic

Workers & Resources: Soviet Republic

28 ratings
Creating maps with satellite imagery
By roy.bos
Learn how to create high-res textures from satellite imagery and import them into the game.
2
   
Award
Favorite
Favorited
Unfavorite
Finding a nice area
Arguably the most difficult part is finding the right area to get a texture from.
  • The area should be 20 by 20 kilometers, in order to get a 1:1 scale.
  • It should be at least ~25 degrees from the pole, as the polar regions have poor data quality.
  • It should not be too mountainous, as it will be hard to get good height maps as well.
  • It should be very rural in order to avoid lots of houses/roads in the texture.
  • As the script will use Bing maps to get the texture, the area should have high quality textures on Bing maps. Look out for seams, where you can see two images were stitched together.
  • Areas with water at different heights are hard to get right in the game, although you could resolve this by editing the height map with a photo editor later on.
Creating the texture
  • The code in this GitHub repo[github.com] can be used to create a high-res satellite image. It downloads tiles from Bing maps and stitches them together.
  • If you're unfamiliar with git, you can click on "code" and download it as a zip. Unzip it in any directory you want.
  • To run the script, you need Python 3. You can download that manually from here[www.python.org], or use a package manager like pip.
  • Open the command line. On Windows, press Start and search for "cmd".
  • Navigate to the directory where you placed the code. For instance,
    cd Downloads\Satellite-Aerial-Image-Retrieval-Master
  • Run the command
    python3 aerialImageRetrieval.py lat1, lon1, lat2, lon2
    where (lat1, lon1) is the latitude and longitude of the upper-left coordinate, and (lat2, lon2) is the latitude and longitude of the lower-right coordinate.
  • The final image will be in the output folder.
Creating the height map
- Unfortunately, I could not find a way to download heightmaps using the same method. But you can download the height map from various sources, such as the Tangram heightmapper[tangrams.github.io]. It provides a reasonable resolution for nearly any place on Earth.
- Look for the place and make sure the entire region is visible.
- If using Tangram, set render multiplier to about 4 and click "render" to generate a stitched image.
Matching the height map and texture
The next bit is a bit tricky. We have a height map and a texture, but they're not aligned yet. We'll need to crop them correctly first.
  • Open an image editor of your choice. I use GIMP.
  • Open the texture image and crop the square area that you want to use.
  • Open the height map as a layer.
  • Next, we need to mirror the image vertically in order to get the correct orientation in the game.
  • Hide the height map layer and export/overwrite the texture image. Save it as a .png.
  • Unhide the height map. Then select the texture layer and resize it to the approximate size of the height map.
  • Now, align both images using the move and scale tools. You can change the opacity of the top layer to see if they are aligned. Once they are aligned, you can hide the texture.
  • If you used the Tangram height mapper, the height map will use 8-bit integer. This is not precise enough. Make sure the precision of the image/layer is set to at least 16 bit integer. Then use the blur tool at a scale of at least 1.5-2 pixels.
  • Save the height map as a png.
floatLeft
Importing it into the game
  • Open the terrain editor
  • Use the in-game tool to import the height map.
  • Save the map. Exit the game (you can leave it running in the background).
  • Open the map folder. This should be located in a folder like
    C:\Program Files (x86)\Steam\steamapps\common\SovietRepublic\media_soviet\save_terraineditor
  • Open script.ini, set $TILESIZE1 to 1.000000 and save. This makes sure that the texture is not repeated.
  • Open material.mtl. The value behind $TEXTURE 5 is the relative path to the texture image, starting from mediasoviet. The default texture is grass, but we want to refer to our own image here. You can place your texture image temporarily in the tiles_normal folder and set $TEXTURE 5 to tiles_normal/yourtexture.png. Save the file.
  • Reload the save. You should see the texture appear now. If the texture doesn't align well, make sure you've lowered the texture depth in the graphics settings.
  • Of course edit the map, or the texture if you feel the colors are off.
Uploading to the workshop
Unfortunately, you cannot include images when uploading a map to the workshop. Therefore, we need to upload our map texture as a building texture.
  • In the game, create a new building texture.
  • Open the newest folder in the mediasoviet\workshop_wip folder, and place your texture image here. Copy the item ID of the folder.
  • In the game, save the workshop item. It should now start uploading the image to the workshop. Subscribe to the item.
  • In the material.mtl file in your map save, set $TEXTURE 5 to
    ../../../workshop/content/784150/[item ID]/yourtexture.png
    Do the same for material_fall and material_winter (optional). This makes sure your texture does not change. Of course, if you have too much time, you could use separate images for each season.
  • If you open the map, you should still see the texture. Upload it to the workshop. Set both items to public, and you're done!
12 Comments
agaboy6000 28 May @ 7:33am 
I had the same issue as previous poster, but resolved it by rereading the guide
Top Tol 20 Dec, 2024 @ 12:13am 
Yeah, my issue was related to texture depth, but in Russian translation it is called "Relief details", and because of this I didn't notice this option. Now everything works correct
Top Tol 19 Dec, 2024 @ 6:41am 
@roy.bos thank you for your guide, but I have an issue. I want to make texture to make roads on landscape and then return to grass. Setting $TILESIZE1 to 1.000000 stretches texture much more than 1:1. Other $TILESIZE1 values works correct - it multiplies texture. Do you have any assumptions why it is so?
Dr.Thrax 1 Aug, 2024 @ 6:29am 
Is there anything more update guide of this or youtube guide explaining this more?
c1MKEvBZ 6 Oct, 2023 @ 6:35pm 
@roy.bos it works for me now. The key apparently was setting the size of texture to 7775x7775px. I'm actually using maps from Open Street Map as a layout for better and realistic map editing.
roy.bos  [author] 6 Oct, 2023 @ 6:18pm 
@KonyPL texture size can be anything. If it's not scaled properly, it's most likely a wrong value in the script.ini, or the texture depth not set to the lowest value. Or there's empty space in the PNG.

@c1MKEvBZ if the terrain is black, the game cannot find or read the file. So check if the path is correct in the material.mtl files, check if the image is a PNG, try \ instead of / if you're not using Winodws, or get rid of other special characters in the name such as empty spaces.
c1MKEvBZ 25 Sep, 2023 @ 12:21am 
Tried this but after the tiles_normal link is done the terrain in the game just becomes totally black.
KonyPL 4 Sep, 2023 @ 2:15pm 
Hi, wahat should the texture size be? I downscaled mine to 2048px and I still see only small portion of it stretched.
roy.bos  [author] 31 May, 2023 @ 8:43am 
Thanks, added it. Wouldn't want anyone to become bald and bankrupt.
florian d. dunadrak 30 May, 2023 @ 11:16pm 
it is important to mention you need to set the texture depth in the settings to other than maximum quality: otherwise the texture wont project correctly and will repeat itself while creating like "transitions" between itself.
i personally had this problem and becasue of a hilly terrain, i didnt even see my texture at all, only in one corner and a very random part of it. (eventhough i had all scripts and files set properly)

lost and pulled a lot of hair because of this. save your hair for later.