World of Banished

MODS Garage => Tips and Help => Topic started by: embx61 on April 08, 2017, 02:17:54 PM

Title: No snow on semi transparant plants
Post by: embx61 on April 08, 2017, 02:17:54 PM
Hi folks

I am in the process of building a smaller wooden Herbalist building by request.

The fbx is all done and with the help of RedKetchup it won't even crash anymore, Thanks again Red :)

I did not make the AO maps yet and use so far the pure white ones,

I get snow everywhere where it should but not on the plants I have included in the mod.
The plants have there own Transparent Texture and are transparent in game, but gather no snow.

If I look at Luke's Herbalist in game the plants there get some snow on them. He uses a OpaqueSnowAlphaTestMaterial.rsc file so I copied that file over to my materials folder (Maybe not even needed to do this) and referenced to that file, but still no snow in the winter.  :(

It most be possible because Luke's Herbalist plants have some snow on them.

What am I missing?
Title: Re: No snow on semi transparant plants
Post by: RedKetchup on April 08, 2017, 02:52:21 PM
doesnt your plants disappear in winters ?
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 08, 2017, 03:03:22 PM
Nope. They are just there.

They are just part of building though, so not act like a crop or herb, just as in Luke's Herbalist building.

If you place Luke's Vanilla Herbalist in the game you see his plants beside the building.
They get some snow in the winter but not disappear (I test with Debug if that makes a difference I do not know)
Title: Re: No snow on semi transparant plants
Post by: RedKetchup on April 08, 2017, 03:14:54 PM
bah personally i get snow with

MaterialInstance resource
{
Material _material = "Material\OpaqueSnow\OpaqueSnowAlphaTestMaterial.rsc";
Texture _textures
[
{
String _name = "diffuse";
ImageBuffer _texture = "Models\MaterialInstance\RK3DFlower4Texture.rsc";
}
{
String _name = "snow";
ImageBuffer _texture = "Terrain\TerrainSnowTexture.rsc";
}
]
Constant _constants
[
]
}


do you have the other lines ?
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 08, 2017, 03:41:46 PM
I did it as your Hollywood Tutorial

So made that customized CropMaterial.

I shall test now with your code.
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 08, 2017, 03:50:10 PM
You did it again Red :)

With your code it works :)

So the custom Cropmaterial from your tutorial is not needed I guess as no reference are now made to it?
Title: Re: No snow on semi transparant plants
Post by: RedKetchup on April 08, 2017, 03:58:32 PM
Quote from: embx61 on April 08, 2017, 03:50:10 PM
You did it again Red :)

With your code it works :)

So the custom Cropmaterial from your tutorial is not needed I guess as no reference are now made to it?

back in time i only knew that custom material was existing...
i never heard back in time of all the 20 other material lol like billboard and ect ^^
Title: Re: No snow on semi transparant plants
Post by: Necora on April 09, 2017, 04:47:29 AM
I'm a bit late and I know Red already answered, but it seems the 'FoliageMaterial' also produces snow on semi-transparent textures, if you want them to move in the wind. This is what I have for the White Pine, Spruce, and Fir trees which are all very snowy in winter.

MaterialInstance resource
{
Material _material = "Material\Foliage\FoliageMaterial.rsc";
Texture _textures
[
{
String _name = "diffuse";
ImageBuffer _texture = "Models\MaterialInstance\FirBranchTexture.rsc";
}
{
String _name = "snow";
ImageBuffer _texture = "Terrain\TerrainSnowTexture.rsc";
}
]
}
Title: Re: No snow on semi transparant plants
Post by: RedKetchup on April 09, 2017, 10:54:22 AM
if you dont set the alpha channel 3 ... it doesnt move with the wind :)
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 09, 2017, 01:08:49 PM
Quoteif you don't set the alpha channel 3 ... it doesn't move with the wind :)

Where and how? In Photoshop or 3s Max?

EDIT: I guess in 3ds Max but how and does it work with flowers technically attached to the building?
Luke's herbs on his Herbalist don't move either I believe, that's why I ask.
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 09, 2017, 01:50:54 PM
@RedKetchup

Red, I read a while ago that we could not see transparency in 3ds Max.

I found a way :)

When you have your material Editor open select a material and assign a Alpha Texture to it or if you have already a material/diffuse texture select the material and open the maps screen

Now add that same texture to the Opacity slot in the maps screen and set to Image Alpha and Mono channel Output to Alpha.

All left to do click in Material Editor the Material Menu to open that menu and go to: Show Materials in Viewport as select on the fly out menu: Shaded Materials with Maps.

Voila instant transparency inside Max :)

If your model is ready for production I would just clear the Opacity texture in the maps screen.

