Author Topic: Banished modding and Blender  (Read 2737 times)

0 Members and 1 Guest are viewing this topic.

Offline kid1293

  • Modders
  • Banished Expert
  • *****
  • Posts: 1517
  • Never confuse movement with progress
Banished modding and Blender
« on: May 20, 2016, 04:51:07 AM »
Hi!

I start this because there are more and more of us that use Blender.
Of course this is not only about 3D-modelling in Blender.
I hope we can have an open discussion about modding Banished.

No one can force another to leave out the code for a mod but it
can be great to learn from each others mistake too -
so models and small pieces of code are welcome and a great way
to start a party. :)

Oops, first I wrote Morrowind but of course I mean Banished!  :-[
« Last Edit: May 20, 2016, 09:33:02 AM by kid1293 »

Offline kid1293

  • Modders
  • Banished Expert
  • *****
  • Posts: 1517
  • Never confuse movement with progress
Banished modding and Blender
« Reply #1 on: May 20, 2016, 05:20:33 AM »
Some have asked about how to name a mesh and what to write in the code

I try to keep naming in a simple way. Something that tells me where I am
if I get an error.

1. The model.   Could have been called 'Mesh' or 'FlowerMesh' if you want.
This is what is addressed in the Models directory as 'BromGreenStripe2bMesh.rsc'

2. I name the material slot the same for that mesh. It keeps me on one
track when writing the code.
This is what goes in to Models/MaterialInstances directory
in the file 'BromGreenStripe2b.rsc'

3. This is sometimes filled in by Blender when importing a file.
I keep the name the same as 4.

4. This is the actual texture which is called from your Material file (2)
I use to name this png-file the same as the other files but in this case
I have several Material slots reading from the same texture-file.

Maybe I should have choosen a better example, who remembers 'BromGreenStripe' ?
« Last Edit: May 20, 2016, 09:31:57 AM by kid1293 »

Offline tanypredator

  • Modders
  • Trader
  • *****
  • Posts: 282
Re: Banished modding and Blender
« Reply #2 on: May 20, 2016, 10:51:54 AM »
This is really necessary topic for a new modders!

"No one can force another to leave out the code for a mod"

I think that if (when) I make a new mods, I'll always upload both mod and the source. Because I want also to use mods and maybe somebody will use the source to make a mod much better than mine :)

Offline kid1293

  • Modders
  • Banished Expert
  • *****
  • Posts: 1517
  • Never confuse movement with progress
Re: Banished modding and Blender
« Reply #3 on: May 20, 2016, 11:04:53 AM »
I second that!

What I don't want is someone to take the code for
let's say a big mod and upload to Steam as their
own. But we all have good/bad moments.

Offline tanypredator

  • Modders
  • Trader
  • *****
  • Posts: 282
Re: Banished modding and Blender
« Reply #4 on: May 20, 2016, 12:42:00 PM »
And I already have a new question! :) I want to make wild oats. I remembered this topic
http://worldofbanished.com/index.php?topic=1112.45
and I tried to make the transparent texture for its head. But I forgot that I would need the custom materials. Can somebody please explain, how to make such materials?

Offline kid1293

  • Modders
  • Banished Expert
  • *****
  • Posts: 1517
  • Never confuse movement with progress
Re: Banished modding and Blender
« Reply #5 on: May 20, 2016, 01:31:04 PM »
Just what I was going to do next!
(You have good timing.)

The next files are in Models/MaterialInstance directory

In almost all material-definition files you have a line like:
   Material _material = "Material\OpaqueSnow\OpaqueSnowMaterial.rsc";

It tells the texture to be NOT transparent with snow in the winter.


If you change it to:
   Material _material = "Material\Opaque\OpaqueMaterial.rsc";

You will a non-transparent texture with no snow.
---
You can change it to:
   Material _material = "Material\AlphaTest\AlphaTestMaterial.rsc";

and change the texture-definition file (whateverTexture.rsc) from:
ImageBuffer resource : "Texture/ModelTexture.rsc"

to:
ImageBuffer resource : "Texture/ModelAlphaTexture.rsc"

edit: copy the file ModelAlphaTexture.rsc
        from Resource/Texture folder to your Texture folder     (Thanks RK!)

and you will have a see-through texture with no snow in the winter.

So you don't need the Custom Material file!
I don't even know if Luke has given any out for the new version.

