Martin Wright's Commentary on making landclass files
I've just dug up some extracts from a document I found on Martin Wright's website. I hope this stuff helps.....
MartinW on CFS3 Terrain SDK
CFS3 Terrain SDK
We are currently slowly working through the public beta of the CFS3 Terrain sdk. My plan is to collect together bits and pieces as we work through it slowly. Hopefully the end result will be new Theatres available for CFS3.
Where there are links below to view text of image files you can either left-click to view them in your browser or right-click and select "Save Target as.." to download them to your computer
Step 1 - Creating Mesh files
Step 2 - Creating the Landclass file
Step 3 - Putting the bare theatre into CFS3
Now, skipping through to his Step 2......
Second step.......Creating Landclass
Landclass (LCF) files are required for theatres to tell CFS3 what type of terrain texture to use at a particular location.
There are 15 landclass types defined in CFS3. You can add your own or create a whole new set for your theatre but as each landclass type requires a full set of multiple seasonal mosaics it would be easiest to stick with the default ones for the moment. If you want to mainly use the default landclasses but add an additional one or two then you should make a copy of Landclasses.xml (found in terrdata.zip in the Terrains folder) rename it to something else and then open and edit it to add additional landclasses using free numbers.
Landclass numbers found in the default landclasses.xml file
| |
1
| Ice/snow
|
6
| Grass
|
8
| Crop and Town
|
10
| Grass, Crop and Scrub
|
15
| Crops
|
17
| Marsh
|
24
| Forest
|
25
| Forest and Fields
|
26
| Coniferous Forest
|
27
| Mixed Forest
|
31
| Large City
|
34
| Medium City
|
47
| Small City
|
51
| Dry wooded scrub
|
56
| Rock
|
Landclass files are created using the TIFF2LCF tool. The Tiff image used is an image of the theatre with each pixel representing a certain area and the colour of that pixel is used to define the landclass to use at that location in the Theatre.
In order to be able to translate a colour to a specific landclass value the tool requires a translation table. This takes the form of a text file where each line contains 4 numbers seperated by commas. The first number is the landclass value. The other 3 are the RGB values that make up the colour.
You can make up your own translation file or you can use the one I have created for my own use. My file is
c2v.txt .Using my selection of landclass colours and applying them to the default theatre landclass file we see :-
[sorry you can't see - my document does not have the image]
I feel that these colours give a fairly good representation. You can of course use any colours you like.
In order to create an LCF file for your theatre you will need to create an image of your theatre similar to the map section above and colour in the various parts with the landclasses you wish to appear there.
There is a technical problem as TIFF2LCF is very fussy about the type of Tiff file you use. It must be a 32 bit Tiff containing ONLY the colours you have defined in your translation file. A further complication is that the only paint program I have found that will create Tiff images that work with this tool is PhotoShop. Tiff files created by PaintShopPro are rejected by the tool. There may be other paint programs that can create the correct sort of Tiff but the only one I can definitely confirm is PhotoShop.
TIFF2LCF parameters in order
| |
InTIFF
| The Tiff image file to use. Must be 32 bit
|
Color2Vulcan
| The text file containing the translation table linking specific RGB values to a landclass number. See c2v.txt
|
TheatreDim
| The width of the theatre in metres
|
Stride
| The width in metres of each single landclass tile. SDK says this must be a power of 2.
|
LandclassesXML
| The name (without path) of the XML file to be used at runtime to find the details of each landclass type. Unless you are going to create your own just use Landclasses.xml
|
OutLCF
| The name of the LCF file to create.
|
eg - TIFF2LCF "myterrain.tif" "c2v.txt" 786650 1024 Landclasses.xml "myterrain.lcf"
This will create the Landclass file MyTerrain.lcf from the supplied parameters.
Note that the TheatreDim divided by the Stride must exactly equal the width of your Tiff image! You may have to resize your tiff after doing the relevant calculations.
TIFF2LCF will stop with an error if it calculates that the Tiff image size is not correct for the TheatreDim and Stride settings. It will also stop with an error if it finds a colour in the image that doesn`t appear in your translation table.
Anyway Odin_br I am very excited that someone is looking at this stuff. I've also got a lot of guides on terrain creation which I've nver had time to digest properly - but happy to share if you PM me.