Material maps

IntermediateArtistProgrammer

Material maps calculate how materials are rendered. They can use two kinds of values: color (RGB) values or scalar (single float) values.

You can use material maps for several purposes, including gloss maps, diffuse maps, or blend maps (for combining material layers)

Material maps can fetch values using one of several providers:

  • Vertex stream: a value taken from mesh attributes
  • Binary operator: a combination of any other two providers
  • Float4 / Float: a constant value
  • Color: a hex color value
  • Shader: a value provided by a ComputeColor shader. This lets you use procedural values
  • Texture: a value sampled from a textureTo choose the provider, click Blue arrow button (Replace) and select it from the drop-down menu:

media/material-colors-1.png

Vertex stream

This provider takes a value from an attribute of the mesh of the model you apply the material to.

It has two modes: Color Vertex Stream and Custom Vertex Stream. To switch between them, with Vertex Stream selected as the provider, click Blue arrow button (Replace) and choose the mode you want to use.

Vertex stream mode

Color vertex stream

Takes a color value from the mesh.

PropertyDescription
IndexThe index in the named stream
ChannelThe channel (RGBA) to sample from the stream

Custom vertex stream

Takes a value from the mesh channel you specify.

PropertyDescription
NameSemantic name of the channel to read data from
ChannelThe channel (RGBA) to sample from the stream

Binary operator

Perform a binary operation from two color/scalar value providers. You can nest as many material maps inside binary operators as you need (including further binary operators).

To choose how the operation works, click Blue arrow button (Replace) and select from the drop-down menu. The operations are similar to options when blending layers in Photoshop.

Operation mode

Result = LeftColor <operator> RightColor

media/material-colors-4.png

PropertyDescription
OperatorA binary operator (eg add, multiply, etc)
LeftThe left color/scalar used in the operation
RightThe right color/scalar used in the operation

Float4 / Float

Provided directly as a constant value over the whole material.

In the case of RGB values, you control the RGBA value with the X, Y, Z and W values (Float4).

xyzw

In the case of scalar values, you control the value with a slider (Float).

Blend map slider

Color

A value provided from a color hex value. This is only available for material maps that use RGB values.

media/material-colors-3.png

Shader

A value provided by a ComputeColor shader. This lets you use procedural values.

For an example of a ComputeColor shader, see the Particle materials tutorial.

Texture

Sample the color/scalar from a texture.

For example, the images below demonstrate how the texture changes the way Xenko blends materials.

Blend map diagram

Blend map diagram

media/material-colors-2.png

PropertyDescription
TextureA reference to a texture
ChannelThe channel (R, G, B, A) used to extract the scalar value. Only valid for scalar textures
Texcoord IndexThe texture coordinates (u,v) to use from the mesh with this texture
FilteringThe sampling method (eg Linear, Point, Anisotropic, etc)
Address Mode U / VDefines how (u,v) coordinates are addressedWrap: Tiles (u,v) at integer junctions. For example, if u ranges from 0.0 to 3.0, the texture repeats three times on the U axisMirror: Flips (u,v) at integer junctions. For example, if u ranges from 0.0 to 1.0, the texture is displayed as expected; but from 1.0 to 2.0, the texture is mirroredClamp: Clamps (u,v) to the range (0.0, 1.0)
ScaleA scale applied to (u,v)
OffsetAn offset applied to (u,v)

See also