Vehicle Materials

Vehicle Materials

From BeamNG

Vehicle materials in BeamNG are based upon the Torque3D material system. This page will demonstrate basic examples of materials, as well as what individual properties do.


Material Properties

You may be wondering at this point what each parameter does, and why some are arrays. The following table describes the most used parameters, what they do, and array size.

Name Description
mapTo A string property that defines the material on the mesh that this material block will be mapped to.
diffuseMap The diffuse map(s) of the material. This property has 4 layers
diffuseColor The diffuse color(s) of the material. The string format is "R G B A" (e.x. "1.0 0.5 1.0 0.7") This property has 4 layers
specularMap The specular map(s) of the material. This property has 4 layers
specular The specular color(s) of the material. The string format is "R G B A" (e.x. "1.0 0.5 1.0 0.7") This property has 4 layers
normalMap The normal map(s) of the material. This property has 4 layers
dynamicCubemap A boolean property that defines if the material will use a dynamic cubemap (aka realtime)
cubemap A string property that defines the static cubemap to use (not preferred)
castShadows A string property that determines if this material will cast shadows. Valid values are "1" and "0"
translucent A string property that determines if this material is translucent. Valid values are "1" and "0"
doubleSided A string property that determines if this material will be rendered double sided. Valid values are "1" and "0"
translucentBlendOp A string property that defines the blending operation of the material. Examples are Mul (multiply), Add (additive), Sub (subtractive), among others.

Vehicle Paint Material Example

singleton Material(sunburst)
{
    mapTo = "sunburst";
    diffuseMap[2] = "vehicles/sunburst/sunburst_c.dds";
    specularMap[2] = "vehicles/sunburst/sunburst_s.dds";
    normalMap[2] = "vehicles/sunburst/sunburst_n.dds";
    diffuseMap[1] = "vehicles/sunburst/sunburst_d.dds";
    specularMap[1] = "vehicles/sunburst/sunburst_s.dds";
    normalMap[1] = "vehicles/sunburst/sunburst_n.dds";
    diffuseMap[0] = "vehicles/common/null.dds";
    specularMap[0] = "vehicles/common/null.dds";
    normalMap[0] = "vehicles/sunburst/sunburst_n.dds";
    specular[0] = "0.5 0.5 0.5 0.1";
    specular[1] = "0.5 0.5 0.5 0.1";
    specular[2] = "0.5 0.5 0.5 0.1";
    specularPower[0] = "128";
    pixelSpecular[0] = "1";
    specularPower[1] = "32";
    pixelSpecular[1] = "1";
    specularPower[2] = "128";
    pixelSpecular[2] = "1";
    diffuseColor[0] = "1 1 1 1";
    diffuseColor[1] = "1 1 1 1";
    diffuseColor[2] = "1 1 1 1";
    useAnisotropic[0] = "1";
    useAnisotropic[1] = "1";
    useAnisotropic[2] = "1";
    castShadows = "1";
    translucent = "1";
    translucentBlendOp = "None";
    alphaTest = "0";
    alphaRef = "0";
    dynamicCubemap = true;
    beamngDiffuseColorSlot = 2;
    materialTag0 = "beamng"; materialTag1 = "vehicle";
};

Skin Material Example

singleton Material("sunburst.skin.custom")
{
    mapTo = "sunburst.skin.custom";
	colorPaletteMap[2] = "vehicles/sunburst/sunburst_skin_custom_palette_uv1.dds";
    overlayMap[2] = "vehicles/sunburst/sunburst_skin_custom.dds";
    diffuseMap[2] = "vehicles/sunburst/sunburst_c.dds";
    specularMap[2] = "vehicles/sunburst/sunburst_s.dds";
    normalMap[2] = "vehicles/sunburst/sunburst_n.dds";
    diffuseMap[1] = "vehicles/sunburst/sunburst_d.dds";
    specularMap[1] = "vehicles/sunburst/sunburst_s.dds";
    normalMap[1] = "vehicles/sunburst/sunburst_n.dds";
    diffuseMap[0] = "vehicles/common/null.dds";
    specularMap[0] = "vehicles/common/null.dds";
    normalMap[0] = "vehicles/sunburst/sunburst_n.dds";
    specularPower[0] = "128";
    pixelSpecular[0] = "1";
    specularPower[1] = "32";
    pixelSpecular[1] = "1";
    specularPower[2] = "128";
    pixelSpecular[2] = "1";
    diffuseColor[0] = "1 1 1 1";
    diffuseColor[1] = "1 1 1 1";
    diffuseColor[2] = "1 1 1 1";
    useAnisotropic[0] = "1";
    useAnisotropic[1] = "1";
    useAnisotropic[2] = "1";
    castShadows = "1";
    translucent = "1";
    translucentBlendOp = "None";
    alphaTest = "0";
    alphaRef = "0";
    dynamicCubemap = true;
    instanceDiffuse[2] = true;
    materialTag0 = "beamng"; materialTag1 = "vehicle";
};

Glass Material Example

singleton Material(sunburst_glass)
{
    mapTo = "sunburst_glass";
    reflectivityMap[0] = "vehicles/common/glass_base.dds";
    diffuseMap[0] = "vehicles/sunburst/sunburst_glass_d.dds";
    specularMap[0] = "vehicles/common/null.dds";
    diffuseMap[1] = "vehicles/sunburst/sunburst_glass_da.dds";
    specularMap[1] = "vehicles/sunburst/sunburst_glass_s.dds";
    specularPower[0] = "128";
    pixelSpecular[0] = "1";
    specularPower[1] = "128";
    pixelSpecular[1] = "1";
    diffuseColor[0] = "1 1 1 1";
    diffuseColor[1] = "1 1 1 0.75";
    useAnisotropic[0] = "1";
    useAnisotropic[1] = "1";
    castShadows = "0";
    translucent = "1";
    alphaTest = "1";
    alphaRef = "0";
    dynamicCubemap = true; //cubemap = "BNG_Sky_02_cubemap";
    materialTag0 = "beamng"; materialTag1 = "vehicle";
};

Basic Material Example

singleton Material(basic_matierial)
{
    mapTo = "myBasicMaterial";
    diffuseColor[0] = "1 1 1 1";
};

Basic Material with Normal Map Example

singleton Material(basic_matierial_normalmap)
{
    mapTo = "myBasicMaterial";
    diffuseColor[0] = "1 1 1 1";
    diffuseMap[0] = "mydiffusemap.dds";
    normalMap[0] = "mynormalmap.dds";
};