Skip to content

Latest commit

 

History

History
113 lines (85 loc) · 2.65 KB

materials.md

File metadata and controls

113 lines (85 loc) · 2.65 KB

This is the technical documentation for Tangram’s materials. For a conceptual overview of the material system, see the [[Materials Overview]].

material

Optional parameter. Begins a material block under a named [[style|styles]].

styles:
    water:
        extends: polygons
        animated: true
        material:
            ambient: .7
            diffuse: [0,0,1]
            specular: white

material properties

diffuse

Optional parameter. number, [R, G, B], hex-color, css color name, or texture. Numerical values go from 0 to 1. Defaults to the geometry's color value.

styles:
    red-wall:
        extends: polygons
        material:
            diffuse: red 

ambient

Optional parameter. number, [R, G, B], hex-color, css color name, or texture. Numerical values go from 0 to 1. Defaults to the diffuse value.

styles:
    surface:
        extends: polygons
        material:
            ambient: .7

specular

Optional parameter. number, [R, G, B], hex-color, css color name, or texture. Numerical values go from 0 to 1. Defaults to [1.0, 1.0, 1.0].

styles:
    water:
        extends: polygons
        material:
            ambient: .7
            diffuse: [0,0,1]
            specular: white
            shininess: 2.0

shininess

Optional number. Defaults to 0.2.

styles:
    water:
        extends: polygons
        material:
            ambient: .7
            diffuse: [0,0,1]
            specular: white
            shininess: 2.0

normal

Optional parameter. Begins a normal texture block. Requires texture and mapping parameters. All the mapping parameters may be applied to this object except mapping: spheremap. No default.

material:
    ambient: .7
    normal:
        texture: materials/bricks.png
        mapping: uv

Textures

ambient, diffuse and specular properties can be defined with a texture map instead of a color. A texture requires, at the minimum, a url path and a mapping mode.

texture

Optional string, defining a path "complete/texture/url.png" or named [[texture|textures]]. No default.

If a texture is identified by path, a mapping mode must be specified.

diffuse:
    texture: ./material/sky.jpg
    mapping: spheremap

If a texture is referenced by name, the mapping parameter must be defined in the associated named [[texture|textures]] block.

textures:
    sky:
        texture: ./material/sky.jpg
        mapping: spheremap

diffuse:
    texture: sky

See also: [[texture parameters|textures#texture-parameters]].