Latest version:
Tramway SDK 0.0.9
Github
Quick links
Home
Get Started

Material


Materials are used to describe the properties of geometry primitive surfaces.

If a material is set to use a texture image, these images will be loaded from the /data/textures/ directory and have the extension .png.

Materials can be defined through code, or they can be defined through a material list file. These files are located in the /data/ directory and have the extenstion .list.

Properties


Texture

Optional texture image.

Type

Determines how the surface is rendered. For the OpenGL backend this determines which shader is used.

Property

Determines what the material is made of. Useful for determining which sound to use when collision happens with object, or which particle effect to spawn.

Filter

Determines how the texture of the material will be interpolated.

Texture type

Allows the material to not use its own texture, instead using a plain color, or allows it to use another material's texture.

Color

If a material has no texture, it will use appear as this color. Otherwise the texture of the material will be tinted with this color.

Specular weight

Floating point value between 0.0 and 1.0. Determines how visible the specular reflections of the material are. Setting this to 0.0 essentially disables specular reflections.

Specular exponent

Floating point value from 1.0 to higher. Determines how wide the specular reflection will be. Higher values means narrower relection.

Specular transparency

Floating point value between 0.0 and 1.0. Determines whether the material absorbs any of the specular reflection. Setting this to 0.0 will make the material absorb the specular reflection just like it does with diffuse and setting this to 1.0 will have the specular reflection be the same color as the light source.

Material types


Most of these material types are accepted by all backends. If using OpenGL backed, you can register new material types and set their shaders.

Texture | MATERIAL_TEXTURE

The material has a texture. It is fully opaque.

Texture Alpha | MATERIAL_TEXTURE_ALPHA

The material has a texture. It is partially opaque. The transparency channel of the texture is used for an alpha test.

Lightmap | MATERIAL_LIGHTMAP

The texture of this material is used as a lightmap.

MSDF | MATERIAL_MSDF

The texture represents a MSDF.

Glyph | MATERIAL_GLYPH

This is the material used for GUI elements.

Water | MATERIAL_WATER

This material will get fancy water effects applied to it, but this only works with the OpenGL backend.

Flat Color | MATERIAL_FLAT_COLOR

The material has no texture associated with it and instead it will use its color parameter.

Material Property properties


Metal | PROPERTY_METAL

Heavy metal objects.

Metal Thin | PROPERTY_METAL_THIN

Light metal objects.

Slime | PROPERTY_SLIME

Exretions of a biological origin.

Tile | PROPERTY_TILE

Tiles, like those found in a bathroom.

Grate | PROPERTY_GRATE

Fences and other metallic objects with lots of holes in them.

Wood | PROPERTY_WOOD

Trees, planks and logs.

Computer | PROPERTY_COMPUTER

Acts like mixture of metal and glass.

Glass | PROPERTY_GLASS

Windows, jars and bottles.

Snow | PROPERTY_SNOW

Snow and other sound absorbent materials, carpets.

Grass | PROPERTY_GRASS

Like the green touchable stuff that grows outside.

Concrete | PROPERTY_CONCRETE

Concrete, rocks and stones.

Flesh | PROPERTY_FLESH

Sort of like a heavier version of slime. Things that are made out of meat.

Filters


Nearest | FILTER_NEAREST

Textures won't use interpolation.

Linear | FILTER_LINEAR

Textures use linear interpolation.