Welcome to Black Liquid Software

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

ShockPuppet

Ambient Occlusion (AO)

50 posts in this topic

a think i am wondering is how you can put and load the AO file in your channel 2 while still have the real diffuse in your channel 1 :P

if i understood correctly

Share this post


Link to post
Share on other sites

@Ketchup which do you mean, for the model or for the AO.png? I don't know what you mean by 'real diffuse'... I'm not very good with terminology which is much harder when every darn piece of software uses different words for the same thing just to be different from one another :( 

Share this post


Link to post
Share on other sites

i dont know, you say you use the channel 2 for AO. where this AO came from ? a file ? so how you loaded it and make it as texture chan 2 ?

Share this post


Link to post
Share on other sites

You don't need to assign the AO to the model as a texture, you only need to unwrap your faces on channel 2 to bake your AO, and to then tell the game the layout for the AO. The game will link the two together itself. The game will read channel two in your model, to find out the layout of the faces. It will then read the AO .png, and use this layout to put the shadows in the right place.

I don't have time right now to do it, I gotta go watch a bunch of people take a polar plunge into ice cold waters, but this evening I can lay it out better if you like.

Share this post


Link to post
Share on other sites

alright , thanks you bro

Have a great day !!

Share this post


Link to post
Share on other sites

Hey @Ketchup could you do me a favour... could you tell me the unwrapping options in Max or post a screen shot of different options?

Share this post


Link to post
Share on other sites

all the screenshot i posted since yesterday are the UWV unwrapping.

 

what you need , i name you all the buttons ?

Sans titre.jpg

Sans titre2.jpg

Share this post


Link to post
Share on other sites

Posted (edited)

@Ketchup hmm, I did some digging, and it seems the processes might be a bit different. So I'm going to take a few screenshots that demonstrate the different channels in blender. Don't worry too much about the process, but the output will be the same. Hopefully if you see how the different channels look in blender, you can try to replicate this in 3Dsmax to get the same results. I'm sure you already know most of it, but I think it helps if I go through from the start, plus others might have the same questions.

 

UV Channels and AO.

Picture 1 - Overview of our model and the 1st UV Channel.

In this example I will use a house from the Sherbooke set, the white one (the red one isn't finished). 

1 - This is the 'Object Data' menu

2 - Under the UV section, you'll see we have 1 UV channel. This is the default channel which is made when you make an object, I have re-named it to 'UVChannel_01'. In 3Dsmax, it is 'Mapp Channel :1' in the channel selector menu.

Note about Channel names = In blender, you can name the channels what ever you want. For Banished, the names do not matter, it is the order of channels that matter

3 - To note, the first view panel is in 3D View with 'Edit Mode' and 'Material View' selected and the second view panel is in 'UV/Image Editor' view.

Channels_Pic01.thumb.jpg.c0bed50a917b7e4b3d8cff78f94b4e51.jpg

 

Picture 2 - UVChannel_01 - What a mess!!

This second picture is what my UVChannel_01 looks like when all faces in the model are selected... a mess! This is because I am using materials. Each face is assigned a material, and the UV are unwrapped and scaled to make the look good.

Channels_Pic02.thumb.jpg.1578f3d515bfc0f569ac4c7f96536fa6.jpg

 

Picture 3 - UVChannel_01 - Texture Example of 'UV Reset' and a wooden beam.

So to explain the last picture a bit, let's just choose 1 of these faces. This is a wooden beam. You'll see in the UV/Image Editor view I have loaded up the material, a green beam, so you can see how the UV overlaps. In this case, I used the option 'Unwrap' -> 'Reset' to get this UV layout for this face. In Blender, you have a few options in your unwrap dialog.

Channels_Pic03.thumb.jpg.0582f32a7dc26ec668078011bb7f4b0f.jpg

 

Picture 4 - UVChannel_01 - Texture Example of 'Project from View' and a wall.

This is another example of a different type of blender unwrap, in this case 'Project form View'. You select the face of interest, in this case the wall, and while looking straight on in ortho view you project the UV exactly as you see it. Then, you scale the UV to make the material fit.

Channels_Pic04.thumb.jpg.75b46ee1c9351a9f6a6669e5f665bcf7.jpg

 

So that is an overview of different UV unwrapping I used to texture the model in UVChannel_01. Now we move on to the next channel.

Picture 5 - Making the 2nd UV Channel, UVChannel_02
1 - clicking the '+' under the UV Maps menu will create a new UV channel. In blender, it automatically calls this 'UVMap' or 'UVMap.001' depending on what you already have. I rename it to UVChannel_02. In 3DSMax, you change the channel you are viewing using the 'Channel' menu in the same place (See the image posted by ketchup in the previous post to compare). Change this to 'Map Channel :2'. You will get a warning asking you to either move or abandon. Don't worry! If you 'abandon', it basically will make the new channel start from fresh. If you choose 'move', it copy the UV lay out in the first channel to the second. You can see in blender, you don't get asked, it just automatically copies the UV lay out from the first channel.

Channels_Pic05.thumb.jpg.cc70291c48f48c5806b479332d41a46f.jpg

 

 

Note - You can have up to 99 UV channels in 3dsmax, I don't know how many in blender. Each face can be mapped onto each UV channel in a different way, so each channel can be used for different things such as texturing, lighting, AO etc. In this case, Banished only cares about the 1st and 2nd uv channels for buildings. The first is for the texture, the second is for the AO. ON each channel, the faces can be unwrapped in very different ways, and this is how...

 

Note - When you have more than 1 UV channel, any unwrapping that you do only occurs on the channel you are viewing. So if I am viewing UVChannel_01, any changes I make will not effect UVChannel_02, and vice versa.

 

Picture 6 - UVChannel_02 - The 'Smart UV Project' for Ambient Occlusion.

UVChannel_02 is highlighted in blue, which means this is the channel we are currently viewing. This is the channel that Banished reads to get the AO information. Here is an important note - the AO is not assigned to the model like a texture. Instead, what Banished does is read the 2nd UV channel to find the lay out of the faces, which will represent the layout of your baked AO image. It is basically using the 2nd channel to line up the faces with the image of the AO. This is why AO should be done last, and once it is done, don't change the UV wrap on channel 2! If you do, you'll end up with odd dark patches all over your model! (I'll show an example).

So Blender has an option to 'Smart Project' your UV wrap. First, I selected everything, then marked a seam on every edge which will make sure each face is separate. I then selected the 'Smart UV Project'. I'm not going to go into detail here, but basically this unwrap option means that each face is displayed on its own little island on the map, as you can see in this screenshot.

Channels_Pic06.thumb.jpg.616af27b359f07297de72e6133f2345b.jpg

 

Picutre 7 - UVChannel_02 - After the Bake

So we have smart unwrapped out model, and baked our AO (I wont go into detail of that here, it is for another time. If anyone wants me to write a blender bake tutorial, I'll be happy to oblige).

Blender automatically makes the AO bake a background for our UV map. See how the AO is lined up with the UV map? This is what Banished will look for. If we move into 'Texture' view in our model screen, we can the result of this.

Channels_Pic07.thumb.jpg.d863833dcbd1d7c7b7593576d910588d.jpg

 

Picture 8 - Another view of the AO

Channels_Pic08.thumb.jpg.096230668c9d99f0b1c0e90c25ff1d92.jpg

 

Picture 9 - Oops! I changed up the UV Wrap in UVChannel_02, now we have some funky shading!

Channels_Pic09.thumb.jpg.5d3c1b88d4b8b3be7c6dc944efec112f.jpg

 

 

 

@Ketchup So that is all I can think of to explain the different channels. Export your model with these channels like this, and the AO.png separately. It doesn't have to be 'assigned', Banished will do that... in fact you do that in the 'Models/HouseMesh.rsc' when you tell it what AO to look for. All Banished does is use the UV map in Channel 2 as a guide to where the shading is in the AO.png.

 

 

I hope that helps, or I just told you everything you already know in which case I'm sorry!

Edited by Necora
2 people like this

Share this post


Link to post
Share on other sites

thanks you @Necora :) Thanks you.

gonna check tommorow and see we what i can do in 3dsmax to try to get the same results because when i provide an AO file to banished.... it is no spectacular effect and change as you guys do.

Share this post


Link to post
Share on other sites

:) thank you @Necora,

I was always wondering why sometimes I baked the AO it worked correctly and others it didn't. Now I know why, I didn't realize the importance and the benefits of the other UV channels.

I re-did my Celtic house model with proper AO and the results speak for themselves:

(top is before, bottom is with new AO)

3t3Pz9H.jpg

Share this post


Link to post
Share on other sites

Posted (edited)

... and, I decided to try some of the DS Small Village buildings. I wasn't sure how well they would work as many are multi mesh objects. But it all worked fine, but slow going! but it looks very good.

;) ... Necora, first the toolbar, now this! you have made my life busy re-doing everything. There is so much more to do now.

Edited by Discrepancy
1 person likes this

Share this post


Link to post
Share on other sites

yeah we often end up to redo and redo and redo the same meshes ^^

1 person likes this

Share this post


Link to post
Share on other sites

Posted (edited)

@Necora post that explanation about AO on WoB tutorial section.

 

@Discrepancy there's nearly no snow on the roof of your Celtic hut after you applied AO. @ShockPuppet mentioned he's using AO to manipulate snow appearance but hasn't told us how...

Edited by jesta

Share this post


Link to post
Share on other sites

If there were only 100 hours in a day, @Necora could open his own tutorial school YouTube channel on Banished modding!  Whilst a niche market, the results would be excellent.
:)  

