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.
The name, colors, metallic and roughness values, opacity, culling and z offset
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 });
Reads the base color of a material as a hex string.
The material
The base color as a hex string
Reads how metallic a material is, from 0 to 1.
The material
The metallic value
Reads how rough a material's surface is, from 0 to 1.
The material
The roughness value
Reads the opacity of a material, from 0 to 1.
The material
The opacity
Reads whether a material skips the back of each face when drawing.
The material
True when back faces are culled
Reads the image texture a material uses in place of its base color, if it has one.
The material
The base texture
Changes the base color of a material, the color its surface has under white light, from a hex string.
The material and the hex color
Changes how metallic a material looks, from 0 for paint or plastic to 1 for bare metal.
The material and the metallic value
Changes how rough a material's surface is, from 0 for a mirror finish to 1 for fully matte.
The material and the roughness value
Changes the opacity of a material, from 0 for invisible to 1 for solid; values between make the surface see-through.
The material and the opacity
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.
The material and the culling flag
Gives a material an image texture that replaces its base color across the surface, as
texture.createSimple makes one.
The material and the texture
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 });
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.setMaterialor through the drawing options.