Hierarchy

  • P3dValueCached
    • P3dMaterial

Accessors

  • get alphaClip(): number
  • Alpha clip / "cut off": Material parts with lower than this alpha value will not be rendered.

    Returns number

  • set alphaClip(value): void
  • Parameters

    • value: number

    Returns void

  • get baseColor(): string
  • Color / albedo value

    Color values are hexadecimal strings. Eg. fff or ffffff for white.

    You can however also assign an array of red, green and blue floating point values, i.e. [1.0, 1.0, 1.0]. This will be converted to hex color automatically.

    Returns string

  • set baseColor(value): void
  • Parameters

    Returns void

  • get baseColorAlpha(): number
  • Color alpha

    Returns number

  • set baseColorAlpha(value): void
  • Parameters

    • value: number

    Returns void

  • get baseColorFactor(): number
  • Color factor

    Returns number

  • set baseColorFactor(value): void
  • Parameters

    • value: number

    Returns void

  • get bumpFactor(): number
  • Bump map texture factor

    Returns number

  • set bumpFactor(value): void
  • Parameters

    • value: number

    Returns void

  • get clearCoat(): number
  • Clear coat amount. This is a reflective layer on top of the material

    Returns number

  • set clearCoat(value): void
  • Parameters

    • value: number

    Returns void

  • get clearCoatRoughness(): number
  • Clear coat roughness

    Returns number

  • set clearCoatRoughness(value): void
  • Parameters

    • value: number

    Returns void

  • get doubleSided(): boolean
  • Whether material is rendered on both sides or just on the front side of mesh

    Returns boolean

  • set doubleSided(value): void
  • Parameters

    • value: boolean

    Returns void

  • get flatShading(): boolean
  • Shade each mesh face as flat

    Returns boolean

  • set flatShading(value): void
  • Parameters

    • value: boolean

    Returns void

  • get glowColor(): string
  • Glow / emissive color

    Returns string

  • set glowColor(value): void
  • Parameters

    Returns void

  • get glowFactor(): number
  • Glow / emissive factor

    Returns number

  • set glowFactor(value): void
  • Parameters

    • value: number

    Returns void

  • get highlight(): number
  • Highlight factor

    This is value between -1.0 and 1.0 that can be used to highlight materials by making them darker (negative values) or brighter (positive values).

    Returns number

  • set highlight(value): void
  • Parameters

    • value: number

    Returns void

  • get id(): string
  • Unique string identifier for the object

    Returns string

  • get isVisible(): boolean
  • If false, then material will not be rendered

    Returns boolean

  • set isVisible(value): void
  • Parameters

    • value: boolean

    Returns void

  • get metalness(): number
  • PBR Metalness factor

    Returns number

  • set metalness(value): void
  • Parameters

    • value: number

    Returns void

  • get name(): string
  • Material name

    Returns string

  • get normalFactor(): number
  • Normal map texture factor

    Returns number

  • set normalFactor(value): void
  • Parameters

    • value: number

    Returns void

  • get roughness(): number
  • PRB roughness factor

    Returns number

  • set roughness(value): void
  • Parameters

    • value: number

    Returns void

  • get sheenFactor(): number
  • Sheen factor

    Returns number

  • set sheenFactor(value): void
  • Parameters

    • value: number

    Returns void

Methods

  • Get texture options for a specific texture type or null if texture of that type is not assigned.

    material.getTextureOptions().then('baseColorTexture', (options) => {
    console.log('baseColorTexture is assigned to UV:', options.uv);
    });

    Parameters

    Returns Promise<P3dTextureOptions>

  • Helper function to convert hex string color to RGB value array so it is easier to manipulate

    const rgb = material.hexColorToRGB(material.baseColor);
    console.log(rgb[0], rgb[1], rgb[2]);

    Parameters

    • hex: string

    Returns number[]

  • Set texture options for a specific texture type. If a texture isn't assigned for the selected type nothing happens.

    // Scale texture
    material.setTextureOptions({
    scaleV: 0.5,
    scaleU: 0.5,
    });

    Parameters

    Returns void