Share this post


Link to post
Share on other sites

@jesta did you see the last few posts on your thread over at WOB about increasing snow cover? For some reason adding a good AO removes snow compared to using just a white square. I couldn't get it back and don't understand why it would, as my whites for the roofs in the AO could not possible be any whiter or brighter than what blender bakes.... but there is a solution to remove the AO from a certain line in the opaque material file that brings the snow back! See how it is explained over there.... I can figure out blender, I cannot figure out how the game is coded to save my life.

Share this post


Link to post
Share on other sites

@Necora: yup, saw it. i was thinking about that error you mentioned that pops up when compiling the road tiles: it said the ALPHA channel was all white, right? Now i may be a total noob, but the alpha channel is not the actual AO image. there might even not be an alpha channel in a freshly baked AO image. what happens when you add an alpha channel manually and then paint on it with white? Does the game maybe use the alpha channel to determine where snow goes?

 

anyways, i'm dropping @ShockPuppeta message because he seems to know how to do it and hasnt replied here.

Share this post


Link to post
Share on other sites

@jesta actually, forget about that for now. I tried messing with the alpha channel but it did nothing. All I could do was remove snow, now add it.

What I was referring to was @Tom Sawyer's suggestion of making your own Matieral/Opaque/OpaqueMaterial.srsl and changing one line in the code. 

