Material Examples
Here are examples of creating realistic materials with PBR:
// Create a material that looks like gold
const gold = new BABYLON.PBRMaterial("gold", scene);
gold.albedoColor = new BABYLON.Color3(1.0, 0.766, 0.336);
gold.metallic = 1.0; // Fully metallic
gold.roughness = 0.1; // Fairly smooth
gold.environmentIntensity = 0.8; // Strength of reflections
// Create a glass material
const glass = new BABYLON.PBRMaterial("glass", scene);
glass.albedoColor = new BABYLON.Color3(0.85, 0.85, 0.9);
glass.alpha = 0.2; // Mostly transparent
glass.metallic = 0.0; // Not metallic
glass.roughness = 0.0; // Very smooth
glass.environmentIntensity = 0.9; // Strong reflections
glass.indexOfRefraction = 1.5; // Like real glass
glass.subSurface.isRefractionEnabled = true; // Enable refraction