tile_bank - ryzom/ryzomcore GitHub Wiki


title: What are tile banks and tile sets description: Structure and usage of NeL tile banks, including tilesets, transitions, displacement maps, vegetation, and bitmap validation rules published: true date: 2023-03-16T23:02:08.016Z tags: editor: markdown dateCreated: 2022-03-13T03:24:17.583Z

A NeL tile bank is a binary file (.bank extension, identified by the BANK magic header) that stores bitmap filenames used to texture the landscape. It is managed with the tile editor tool (tile_edit.exe) and loaded at runtime by CTileBank::serial().

Here is an overview of the tile bank:

Tile bank structure: a tile bank contains multiple tilesets, each tileset contains 128x128 and 256x256 bitmaps with diffuse and additive channels, plus 48 transition bitmaps with diffuse, additive, and alpha channels

Lands

A tile bank can define multiple lands. A land (CTileLand) is a named grouping of tilesets that can be used together on a landscape zone. Each land references tilesets by name, and when painting terrain, the available tilesets are determined by the land assigned to that zone.

Tileset

A tile bank is composed of several tilesets. A tileset (CTileSet) represents a kind of surface material (like grass, wood, rock).

Each tileset contains:

  • Small textures (128x128) — standard tiles
  • Large textures (256x256) — higher quality tiles covering 2x2 standard tile area
  • Transition textures (128x128 with alpha) — 48 tiles for smooth transitions between materials
  • Displacement maps — 16 noise maps for geometric micro-detail
  • Vegetation descriptor — optional vegetation spawning rules for landscape vegetation
  • Surface data — a 32-bit user value for gameplay (e.g. footstep sounds, movement speed)
  • Oriented flag — whether tiles have a special fixed orientation
  • Child tilesets — references to other tilesets that can transition with this one

Small and large textures

A tile in the NeL landscape is a bitmap with a size of 128x128 pixels. A patch can have 2x2, 4x4, 8x8 or 16x16 tiles. To achieve higher texture quality, large textures (256x256) can be used which cover 4 tiles (2x2).

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

All textures have two channels, each stored as a separate bitmap file: diffuse and additive. The additive channel is blended on top of the diffuse to add detail or lighting effects.

The tile editor (tile_edit.exe) only accepts uncompressed .tga files. At build time, tile textures can be converted to .dds format using CTileBank::makeAllExtensionDDS() for faster runtime loading. This conversion applies to diffuse and additive channels (not alpha). {.is-info}

Transition textures

Transition textures are used to make smooth tileset changes. To do this, each tileset has a set of 48 transition textures. With this set, all possible transitions can be handled with some diversity (two types of transitions are randomly chosen to increase variety).

Transition textures are 128x128 pixel bitmaps with a third channel: an alpha channel. This alpha channel is a grayscale bitmap used to blend between two materials:

Transition tile blending: (1) grass diffuse tile, (2) alpha mask gradient, (3) dirt diffuse tile beneath, (4) final blended result showing grass-to-dirt transition, (5) the alpha map shown separately

Here is the complete transition set:

All 48 transition alpha bitmaps arranged in a 6x8 grid; orange is alpha 255 (foreground material) and black is alpha 0 (background material)

These are the 48 alpha bitmaps needed to build a complete transition set.

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

In practice, you only need to draw 12 unique alpha bitmaps. The remaining 36 are computed by rotation:

The 12 unique alpha bitmaps needed, arranged in a 3x4 grid; the remaining 36 are generated by 90°, 180°, and 270° rotations

The batch load function in the tile editor loads all alpha transitions in one operation. To use batch load, the alpha bitmaps must follow a naming convention like wood_alpha00.tga, wood_alpha01.tga, etc. The number of a transition tile is given by its position in the 48-tile grid above — tile 00 is at the top-left, numbering proceeds left-to-right then top-to-bottom.

Displacement maps

Each tileset references 16 displacement maps (also called noise maps or tile noise). These are 32x32 pixel grayscale bitmaps that define micro-height variation on the landscape surface. The pixel values are remapped from 0-255 to signed -127 to +127 range at load time.

Displacement maps are shared across the tile bank — multiple tilesets can reference the same displacement map. The first entry (index 0) is always empty (flat).

Tile groups

Each tile can be assigned to one or more of 12 groups (stored as a 12-bit flag field). Groups allow the tile painter to filter and organize tiles within a tileset.

Vegetation

Each tileset can optionally reference a vegetation descriptor file (.vegetdesc, loaded as CTileVegetableDesc). This descriptor defines which vegetation shapes (grass, bushes, etc.) should be procedurally spawned on tiles of this material, organized by 5 distance categories. The vegetation file path is stored per tileset, and the actual descriptors are loaded separately via CTileBank::loadTileVegetableDescs() and registered with the CVegetableManager.

See Vegetation Sets for more details on creating vegetation data.

Bitmap check

To avoid bilinear filtering discontinuities between adjacent tiles, the tile editor performs pixel-level validation checks when bitmaps are added.

Each time you add a bitmap — by drag and drop or with the "add" or "replace" functions — the program checks the tile's edge pixels. The tiles must follow these rules:

  • 128x128 bitmaps must have the same top and bottom pixel row.
  • 128x128 bitmaps must have the same left and right pixel column.
  • 256x256 bitmaps must have the same border rules, but with the doubled pixel rows/columns matching the 128x128 borders.
  • Two transitions with the same kind of border must have matching pixel borders. For example, transition 0's right border and transition 1's left border share the same edge type. So the right pixel column of transition 0 must be identical to the left pixel column of transition 1.

128x128 and 256x256 bitmap UV border rules: the 128x128 tile shows its U border (top=bottom) and V border (left=right); the 256x256 tile shows the doubled U and V borders that must match the 128x128 borders

The above picture shows a 128x128 bitmap with its U and V pixel borders and a 256x256 bitmap with the corresponding doubled U and V pixel borders.

Runtime usage

At runtime, the tile bank is loaded with CTileBank::serial() and cross-references are built with computeXRef() to allow fast lookup from any tile index back to its tileset, position within the tileset, and tile type (128x128, 256x256, or transition).

The cleanUnusedData() method strips land data and border validation data that are only needed by the editor, reducing memory usage for the game client.

⚠️ **GitHub.com Fallback** ⚠️