Quote

There is a step while rendering the snow texture and so I went into the material files. I changed row 229 in the snow section of the OpaqueMaterial.srsl to "color.xyz = lerp(color.xyz, sno, pc.userPosition.x * input.seasonData.z * color.w);" and voila... Full snow on my little chapel, just a bit darker on the beams and stairs because of AO.

But, I don't really know much about this sort of thing, so your best to read up on the rest of that discussion.

http://worldofbanished.com/index.php?topic=1424.msg30173#new

Judging by the screenshots, it makes all the snow!

Edited by Necora

Share this post


Link to post
Share on other sites

@Necorai did read all of that and tried to understand it even.

Snow should be working with the default OpaqueMaterials. Strangely it doesn't with our current AO maps, so we're either doing something wrong or the game is missing information where to put the snow.@Tom Sawyerhas found a fix for the problem without finding the error or supplying that missing information, so it's not an actual fix but a workaround. My guess is that by removing the "ao.x * ao.x" part from OpaqueMaterials we're telling the game to fall back to a default mechanism for placing snow which might work on the models we've tested so far but might yield bad results with others down the line. I'd rather know where the problem is, learn something and do it the right way than have all modders create custom OpaqueMaterials for their mods and come back here when problems with the workaround arise.

And i stress that there's a chance I am totally wrong about this since my understanding of programming is very basic and I havent looked at the files in the toolkit in any detail...

I have sent a message to @ShockPuppetasking him to drop us a line on how AO influences snow. Hope he takes the time to...

Share this post


Link to post
Share on other sites

@jesta I agree, we are missing something. If you look at vanilla buildings, they also have sparse snow cover, perhaps not as sparse as some of the ones above. But there is something strange going on that even in parts of my AO where the white could not possibly be more white still don't show as strong as an all white square. It would be nice to know!

Share this post


Link to post
Share on other sites

if you have photoshop you click at bottow right : layers and then at very bottom you click add a new layer, a black square will appear, then you click calcs and you control click your calc 0

you take the brush and you paint it with white color.

 

then you save your file for the web PNG24

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now