Beginner's Guide to Modding for Banished PART 3 - Texture Mapping / simple fence

Started by scoutae4, November 25, 2023, 02:27:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

scoutae4

PART 3 – TEXTURE MAPPING / Beginner's Guide to Modding for Banished: a simple fence

In this section we will look at two different ways to map textures. Both should work with either model we prepared in PART 2. You can find the free wood texture I used here (download the 512 x 512 png version): https://www.manytextures.com/texture/5/dark-wood/

Now would be a good time to create a folder on your desktop (or wherever you like) to collect the files you will use later on to create your mod. Name the folder "Mod Assets" for now so we are on the same page. Place the wood texture in your folder and rename it, "FenceWood01" without quotes.

A QUICK WORD ABOUT TEXTURES

Image textures have a big impact on file size so whenever possible use the smallest size you can that will still look good in game. From the Blender manual:

QuoteFor the most efficient memory usage, image textures should be square, with dimensions as powers of 2, such as 32×32, 64×64, 128×128, 256×256, 1024×1024, 2048×2048, and 4096×4096.

Banished works with this aspect ratio structure too. 😊 @Jinxiewinxie has some great advice on texture naming structure, etc that is worth a read through when you are ready to create your own mods. https://worldofbanished.com/index.php?topic=2989.0

Open your last saved file from PART 2 and let's get started!

1 – TO JOIN OR NOT TO JOIN / Here is the advice from @kid1293

QuoteNow you have to take a decision. Will you work with each part separately or do you want to make only one mesh? If you have different textures for each part, you can texture them separately and later join all parts. In this case you will have only one texture for the mesh, so we join the parts now.

In OBJECT MODE tap "A" to SELECT ALL, then press "CTRL+J". Rename your model and mesh "TutorialFence" so the ModKit will recognize it once it's ready for export.



2 – MATERIAL PREVIEW / Change your 3D VIEWPORT to display MATERIAL PREVIEW so we can see how our wood texture will look on our fence model when is it applied. Save an iteration.



3 – DISPLAY THE UV EDITOR / Split your screen so we can see the UV Editor: Placing your mouse cursor in an area corner will change the cursor to a cross (+) to indicate that pressing down LMB (Left Mouse Button) will activate splitting or joining. Dragging from an area corner inward will split the area. You define the split direction by dragging either horizontally or vertically. Let's split the screen as below: Drag from the top left towards the center to split the screen in two. Then drag from the bottom left upward to split the left viewport in two.



From the EDITOR TYPE dropdown, select UV EDITOR in the top viewport, and in the bottom one select SHADER EDITOR. Tap "N" to close the SIDEBAR in SHADER EDITOR to make more room. Note: If you need to close a viewport, right click on an empty space in the header of that viewport and select CLOSE from the drop down menu.



4 – ADD YOUR MATERIAL / In your PROPERTIES PANEL select the MATERIAL PROPERTIES tab to activate it ("Start Here").

a) Tap NEW to add a new material;



b) Notice in the bottom left a BSDF and MATERIAL OUTPUT node are generated in the SHADER EDITOR and "noodled" together. In MATERIAL PROPERTIES on the right, click the yellow dot next to BASE COLOR, and select IMAGE TEXTURE;



c) Notice in the SHADER EDITOR an IMAGE TEXTURE node is generated and "noodled" into the BSDF node. Click the OPEN option, and navigate to the MOD ASSETS folder we created earlier to import "FenceWood01.png".



d) Notice the IMAGE TEXTURE node now reflects your assigned texture. Rename your material, "FenceWood01" without quotes so your ModKit will recognize it.



e) In your UV EDITOR on the left, select "FenceWood01" from the drop down menu. Save here if you'd like to try both unwrap options that follow!



5 - SMART UV UNWRAP
In your 3D VIEWPORT on the right, make sure you are in EDIT MODE and tap "A" to Select All. Then tap "U" to open the UV MAPPING options and select SMART UV PROJECT.



In the popup options, change the ISLAND MARGIN to .03 and select OK. The result is a map where each face of the fence is assigned to an area on our wood texture. These areas are called a UV Islands. The .03 we defined in our options controls the space between each island. This allows breathing room so you don't have textures and effects that bleed over onto the face next to it. SMART UV did a pretty decent job - the wood grain is going in the correct direction on both the posts and the railings. Save you progress if you want to skip the next option for now and move on to PART 4.



6 - MANUAL MARK UP
In this option, we will dictate how the UV map unwraps for better control. We will have our wood grain seamlessly wrap around our posts and railings which will look more realistic. It's actually overkill to do this for such a small model since you won't be able to see this detail in the game but I wanted to know how to do so I'm guessing you would too. :) Open your last save iteration and make sure you are in EDIT MODE, with EDGE selected. Click+Select the edges of your posts and railings as they are below (they won't be orange until the next step but they are easier to see this way):



Tap "A" to Select All, then tap "U" to call up the UNWRAP options and select MARK SEAMS.



This looks pretty good. Our pattern flows around the posts in a more organic way. We still need to create the margins between the islands we created. Tap "A" in the UV Editor (your UV should be active in orange) and from the menu navigate to UV > PACK ISLANDS.



In the pop up options change the margin to .03, then select OK.



This creates an island for each post and rail instead of different islands for each face.



Save your model as we are ready for PART 4.


kid1293

The texture does not have to be square! As long as the sides are with the power of 2. (64,128,256...)
You can have a 256x512. No problems.

scoutae4

I'm sure you're right @kid1293 but I couldn't get SMART UV UNWRAP to behave properly with a texture in this aspect ratio! It's worth investigating though since with this tactic you'd be saving A LOT on file size.