StandardMaterial : Represents a basic material with properties for diffuse color, specular color, emissive color, opacity, and more.
PBRMaterial : Physically Based Rendering material that provides a more realistic representation of materials under varying lighting conditions. It includes properties for metallic, roughness, ambient occlusion, and more.
ShaderMaterial : Allows developers to define custom shaders to achieve unique visual effects. Shader materials are highly customizable and can implement advanced rendering techniques.
Example of Applying a Material :
// Create a StandardMaterial
var material = new BABYLON.StandardMaterial("myMaterial", scene);
material.diffuseColor = new BABYLON.Color3(1, 0, 0); // Set diffuse color to red
// Apply the material to a mesh
var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", { diameter: 2 }, scene);
sphere.material = material;?
In this example, a
StandardMaterial
is created and applied to a sphere mesh. The
diffuseColor
property of the material is set to red, determining how the sphere will appear when rendered.