HTH :)
Title: Re: No snow on semi transparant plants
Post by: kid1293 on April 09, 2017, 01:56:51 PM
I guess RK meant 3rd UV channel.
1 UV
2 AO
3 Billboard or foliage

In Blender I just select the parts of the mesh I want to move and unwrap in new UV map.
Then move those UV's with center over 0,0 and they will move in game.
The other parts are kept at 0 size. Then I write the code for foliage material.
It must be in 3rd channel. Make a fake AO channel if there isn't any.

Iguess this wasn't clear. :)
Ask again if I should elaborate.
Ohh. I just assumed you are using Blender. You're not, are you?
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 09, 2017, 02:20:29 PM
Thanks Kid

No I am using 3ds Max.

I shall play with it a bit.

Title: Re: No snow on semi transparant plants
Post by: RedKetchup on April 09, 2017, 02:33:45 PM
Quote from: embx61 on April 09, 2017, 01:50:54 PM
@RedKetchup

Red, I read a while ago that we could not see transparency in 3ds Max.

I found a way :)

When you have your material Editor open select a material and assign a Alpha Texture to it or if you have already a material/diffuse texture select the material and open the maps screen

Now add that same texture to the Opacity slot in the maps screen and set to Image Alpha and Mono channel Output to Alpha.

All left to do click in Material Editor the Material Menu to open that menu and go to: Show Materials in Viewport as select on the fly out menu: Shaded Materials with Maps.

Voila instant transparency inside Max :)

If your model is ready for production I would just clear the Opacity texture in the maps screen.

HTH :)

will it play when you will compile or in game ? because if i need to delete after before export the final .fbx.... i prefer not. i never acted good when was time to put something and delete it after :P
Title: Re: No snow on semi transparant plants
Post by: RedKetchup on April 09, 2017, 02:34:11 PM
and yeah i meant the 3rd UV
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 09, 2017, 02:46:03 PM
I shall test if it compiles and show up properly in game. But I think the game engine nor using opacity maps and maybe the pkm will be bigger because of the added maps?

I shall compile my Herbalist and test to see.

Yeah deleting stuff in maps is can be a pain. I use the Slate Editor instead of Compact and delete ant maps assigned to the Opacity.

Then save and that works.

I just did a test. I saved and then exported to FBX. All went fine.
Then I compiled a new version and that went fine too :)
The PKM is exactly the size as the older one :)

Moved it to my Banished folder overwriting the older one and started Banished. No crash and the building can be placed.
I think the compiler just skips the opacity maps all together :)
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 09, 2017, 03:12:17 PM
I got the plants moving also :)
Thanks Kid and Red :)

I did not know about that 0.0 because I see nothing about that in UV Editor. Is 0.0 the center of that square?
I just lucked out there I guess.

What I did is the following.

I selected all my leaves and branches from the plants (4different plants and with their own textures but it does not seem to care)
Then Add Unwrap UV Modifier and select the channel spinner in channel rollout and move to 2. I get a warning and select Move.
Then click the spinner to 3, same warning and selct move.

I did not selectected a texture but left the blocked one.
I did not unwrap or change anything either and just collapsed the stack.

Saved and exported to FBX.

Added the code from Necora on all 4 plant files and compiled.

Placed the building in game and they sway just a tiny bit.
Probably because they are rather small and it is hard to see, but I see them moving a bit :)

PKM size increased just a little bit but not much.

I learned yet again something, thanks guys :)

One question more:
Can the movement be regulated in some way?
Title: Re: No snow on semi transparant plants
Post by: RedKetchup on April 09, 2017, 03:26:33 PM
bah usually we send it at the very bottom left corner of your chess map. that what is supposed the 0,0
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 09, 2017, 03:35:20 PM
I was lucking out on that one then :)

All my textures maps lower left corners where already touching the lower left corner of the square in the UVW Editor.

Thanks again guys :)

I hope that it will be easier to make foliage in Max with transparency visible in Max Red :)
 
Title: Re: No snow on semi transparant plants
Post by: RedKetchup on April 09, 2017, 04:52:29 PM
yeah i ll go back to do something in 3dsmax... i ll check what you found and see .....
seems complicated though as i read ^^
Title: Re: No snow on semi transparant plants
Post by: Necora on April 09, 2017, 05:14:38 PM
@embx61 the UV map is a 2 dimensional lay out of your faces etc., so the grid acts like a graph with an x and y axis. 0'0 is basically 0 x * 0 y, so the bottom left corner of the grid. Obviously, you can go -x and -y. So once you have unwrapped your plants, in the UV editor move the unwrapped coordinates so that 0'0 is the center. Now, the further a point is away from 0'0, the more it will move in the wind (supposedly). If you then scale or shrink your UV coordinates, you can control the amount of movement. With the Foliage Material this is good because it only controls the movement and the leaves/flowers are ever green. Beware if you are using the billboard material for things that appear in spring and disappear in fall though, because it also controls the amount that these grow each season. So the larger you make them, the more they enlarge, and can often result in rather ugly plants if you do not shrink your faces in the model accordingly. Also, different materials have different amounts of sway it seems, I think the evergreen and normal billboard materials make things sway more than the foliage material, but also do some funky things with faces always facing the camera so don't always look good on certain plants. I've played around with them a bit, but not enough to be sure of the results I just know that evergreen billboard looked pants on an evergreen tree where as foliage material comes out just as I wanted it to. One day with some free time I'll have a good look into them and see what they all actually do. 

