Friday, November 30, 2012

Oh what a mess again...

As a Mac user I wasn't aware of the absolutely stupid and unreliable Windows backup feature, so moving on to a new computer I'm back at an ancient Middleforest backup from 2010. Well, I considered starting over anyway... blegh.

Wednesday, November 21, 2012

Making an area 1 - YATT from a dummy for dummies



It's winter now and the toolset fingers are itching again, but after such a long time it's not easy to find a start for something creative. One of the worst things in the Toolset for me is hitting "New Area" and then staring at that plain boring grassy default field, not knowing where to start. So sometimes I need a little help, like a random base that gives me ideas. And this post should be a step-by-step tutorial on how to get such a random base, from a complete dummy for himself as a reminder/diary and for other dummies who hate learning new geeky stuff and best get an idea of something by looking at pictures.
Let's grab the YATT plugin for the NWN2 toolset and get some ideas, huh? 

So, YATT has been around for years and some people have been using it for a while, like nicethugbert with his area prefabs on the vault, or Cipher in his Game of Thrones PW (where I first thought "I want to do that too!"). There are some tutorials out there, and a thread on the old Bioboards that explained the usage very well, but I couldn't find that one anymore. So I'll start a new one here. 

Basically YATT is an import plugin that makes you a nice terrain out of height maps. Height maps, that's some Black&White images that tell you where the terrain is deepest and highest, a hole in the ground is pitch black while a mountain top is white, and in between you have grayscales. You can paint those yourself in Gimp/Photoshop if you want to, but I don't, so we let someone else create our map, and that's an external terrain editor. There are many, but I (like most others) use L3DT Standard edition, last but not least because it's free. If you later want to paint your own maps and have a program add erosion and realism, you might want to check World Machine. But I just need some basic ideas and usually get lost too much if I experiment too much, and after all we don't want to forget the actual area design, so I'll leave that out. 

I've been playing around with YATT a bit since then, but never got any satisfying results because back then I never learned how to get textures into it properly. So I ended up with a nice random terrain, but it was all grass and I couldn't be bothered to paint textures on it. Because that's another tedious job. I like texturing, as I like painting, and I have a tablet and learned graphics design and all that, but still... getting the texture base done before going into detail is tedious and no fun for me. And last but not least, as good as you might be, YATT seems to achieve much more natural and realistic texturing if used right.

Now to the step by step guide, and mind you it's very basic and I just learned this myself, there might be better ways and tips and tricks I don't know of. If you know them, by all means let me know! 

Getting started. We need:

- YATT of course. Bookmark the page, you WILL need those numbers you see there.
- L3DT Standard Ed. (I'm using the latest Developer build, but it probably doesn't matter)

You also should very soon decide on how big your area should be. For landscapes like the ones we create here large areas make sense, and don't worry, I have never had much problems with large areas in NWN2. I'll just go with 28x28 in this tutorial, because I was thinking of a large snowy area to get lost in. If you want to build huge cities with many placeables, you might not want to go that far, or if you're really spamming grass like crazy like I often did. :D

Install both - I hope you remember how to install toolset plugins? If not, there's a guide on the YATT page, don't forget to enable 3rd party plugins in the toolset options. L3DT is a simple installer. 

So, we start with L3DT once it's installed. Run it and you'll see a boring grey screen and not much else. What we want is to create a new project under File. Select it and we'll get the wizard.
 

We'll just follow along going with the recommended options for now until we get to the screen below:


This is the step where you can play with settings. To get new ideas, you'll always want to get back here and change stuff just to see how it turns out. Play with those default climates and change parameters for fun until you get either a nice surprise area during the following steps or you get a feeling of what parameters suit you best. Don't worry about the textures, if you make an Arctic region and then think "doh, that terrain would suit a rainforest much better!", no problem, we can change all textures later. Anyway, we adjust a little and then hit next.


In the above screen you see what we need and what not. Just go with me here.


Same here, I have actually no idea what this is all good for, let's just move on and hit okay.


Now you can watch L3DT do it's thing for a minute or ten depending on your CPU. Get some coffee, have a smoke until....


.... you get that above pic. Hooray, a nice minimap picture! But to really get a feel for it, Hit that small 3-D button above for a 3D preview. Hint: Move around using WASD, E and Q to change altitude for a better look, and when you're done hit ESC to go back to the former map view.


Satisfied? If not, just try another one with other settings. Play around, this is the point where we hope to get some new inspiration. If you're finally done, we need those numbers from the YATT site and enter the tedious geeky stuff we don't like (do you?). Look at the pic below, remember we settled for an area size of 28x28 in this examples. Can you tell me what pixel size the height map has to be? And the texturemap?
Right, you knew that the height map for an area of 28x28 should be 265x265 pixels! Because the YATT site told you. Well done! While we're here, also write down that texturemap size below, which is.. yes? Hmm? 1408, good!
So, now we switch back to L3DT and look at all those small buttons above our image indicating what we currently look at. We want to look at the height map, so click that button.


