Surface types are used to specify unique material properties for interaction with collision detection and the game code.
Surface Type Declaration
A surface type is defined by a declaration. These are stored in .stp files in the base/surfacetypes directory.
|type <string:surface type>||Surface type name, defaults to the name of the declaration|
Valid Surface Types in ETQW
carpet concrete dirt dusty_road flesh forcefield glass grass gravel ice leaves liquid metal metal_thick moss mud paper pavement pine plastic sand snow stone water water_interior (basically the same as water, but has smaller splash effects so they don't look weird in small areas) wood wood_thick
Surface Type Maps
A surface type map can be compared to a special texture format with each texel pointing at a certain surface type. They can be generated for regular textures using editSheets, or for terrains by using megaGen.
A material by default has only one surface type, defined by the surfaceType global keyword. This can be overridden by using the global keyword surfaceTypeMap and pointing it at a .stm file. Whenever a trace is made from the code to a surface using the stm value, the impact point gets looked up in the surface type map, and the local surface type gets returned.
Terrain Editor Integration
In editWorld, each node of the Surface Tree has a 'surface type' and a 'surface type threshold' property. The type is a string value which should point to a valid surface type declaration. The threshold is used in combination with the distribution mask of the node to determine where this node defines its surface type. The surface type of a node will be written to the surface type map when the grayscale value of the distribution map is greater or equal to the threshold value (in a 0 to 1 range).
For roads, each road template stages has a 'surfaceType', 'surfaceTypeThreshold' and a 'surfaceTypeBlend' key, which define the behaviour of surface type distribution on a per-stage basis.
To generate a .stm file, you have to run megaGen on your Surface Tree template with the -stm commandline parameter. The -notex parameter can be used to skip the actual rendering of the normal terrain texture, as shown here:
megagen -notex -stm <mapname.sft>