Convert a KHR_materials_pbrSpecularGlossiness (diffuse + specular + glossiness) material to the metallic-roughness model. Uses the reference Khronos two-path formula so materials authored in Substance/3ds Max/FBX pipelines (Lumberyard Bistro, many ORCA assets) render correctly on a metal-rough pipeline. High-level idea: assume a 0.04 dielectric reflectance baseline, solve for the metallic factor
(mat: &gltf::Material)
| 1765 | /// foliage + fabric as fully opaque — an alpha-cutout leaf |
| 1766 | /// card is at least the right *shape*. |
| 1767 | fn alpha_cutoff_from_material(mat: &gltf::Material) -> f32 { |
| 1768 | match mat.alpha_mode() { |
| 1769 | gltf::material::AlphaMode::Opaque => 0.0, |
| 1770 | gltf::material::AlphaMode::Mask => mat.alpha_cutoff().unwrap_or(0.5), |
| 1771 | gltf::material::AlphaMode::Blend => 0.5, |
| 1772 | } |
| 1773 | } |
| 1774 | |
| 1775 | /// Fake KHR_materials_transmission as a near-mirror dielectric. |
| 1776 | /// |
no outgoing calls
no test coverage detected