We want to export this map now, a right-click on the map is all we need to get there. Now, let's get serious for a moment, this step is crucial: File format must be changed to .bmp and you have to check resize for export and change the numbers to 265. Save the file in a place where you can easily find it later, give it a name that makes sense (e.g. arctic01_height.bmp or whatever).
If you only care for a base terrain, that's it. But we also want the basic texturing done for us. So, we switch back to the texture map and right click on it, and this time we choose Operations -> Alpha Maps -> Generate maps. We get the following screen which already gives you an idea of what alpha map is responsible for what texture, and you might want to take a note on what NWN2 texture to use for it later, but that's all optional. You can simply hit Next.


Now we get the next geek screen, just hit okay.


We end up with 4 new alpha maps in our main L3DT window. Time to export each one of them again just like we did with the heightfield earlier, BUT with a different size. Remember? Right, we save as .bmp resized to 1408x1408, well done! Save each one in the same place as the heightmap earlier, you can rename or not whatever suits you best.


Now, let's look at what we have. I saved my L3DT project in the same folder too, so there's a bit more inside than just the exports. I marked the files we need, make sure to select the .bmp files, not the .png with the same icon. And with that, we're done in L3DT.



Okay, let's start the NWN2 toolset. I prefer doing my YATT experiments in a plain empty module/directory that is only for YATT and nothing else. Better import a good area into my main module later than being sorry after hitting a wrong button and overwriting an existing area or whatever...
Anyway, start YATT from your plugins menu and go directly to File -> Define Input Images. We're looking at the following image. I'm sorry for it being partly German, but you'll figure it out easily. I marked the two image lists we need with a red dot, start with the height map and click that small file button on the right:


In the next window, we need to add our heightmap we created before. Hit that Add button (in the image below "Hinzufügen"...


...and then on the right side open the heightmap image we saved earlier. And now another crucial step: We need to adjust the maximum height! This is also a subject of experimentation, but a general rule of thumbs I read in other tutorials is that 85 works fine in most cases, at least for a first test. If your area is looking too flat later, you know where to change settings.




Now when that's done and you hit okay, it's time for the texture maps. This works pretty much like before, just that we add 4 images to the list instead of just one. Our Alpha 1-4 maps.
The other main and crucial difference is that as you can see in the pic, there's a point "texture" and the standard NWN2 dirt texture is assigned to it by default. This is where we define our textures, and you have to make absolutely sure that each Alpha map has a different texture assigned to it. Don't worry too much about it being the perfect texture now, just see that you don't assign the same texture twice.


In the end, your window should look similar to this, a list of 4 .bmp files, each with a different texture. Close.


Finally, back in the main window, we should change the Texture Overflow Action to Merge. Simply because the default "Prefer Last" option has buggy results.


When all that is done, it's time to hit okay and then... woot!... go to "Area" and hit "Build Area from image(s)". Oh, Stop! First make sure there is NO area opened in the toolset already, or it'll fail. Okay, that said, go ahead.

Now we watch YATT work for a moment. It will create a new area called New_Area_1 or something. When it's done and nothing happens anymore in the YATT window, close it and open your new area. *drumroll*


Oi! Now what is that? Nice terrain but silly Casa got the textures all wrong! Oh well, let's start o... NO! Don't fret!


Because Obsidian is so awesome, we got the texture swapper in the toolset! In your Terrain palette, Textures, remember? This will make it all good!


In case you don't know how it works, just hover your mouse over a tile and you see the textures assigned to it in the textures palette (see above pic). If you swap a texture now, it'll be replaced in the whole area. So let's open the texture swapper.


Now swap textures as you like and see what happens. Just be careful with one thing: Never swap two different textures for the same one, or you lose a texture layer. Make sure you always have 4 textures.
After a bit of swapping I guess I ended up with a result I can live with. Nothing great, but it'll do for the test.


Now we can place the start thingy, bake it and run.


Well, not so bad for a start. Look at how nice the minimap looks! I bet it'd look ten times better once I replace the stupid default daynight cycle. Oh, have I ever mentioned that you should NEVER use the default daynight settings? It looks crappy! If you want to create a nice atmosphere, spend an afternoon with making a new default. I know it's tedious, but... hell, the original campaign would actually look not THAT bad if they just had a better daynight setting... while you're there, also always make sure you tint your water... ack! Okay, before I start ranting too much, that's it for now. Maybe I helped someone, maybe not. I'm just glad I finally figured this out and I'd also appreciate any additional tips from the Pros to optimize this workflow. Casa out.