News:

Welcome to World of Banished!

Main Menu

Tutorial: Make a Custom Footprint

Started by Jinxiewinxie, February 01, 2019, 10:15:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jinxiewinxie




Customized Footprint Tutorial:


Open your mesh in blender and change your view to be straight down. You'll see the grid lines and the top of your mesh. Align things so that the grid looks nice and straight and you can see how many grid squares you've got. Take a screenshot.

Paste the screenshot into Paint.Net or Gimp or your favorite image editor and crop out the extra space around your mesh so that you have nice straight edges that follow along the original grid's lines:



This image won't have square dimensions and the game likes squares, so you'll need to make it square while maintaining its original view in the center. Easiest way is to make a new image that's got square dimensions and then copy & paste down your cropped screenshot onto it so that your top view stuff is still in the center of it all:



Next, crop out the extra space and grid lines that are near your mesh's outline so that you just have your outline and everything else around it is transparent:



Lastly, recolor your mesh's outline and innards to look like dirt or whatever you like and have it be a little transparent. Blur the edges so it looks more like a game footprint. Tada!



Make sure to resize the image so that it matches whatever you said the size was in your template file (128x128, 256x256, 2048x2048, whatevs). You can have multiple footprints in the same image if you're making F-Key variants, as long as you keep it square and spread them out in regular dimensions (128, 256, whatever). You can change the float values in your template file to specify which section of the image you want to use for the footprint of your variant.

I ended up doing two variants in the same image and its 256x256 in size with each little footprint area being 128x128:



My code for the bit relating to this in my template file looks like this:


//lines 121 through 148 of BanishedKit\MyMods\DemoHouse\Template\DemoHouse.rsc

DecalDescription decal
{
MaterialInstance _materials
[
"Models/MaterialInstance/DemoHouseFootprintMaterial.rsc"
"Models/MaterialInstance/DemoHouseFootprintDamageMaterial.rsc"
]
bool _tiled = false;
float _initialAlpha = 0.5;
float _mapWidth = 256.0;

DecalLocation _decalLocations
[
                //First variant's stuff
{
float _x0 = 0.0;
float _y0 = 0.0;
float _x1 = 128.0;
float _y1 = 128.0;
}
                //Second variant's stuff (only need this if you have a variant, can delete the below section otherwise)
{
float _x0 = 128.0;
float _y0 = 0.0;
float _x1 = 256.0;
float _y1 = 128.0;
}
]
}


You also need to make the files that this bit references, they go in your BanishedKit\MyMods\YourModsName\Models\MaterialInstance folder. You want your footprint image, a FootprintTexture.rsc, a FootprintMaterial.rsc and a FootprintDamageMaterial.rsc that you've edited to fix names and locations to match your actual mod:



Don't be intimidated, these are small files and they're quick & easy to edit =) Here's what the entire innards of each of mine look like:


//This is what's inside BanishedKit\MyMods\DemoHouse\Models\MaterialInstance\DemoHouseFootprintTexture.rsc

ImageBuffer resource : "Texture/DecalTexture.rsc" 
{
String _imageName = "Models\MaterialInstance\DemoHouseFootprint.png";
}



//This is what's inside BanishedKit\MyMods\DemoHouse\Models\MaterialInstance\DemoHouseFootprintMaterial.rsc

MaterialInstance resource
{
Material _material = "Material\TerrainDecal\TerrainDecalMaterial.rsc";
Texture _textures
[
{
String _name = "diffuse";
ImageBuffer _texture = "Models\MaterialInstance\DemoHouseFootprintTexture.rsc";
}
]
}



//This is what's inside BanishedKit\MyMods\DemoHouse\Models\MaterialInstance\DemoHouseFootprintDamageMaterial.rsc

MaterialInstance resource
{
Material _material = "Material\TerrainDecal\TerrainDamageDecalMaterial.rsc";
Texture _textures
[
{
String _name = "diffuse";
ImageBuffer _texture = "Models\MaterialInstance\DemoHouseFootprintTexture.rsc";
}
{
String _name = "damage";
ImageBuffer _texture = "Terrain\TiledDecals\DamageTexture.rsc";
}
]
}


Aaaaand, breathe! Its done! =)

Here's what my two house's footprints look like in game when they're being built:



If you're unhappy with the transparency or the color, you can keep editing your original image and saving over the one you've got in your MaterialInstance folder while the game is running. As you save, the game will update your image changes so you can fiddle with it until it looks how you'd like it =)