Does that help?
« Last Edit: May 20, 2016, 04:16:48 PM by kid1293 »

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 6523
Re: Banished modding and Blender
« Reply #6 on: May 20, 2016, 03:46:10 PM »
there is an example you can go look : /example/crop folder.

the texture LettuceLeaf is a transparent texture

the LettuceLeaf.rsc calls a custiom material : Material _material = "Material\CropMaterial.rsc";

and the LettuceLeafTexture.rsc calls an alpha image buffer : ImageBuffer resource : "Texture/ModelAlphaTexture.rsc"

you just need to make a copy of the /Material/ folder with its custom material file inside to your mod.


> > > Support Mods Creation developments with Paypal Donations < < <
Click here to PayPal Donate.

Offline tanypredator

  • Modders
  • Trader
  • *****
  • Posts: 282
Re: Banished modding and Blender
« Reply #7 on: May 20, 2016, 07:53:58 PM »
kid1293, RedKetchup, thank you! I was afraid that it will have something to do with that .srsl files.

But as I can see, is wouldn't look transparent in Blender. And I opened the crop model and there is a camera, centered at some place near the crop. Is it important?

UPD No, opened this model in a large scale and saw that it looks transparent in blender too. I noted that in lettuce model the material has different 'transparency' parameters, but when I applied such parameters to my oats and rendered it, only stem was left  :o And it was made of dots, like if it was semi-transparent.
« Last Edit: May 20, 2016, 08:43:44 PM by tanypredator »

Offline tanypredator

  • Modders
  • Trader
  • *****
  • Posts: 282
Re: Banished modding and Blender
« Reply #8 on: May 20, 2016, 09:12:50 PM »
Here is a problem. When I set 'Alpha' to 0.000, the material becomes completely transparent, both near its name, in preview and when rendered.

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 6523
Re: Banished modding and Blender
« Reply #9 on: May 20, 2016, 09:13:02 PM »
but you need to keep in mind that , if it is you who is making it from a real photo for example and working it with photoshop, you will need to build an alpha channel with photoshop in the .png for the pixels to be transparent and non-transparent, and save it as web .png
« Last Edit: May 20, 2016, 09:14:36 PM by RedKetchup »
> > > Support Mods Creation developments with Paypal Donations < < <
Click here to PayPal Donate.

Offline tanypredator

  • Modders
  • Trader
  • *****
  • Posts: 282
Re: Banished modding and Blender
« Reply #10 on: May 20, 2016, 09:38:59 PM »
I think I've done it - here on printscreen the leaves on preview are placed on a black background, which must mean transparent pixels as far as I understand. But it looks grey when rendered. (don't look at the ugliness of the model - it is just test version :) ).

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 6523
Re: Banished modding and Blender
« Reply #11 on: May 20, 2016, 09:45:18 PM »
yeah in 3dsMax too it doesnt look transparent, but once in a game it will be :)

if you are doing a crop, try to not overload it with too many polygons (even the green branchs can be made from semi-transparent planes)
> > > Support Mods Creation developments with Paypal Donations < < <
Click here to PayPal Donate.

Offline tanypredator

  • Modders
  • Trader
  • *****
  • Posts: 282
Re: Banished modding and Blender
« Reply #12 on: May 20, 2016, 09:56:38 PM »
If I change 'Alpha' of lettuce to 1.000 (default value) in Blender, it obtain the same grey background. I think that this 'Alpha' parameter allows preview of how the model will look in game when using "Texture/ModelAlphaTexture.rsc".

"too many polygons" is how many? Is the polygon the same as face? I mean my oats now have about 16 faces and I'm going to add at least 4 duplicates in one model. So about 80 faces - is it too much?

Lettuce has at least 170 faces :) but they are all mapped at place of 12 (one leaf).
« Last Edit: May 20, 2016, 10:02:16 PM by tanypredator »

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 6523
Re: Banished modding and Blender
« Reply #13 on: May 20, 2016, 10:11:40 PM »
keep in mind that the game will multiply it by hundreds once you will have tons of 15x15 crops !

a 50 poly total at the end would be ok for the whole mesh
> > > Support Mods Creation developments with Paypal Donations < < <
Click here to PayPal Donate.

Offline tanypredator

  • Modders
  • Trader
  • *****
  • Posts: 282
Re: Banished modding and Blender
« Reply #14 on: May 20, 2016, 10:33:29 PM »
Ok, thank you. I'll keep it in mind when I will make grapes (the only crop that I want to add). But this one is going to be wild plant, there are not so many of them (and I'm going to make them vanish in winter).