Material Definitions (c4m)

Material definitions determine looks and behaviour of landscape materials.
Section [Material]
Value Data type Description
Name String (max. 15) Name of material.
Color 3 x 3 integers The three component colors of the material as RGB RGB RGB (each 0-255).
ColorAnimation Integer 0 oder 1. Color animation.
Shape Integer Shape of surface: 0 smooth, 1 smooth on top, 2 semi rough, 3 rough.
Density Integer Density: 50 solid, 25 liquid (other values not allowed).
Friction Integer 0-100. Friction.
MinHeightCount Integer GetMaterialCount only counts material pixels above the specified height.
SplashRate Integer Random value computed like !Random(<value>): In 1 out of <value> cases the material pixel (PXS) will bounce after hitting the ground (ground has higher density than the PXS). Default 10.
DigFree Integer 0 oder 1. Determines wether the material can be dug into.
BlastFree Integer 0 oder 1. Determines whether the material can be blasted away.
Blast2Object definition id Type of objects created by blasting this material.
Dig2Object definition id Type of objects dug out from this material.
Dig2ObjectRatio Integer ca. 100-500. Mass ratio when digging out objects.
Dig2ObjectRequest Integer 0 or 1. If 1, objects are only dug out on request.
Blast2ObjectRatio Integer ca. 100-500. Mass ratio when blasting free objects.
Blast2PXSRatio Integer Mass ratio when material pixels are blasted free.
Instable Integer 0 oder 1. Stability.
MaxAirSpeed Integer ca. 10-100. Maximum falling speed.
MaxSlide Integer Maximum side offset when sliding.
WindDrift Integer Horizontal drift by wind.
Inflammable Integer Inflammability.
Incindiary Integer This material incinerates objects.
Corrode Integer This material corrodes other materials.
Corrosive Integer This material can be corroded.
Extinguisher Integer This material will extinguish burning objects.
Soil Integer Plants grow on this material.
TempConvStrength Integer Strength of temperature conversion.
BlastShiftTo String (max. 15) Material changes into another material when blasted.
InMatConvert String (max. 15) Entering this material the material will change into...
InMatConvertTo String (max. 15) ...this material...
InMatConvertDepth Integer ...when at the given depth.
AboveTempConvert Integer Above this temperature the material will change into...
AboveTempConvertTo String (max. 15) ...this material.
AboveTempConvertDir Integer Direction of temperature conversion: 0 bottom up, 1 top down
BelowTempConvert Integer Below this temperature the material will change into...
BelowTempConvertTo String (max. 15) ...this material.
BelowTempConvertDir Integer Direction of temperature conversion: 0 bottom up, 1 top down
Alpha 6 integers Transparency of the three material colors.
Placement Integer 0-100. This Value is used for lighting of the landscape and is usually determined automatically from the other material values.
TextureOverlay String (max. 15) Standard texture for this material used by the landscape generator.
OverlayType Integer Bit mask for texture calculation on this material. Bit 0 (1): exact (no zoom), bit 1 (2): no texture, bit 2 (4): extra large zoom, bit 3 (8): calculate texture based on gray scale.
PXSGfx String (max. 30 chars) Graphics used for loose material pixels. This graphic should be available as material texture.
PXSGfxRt 4 integers Target rectangle for the graphics of loose material pixels. Additional phases on the right and below the specified rectangle will be used. The rectangle should always start in the top left corner and use the complete texture size.

User defined reaction

In addition to default reactions, every material can define custom reactions which are executed when the material passes another material as a free pixel (e.g. precipitation or particles after explosios) or by material movement (e.g. when a lake floods a tunnel).
In the .c4m-file: Any number of sections [Reaction]
Value Data type Description
Type String Type of reaction that should happen. See Table.
TargetSpec String Target material, with which the loose material reacts. See material specifications.
ScriptFunc String Reaction type script only: Name of the script function, which determines the behaviour.
ExecMask Integer Bitmask, determining in which situation the reaction is to be executed. Bit indices are the reaction events. Default value -1 for all events.
Reverse Boolean Usually, the reaction defines what happens when loose material of the definition, in which the reaction is defined, hits solid material of the type specified in TargetSpec. If Reverse is set, this definition is swapped.
InverseSpec Boolean If true, the reaction will be defined for all other materials (including "Sky"), which do not fulfill the condition in TargetSpec.
CheckSlide Boolean If true, the standard behaviour (Bouncing off the ground and sliding according to MaxSlide) will be executed before the call is done.
Depth Integer Reaction type Convert only: Depth in target material required for conversion.
ConvertMat String Reaction type Convert only: Material, into which the loose material is converted. If sky is specified, the material will vanish.
CorrosionRate Integer Reaction type Corrode only: Chance of corrosion.
Reaction events
Name Value Event
MEE_PXSPos 0 Check before each movement frame of a loose material pixel against its background material
MEE_PXSMove 1 Check against each pixel that a loose material pixel passes during its movemvent
MEE_MassMove 2 During larger material movements (e.g. when a lake is flooded into a tunnel): Check of the moving material against the material over which it's moving
Reaction types
Name Behaviour
Script For each collision, the script function specified in ScriptFunc is called.
Convert The material is converted into another. Comparable to the behaviour of snow in water.
Poof Both the loose and the solid material are removed. Additionally, there's a 1:3 chance of creating a small smoke cloud, and a 1:3 chance that the sound "Pshshsh" is played. Comparable to the behaviour of water in lava.
Corrode The loose material corrodes the target material at the chance CorrosionRate, and vanishes itself if it does so. If corrosion is performed, a small smoke cloud is created at a chance of 1:5, and the sound "Corrode" is played at a chance of 1:20. Comparable with the behaviour of acid on earth.
Insert The loose material is inserted as solid material. Comparable to the behaviour of any material that hits a material of equal or higher density.
Material specifications
Name Materials
Material name If the specification equals the name of an existing material, this material will be used.
All All materials, including "Sky"
Solid All solid materials
SemiSolid All solid and liquid materials
Background All background materials, including "Sky"
Sky The background material.
Incindiary All materials to be incinerated.
Extinguisher All extinguishing materials.
Inflammable All flammable materials.
Corrosive All materials which can be corroded.
Corrode All corrosive materials.

Reaction type 'Script'

This resource-intensive method can be used to define the material behaviour freely. The script function should be defined globally and have the following parameters:
Parameter number(s) Name(s) Data type Description
1,2 iX, iY Integer Position of the loose material. The parameters may be modified in order to move the material pixel.
3,4 iLSPosX, iLSPosY Integer Position in the landscape, on which the material hits.
5,6 iXDir, iYDir Integer Speed (in 1/100px) of the movement of the material. May be modified in order to change the material speed. Not for MassMover.
7 iPxsMat Integer Material number of the loose material. Useful if the same reaction function is used for multiple materials
8 iLsMat Integer Material number of the solid material.
9 iEvent Integer See Reaction events.
The return value of the function should be either 1 for removal or 0 for keeping the loose material.
Sven2, Dezember 2006