Bitbybit Docs
    Preparing search index...

    Class BabylonMaterialPbrMetallicRoughness

    Physically based materials of the metallic-roughness kind, the standard way to describe a real surface: a base color, how metallic it is from 0 for plastic or paint to 1 for bare metal, how rough from 0 for a mirror finish to 1 for matte, an opacity and an optional texture. Create one, then give it to meshes with mesh.setMaterial or through the drawing options.

    Index

    Constructors

    create

    • Creates a metallic-roughness material with the given color, metallic and roughness values, opacity, back-face culling and optional emissive color.

      Metallic 0 looks like paint or plastic and 1 like bare metal; roughness 0 is a mirror finish and 1 is matte. alpha below 1 makes the surface see-through.

      Parameters

      Returns PBRMetallicRoughnessMaterial

      The material

      const brushed = bitbybit.babylon.material.pbrMetallicRoughness.create({ name: "brushed", baseColor: "#c0c0c0", emissiveColor: "#000000", metallic: 1, roughness: 0.4, alpha: 1, backFaceCulling: true, zOffset: 0 });
      bitbybit.babylon.mesh.setMaterial({ babylonMesh: mesh, material: brushed, includeChildren: true });

    get

    • Reads the base color of a material as a hex string.

      Parameters

      Returns string

      The base color as a hex string

    • Reads how metallic a material is, from 0 to 1.

      Parameters

      Returns number

      The metallic value

    • Reads how rough a material's surface is, from 0 to 1.

      Parameters

      Returns number

      The roughness value

    • Reads the opacity of a material, from 0 to 1.

      Parameters

      Returns number

      The opacity

    • Reads whether a material skips the back of each face when drawing.

      Parameters

      Returns boolean

      True when back faces are culled

    • Reads the image texture a material uses in place of its base color, if it has one.

      Parameters

      Returns BaseTexture

      The base texture

    set

    • Changes the base color of a material, the color its surface has under white light, from a hex string.

      Parameters

      Returns void

    • Changes how metallic a material looks, from 0 for paint or plastic to 1 for bare metal.

      Parameters

      • inputs: MetallicDto

        The material and the metallic value

      Returns void

    • Changes how rough a material's surface is, from 0 for a mirror finish to 1 for fully matte.

      Parameters

      Returns void

    • Changes the opacity of a material, from 0 for invisible to 1 for solid; values between make the surface see-through.

      Parameters

      • inputs: AlphaDto

        The material and the opacity

      Returns void

    • Sets whether the back of each face is skipped when drawing; culling is faster, while drawing both sides shows the inside of open or single-sided meshes.

      Parameters

      Returns void

    • Gives a material an image texture that replaces its base color across the surface, as texture.createSimple makes one.

      Parameters

      Returns void

      const texture = bitbybit.babylon.texture.createSimple({ name: "wood", url: "https://example.com/wood.jpg", invertY: false, invertZ: false, wAng: 0, uScale: 1, vScale: 1, uOffset: 0, vOffset: 0, samplingMode: Bit.Inputs.BabylonTexture.samplingModeEnum.trilinear });
      bitbybit.babylon.material.pbrMetallicRoughness.setBaseTexture({ material, baseTexture: texture });