This is the technical documentation for Tangram's textures
block. For a conceptual overview of the texturing system, see the [[Materials Overview]].
##textures
The textures
element is an optional top-level element in the [[scene file]]. Textures allow image files to be used in the ambient
, diffuse
, specular
, and normal
parameters of a [[material|materials]]. A texture requires, at the minimum, a url
path and a mapping
mode.
The texture
element has only one kind of sub-element: the texture name.
textures:
pois:
url: demos/images/marker.png
mapping: uv
brick:
url: demos/images/brick.jpg
mapping: uv
Required string. Can be anything except the [[reserved keywords|yaml#reserved keywords]]. No default.
Optional string, one of uv
, planar
, triplanar
, or spheremap
. Default is spheremap
.
The spheremap
mapping can't be used with a normal
map.
material:
diffuse:
texture: ./material/rock.jpg
mapping: uv
Optional number or 2D vector. number
or [x,y]
. Defaults to [1,1]
.
Sets a scaling value for the texture.
material:
diffuse:
texture: ./material/rock.jpg
mapping: uv
scale: 2.0
Optional number or 3D vector. number
or [r,g,b]
. Defaults to 1
.
This value is a multiplier on the effect of the texture – it can be thought of as the texture's opacity.
material:
ambient: .5
diffuse:
texture: ./material/rock.jpg
mapping: uv
scale: 2.0
amount: 0.5
Optional string, one of mipmap
, or nearest
.
Sets the filtering mode for sprites, which determines quality at various zoom levels.
Optional parameter. Defines the start of a sprites
block.
May contain only one kind of parameter: the sprite name.
Required string. Can be anything except the [[reserved keywords|yaml#reserved keywords]].
Defines an area of a texture to be used as an individual sprite, as [x origin, y origin, width, height] in pixels.
pois:
url: demos/images/poi_icons_32.png
filtering: mipmap
sprites:
airport: [0, 0, 32, 32]
restaurant: [0, 777, 32, 32]
cafe: [0, 814, 32, 32]
museum: [0, 518, 32, 32]