#[derive(Debug, Clone, Copy)]
pub struct PbrMaterial {
pub albedo: [f32; 3],
pub roughness: f32,
pub metallic: f32,
pub emissive: [f32; 3],
pub normal_scale: f32,
}
impl PbrMaterial {
pub fn default_regolith() -> Self {
Self {
albedo: [0.106, 0.100, 0.095],
roughness: 0.85,
metallic: 0.02,
emissive: [0.0, 0.0, 0.0],
normal_scale: 1.0,
}
}
pub fn smooth_plains() -> Self {
Self {
albedo: [0.12, 0.115, 0.11],
roughness: 0.6,
metallic: 0.03,
emissive: [0.0, 0.0, 0.0],
normal_scale: 0.8,
}
}
pub fn crater_floor() -> Self {
Self {
albedo: [0.11, 0.105, 0.10],
roughness: 0.65,
metallic: 0.01,
emissive: [0.0, 0.0, 0.0],
normal_scale: 1.2,
}
}
pub fn crater_rim() -> Self {
Self {
albedo: [0.08, 0.075, 0.07],
roughness: 0.90,
metallic: 0.03,
emissive: [0.0, 0.0, 0.0],
normal_scale: 1.5,
}
}
pub fn hollows() -> Self {
Self {
albedo: [0.25, 0.24, 0.23],
roughness: 0.35,
metallic: 0.01,
emissive: [0.0, 0.0, 0.0],
normal_scale: 0.6,
}
}
pub fn polar_ice() -> Self {
Self {
albedo: [0.80, 0.82, 0.85],
roughness: 0.2,
metallic: 0.0,
emissive: [0.0, 0.0, 0.0],
normal_scale: 0.4,
}
}
pub fn thermal_emission(&self, surface_temp_k: f64) -> [f32; 3] {
if surface_temp_k < 400.0 {
return [0.0, 0.0, 0.0];
}
let t = (surface_temp_k / 700.0).min(1.0) as f32;
[t * 0.6, t * 0.15, t * 0.02]
}
}
pub fn albedo() -> f32 {
0.106
}
pub fn roughness() -> f32 {
0.8
}