If you want to know more, red and I had a rather lengthy exploration into tree making over at the Black Liquid site some time ago.

http://blackliquidsoftware.com/index.php?/topic/1147-moving-with-the-wind/
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 09, 2017, 08:06:06 PM
Thanks Necora

So I can move the selected maps out of the square? -y -x

My guess is that the game sees the different channels in a different way depending on the UV channels.

So Channel 1 Diffuse (That is how textures applied to the mesh are shown in the game
Channel 2 AO Shadow, Ambient Occlusion
Channel 3 movement.

It start to maker sense now, that is why Automatic unwrap for AO most of the times works without screwing your UV channel 1 map.

Each channel is just an separate part in the game engine.

Do I understand this right?
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 09, 2017, 08:58:01 PM
Quoteyeah i ll go back to do something in 3dsmax... i ll check what you found and see .....
seems complicated though as i read ^^

You mean to put the texture in the Opacity part of the maps rollout?

Just select a round circle in you material editor at the top with the material and your alpha texture of your plant in it. I don't know how they call those circles.
Then open the maps rollout almost at the bottom and click the button next to Opacity and browse and add that same texture in there.
It is just the same as adding a texture to diffuse.

set to Alpha Source to Alpha and Mono Channel Output to Alpha.

Then click in the menu Material, it opens up and nearly at the bottom you see Show Material in Viewport as >
If you hoover over that one it opens up a menu to the right. Just click in that menu on Shaded Materials with Maps and that is all.

Title: Re: No snow on semi transparant plants
Post by: Necora on April 10, 2017, 04:59:23 AM
@embx61 that grid, I believe, is more of a visual reference for an empty UV map. Your UV map can be any size you want it to be, and your unwrapped coordinates also can be any size and position you want them to be. I don't think I have yet found a limit (beyond what I actually need). You can see this if you try loading an image into the UV viewer, you will find that the grid becomes the image, and is what ever size the image is, such as 1024*1024, or 1024*64.

(http://blackliquidsoftware.com/uploads/monthly_2017_03/Channels_Pic03.thumb.jpg.0582f32a7dc26ec668078011bb7f4b0f.jpg)

You can then scale your coordinates to many, many times the size of that image to get a repetitive texturing of the same image. When you select all faces, they frankly become a mess. Here is an example of one of my buildings, you can't even see the grid beneath all those coordinates!

(http://blackliquidsoftware.com/uploads/monthly_2017_03/Channels_Pic02.thumb.jpg.1578f3d515bfc0f569ac4c7f96536fa6.jpg)

Attached is a example of a tree. What I did is look down on the tree from the top, select all faces with the leaves, then select blender's 'Project from View' unwrap option. I then move the whole resulting map over the 0'0 point of the grid, and scale it from there. Any thing you don't want to move in the wind, you unwrap them to the same channel 3, but scale them down to nothing. In blender, if you hit 'S' then '0' then 'Return' it will put all of the coordinates into the same place, just 1 dot. Move this to 0'0 (or as close as possible).

Title: Re: No snow on semi transparant plants
Post by: Necora on April 10, 2017, 05:03:53 AM
@embx61 I forgot the last bit, yes, each UV channel is completely independent of the others so you can do what ever you want to channel 2 without impacting channel 1 etc. In 3dsmax, you can have 99 UV channels per face! In blender, it might even be infinite because you can label them what ever you want. Obviously, in Banished we only need 3 as the game only reads 3 - as you said the textures (1), AO (2), and plant specific movement (3).

Also, for banished, it is the order that is important not the name. In 3dsmax, I don't think this matters because I think you can only have channel 1, 2, 3, etc., but in Blender you can rename each channel to what ever you want. So you can call them 'Texture UV', 'AO UV', or 'Plant UV' if you wanted to, but as long as they are in the correct order of 1,2,3 then Banished will read them no matter what they are called.
Title: Re: No snow on semi transparant plants
Post by: embx61 on April 10, 2017, 05:07:39 AM
Thanks a lot Necora

I did not know that you get beyond the borders of the UV map unless you used tiled textures.

I use max but am pretty sure it is possible to use some short cuts.
Google has to be my friend here :)

Very helpful information, thanks  :)