tiramisu/material

Material attributes shared by Tiramisu mesh and primitive nodes.

Material attributes are implemented as a cross-cutting attribute extension, so the same API works for both tiramisu.primitive and tiramisu.mesh.

tiramisu.primitive(
  "cube",
  [
    primitive.box(vec3.Vec3(1.0, 1.0, 1.0)),
    material.color(0xff8844),
    material.metalness(0.7),
    material.roughness(0.25),
  ],
  [],
)

Types

Which sides of geometry faces to render.

pub type Side {
  Front
  Back
  Double
}

Constructors

  • Front

    Render front faces only (default).

  • Back

    Render back faces only.

  • Double

    Render both front and back faces.

Values

pub fn alpha_test(value: Float) -> attribute.Attribute(msg)

Set alpha test threshold.

pub fn ambient_occlusion_map(
  url: String,
) -> attribute.Attribute(msg)

Set the ambient occlusion map texture.

pub fn basic() -> attribute.Attribute(msg)

Use an unlit basic material.

pub fn color(hex hex: Int) -> attribute.Attribute(msg)

Set the base color.

pub fn color_map(url: String) -> attribute.Attribute(msg)

Set the base color texture.

pub fn displacement_bias(bias: Float) -> attribute.Attribute(msg)

Set displacement bias.

pub fn displacement_map(url: String) -> attribute.Attribute(msg)

Set the displacement map texture.

pub fn displacement_scale(
  scale: Float,
) -> attribute.Attribute(msg)

Set displacement scale.

pub fn emissive(hex: Int) -> attribute.Attribute(msg)

Set emissive color.

pub fn emissive_intensity(
  intensity: Float,
) -> attribute.Attribute(msg)

Set emissive intensity.

pub fn ext() -> extension.Extension

Build the internal extension used to apply material attributes.

Most applications should not call this directly; use tiramisu.builtin_extensions() instead.

pub fn lambert() -> attribute.Attribute(msg)

Use a Lambert material.

pub fn metalness(m: Float) -> attribute.Attribute(msg)

Set metalness amount.

pub fn metalness_map(url: String) -> attribute.Attribute(msg)

Set the metalness map texture.

pub fn normal_map(url: String) -> attribute.Attribute(msg)

Set the normal map texture.

pub fn opacity(o: Float) -> attribute.Attribute(msg)

Set opacity.

pub fn phong() -> attribute.Attribute(msg)

Use a Phong material.

pub fn roughness(r: Float) -> attribute.Attribute(msg)

Set roughness amount.

pub fn roughness_map(url: String) -> attribute.Attribute(msg)

Set the roughness map texture.

pub fn shininess(value: Float) -> attribute.Attribute(msg)

Set Phong shininess.

pub fn side(s: Side) -> attribute.Attribute(msg)

Select which side of the geometry should render.

pub fn standard() -> attribute.Attribute(msg)

Use a standard physically based material.extension

pub fn toon() -> attribute.Attribute(msg)

Use a toon material.

pub fn transparent(bool: Bool) -> attribute.Attribute(msg)

Enable or disable material transparency.

pub fn wireframe(bool: Bool) -> attribute.Attribute(msg)

Enable or disable wireframe rendering.

Search Document