Landscape Texture Constraints

Introduction

A TileSet is part of the TileBank. There are sevral TileSet in a TileBank. A TileSet is a kind of material (like grass, wood, rock).

This material is divided in small textures (128x128), large textures (256x256) and transition textures (128x128 alpha).

See File Conversion Graph for details on the build process.

 


Small and Large Textures

A tile in the NeL landscape is a bitmap with a size of 128x128. A patch can have 2x2 tiles, 4x4 tiles, 8x8 tiles and 16x16 tiles. But to have bitmaps with a better quality, we can use larges textures (256x256) as 4 tiles.

In the painter plugin, you can choose to paint 128x128 bitmaps or 256x256 bitmaps. The pixel ratio stays the same.

All the textures have two channels: diffuse and additive. We use a bitmap for diffuse and another one for additive.

Transition Textures

Transition textures are used to make smooth Tileset changes. To do this, we have a set of 48 transition textures. With this set, we can make all transition we want with some diversity (two type of transitions are randomly choosen to increase diversity).

Transition textures are bitmaps of 128x128 pixel with a third channel: an alpha channel. This channel is a grayscale bitmap. It is used to make the transition like this:

A tile transition [layer (2)] is used as an alpha layer between the two tiles [layers (1) & (3)] giving a smoothed transition between different tile sets.

Results in this tile being displayed.

Here is the transitions set:

This is the 48 alpha bitmaps you need to build your bank.

Orange pixels are alpha=255 and black pixels are alpha=0.

In fact, you only need to draw 12 alpha bitmaps to fill this bank. The others are computed with a rotation. Here is the 12 alpha bitmaps you really need:

The batchload function of tile_edit.exe load all the alpha transitions in one shot. To use the batchload function, the alpha bitmaps must have a name like wood_alpha00.tga, wood_alpha01.tga. The number of a transition tile is given by its position in the previous set. The first (left, top) is number 00, and so on, first to the right then to the bottom.

Bitmap Check

To avoid bilinear discontinuity using tiles, tile_edit.exe performs some checks to be sure bilinear filtering will work.

Each time you add a bitmap in tile_edit.exe, by drag and drop or with the "add" or "replace" functions, the program checks the tile pixels. The tiles must follow whose rules:

  1. 128x128 bitmaps must have the same top and bottom pixel row.
  2. 128x128 bitmaps must have the same left and right pixel column.
  3. 256x256 bitmaps must have two times the 128x128 pixel row at top and bottom.
  4. 256x256 bitmaps must have two times the 128x128 pixel column at left and right.
  5. Two transitions with the same kind of border must have same pixel border. For example, check the transition 0 right border and transition 1 left border. They have the same type. So, the right pixel column of transition 0 must be the same than the left pixel column of transition 1.

Two transitions with the same kind of border must have same pixel border. For example, check the transition 0 right border and transition 1 left border. They have the same type. So, the right pixel column of transition 0 must be the same than the left pixel column of transition 1.

You can see in the above picture a 128x128 bitmap with its U and V pixel borders and a 256x256 bitmap with the double U and V pixel border.

From Old Wiki

Creating the textures is the trickiest part of creating the tile bank. There are tiling restrictions outlined below that make it more difficult to create the textures. In addition you need to avoid any extremes of light or dark in the tiles so patterns are not obvious when you tile them together.

The tile format MUST be an uncompressed TGA image. Two sizes are 128x128 and 256x256 pixels, you can use either 24 or 32 bit images.

Most importantly the border of an image must be mapped as below, the left and right edges MUST be EXACTLY the same, the top and bottom edges MUST be EXACTLY the same, the entire border ( all four edges ) MUST be the same as EVERY other tile in that TileSet.

If you have a TileSet for autumn forest grass type b then any grass tile in this set must have EXACTLY the same border.

A Border is a band one pixel wide that follows the edge of the ENTIRE image.

The 256x256 tiles MUST have two of each 128x128 border edge side by side as shown in the images below. This enables 256x256 tiles to link with 128x128 tiles seamlessly.

Naming Conventions

TGA tile files should follow this basic naming convention to allow them to work with the batch load functions and possibly help with ASyncTextureLoading? later on.

The name is broken into two parts [NAME][ID].tga :

  • The [NAME] section can be anything you want but if you want to make a set of one texture for batch loading such as transitions the filename would be exactly the same except the [ID] part.
  • The [ID] part of the texture name is a two digit number defining the tiles order id which sets the place the tile will occupy in the tile set this also can be referred to as the tiles priority.

For Example:

  • stone-transition-texture00.tga
  • stone-transition-texture01.tga
  • stone-transition-texture02.tga

Here is an example of the correct order the different transition tiles should be loaded in.

The batch load function of tile_edit.exe loads all the alpha transitions in one shot. and adds the rotation variations automatically. To use the batch load function, the alpha bitmaps must have the naming convention discussed above. The number of a transition tile is given by its position in the previous set. The first is number 00.

Creation in Gimp

Here is one way to create them reasonably quickly using Gimp.

Get an image off the web somewhere or take a photo of what you want to tile yourself.
This needs to have some variation but not have radical differences of dark and light. Ideally this should have a base color that is throughout the image and be 512 X 512 or larger.
Set the selection tool to a fixed size of 128 X 128 and choose part of the image which will become our first 128 tile.
Copy this selection area, create a new 128X128 image and paste the selection to the new image. Take more random 128X128 selections from the original image and create 128X128 images for each. Usually 3 or 4 of these is sufficient.
Now change the selection size to 256 X 256 and create some 256X256 images in the same way. The bigger the original image is the more selections you can probably make. You need 6+ 256X256 images.

At this point you can manually add further variation to each of the images depending on your game requirements.

Once you have all the 128's and 256's in place, you need to fix the borders. Go into your first 128 tile and change the selection tool to be a fixed selection of 128 wide and 1 pixel high. Use this to select the top row of pixels in the image. Copy and paste top row to the bottom row. Do the same with leftmost column of pixels - copy left side to right side. Save the image.
I would test loading the image into the tile editor at this point to make sure the borders are correct. Once you have a good border, wee need to copy this to all the other tiles.
Edit the selection to be 126X126 fixed. Select the middle of the image so that a border of 1 pixel remains around the outside. Invert the selection so that the 1 pixel border is selected. Copy this border and paste it to all the 128 images and resave each (remember no compression on these tga files).
We need to now create a temporary 256 image to get our 256 border. Copy the entire 128 X128 base image into a new 256X256 image. Move it around and recopy so that it is tiled 4 times within the 256 image. Now do the same procedure on the 256 image to get a 1 pixel border around the outside. Copy this border to all the other 256 images and re-save them.

Once you have done this, all the border tiling requirements will be met for the tile editor.