Creating a Terrain Palette

From C4 Engine Wiki

Jump to: navigation, search

A terrain palette is a set of textures that can be used to paint voxel-based terrain geometry. A terrain palette texture resource is a special kind of .tex file that contains references to several other texture maps. The terrain palette is a very small file because the texture image data remains in the referenced resources. A different terrain palette would typically be created for each world, or possibly for each terrain block in a large world containing multiple terrain blocks. The entries in a terrain palette are just ordinary 2D texture maps that have already been imported using the texture tool.

Creating a Terrain Palette Texture Resource

A terrain palette is created using the texpal console command. It has the following usage:

texpal -o <output-name> <input-name-1> <input-name-2> ...

The output-name is the name of the output terrain palette file (without extension) relative to the Data directory. This name does include the top-level directory name in its path.

Each of the input-name identifiers must name an existing texture map resource using the standard resource naming conventions, meaning that the top-level directory name under the Data folder is not included in the path. Any number of input texture maps can be specified, but palettes are optimal on older hardware when 9, 18, or 36 texture maps are included, with 9 texture maps always being the best choice.

It is usually convenient to store the entire command line in a .cfg file, place it somewhere in the Import folder, and execute it using the import console command. An example .cfg file can be found at the location Import/Tutorial/world/Terrain.cfg. This file would be executed by typing import Tutorial/world/Terrain in the command console.

You would create separate palettes using the texpal command for diffuse and normal textures, keeping the order the same.

A user interface dialog for making terrain palettes will be provided in version 2.2.

Input Texture Map Requirements

The texture maps to be included in a terrain palette must satisfy the following requirements:

  • All textures in the palette have the same dimensions.
  • The width and height of the palette entries are at least 32 pixels.
  • The texture size is square (i.e., the width and height are the same).
  • All textures are compressed with S3TC.
  • All textures have the same alpha channel usage.

Example

The Import/Tutorial/world/Terrain.cfg file contains the following command line:

texpal -o Tutorial/world/Terrain terrain/Grass1 terrain/Dirt1 terrain/Cinder1 terrain/Sticks1
	terrain/Rock1 terrain/Rock2 terrain/Rock3 terrain/Rock4 terrain/Rock5

The name after the -o switch tells the importer that the output .tex file is Data/Tutorial/world/Terrain.tex.

The nine names following this are the names of the individual texture maps that are to become part of the terrain palette. They name files in the Data directory, but they do not include the top-level directory names beneath the Data directory, and they do not include extensions. (The particular texture maps named in this example are stored in the The31st.pak pack file.)

See Also

Personal tools