MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / apply_transmission_hack

Function apply_transmission_hack

native/shared/src/models.rs:1790–1804  ·  view source on GitHub ↗

Fake KHR_materials_transmission as a near-mirror dielectric. We don't implement real refractive transmission (no back-buffer refraction pass, no thin-walled/volume distinction), so a transmission=0.9 glass pane loads as a plain diffuse white surface that drowns the 4% Fresnel specular in a bright diffuse term — the classic "painted white window" look. As a stand-in we force heavy transmission ma

(
    transmission: f32,
    base_color: &mut [f32; 4],
    metallic: &mut f32,
    roughness: &mut f32,
)

Source from the content-addressed store, hash-verified

1788/// normal incidence — but it matches how windows *read* in photos
1789/// (reflecting sky/buildings) far better than a flat diffuse surface.
1790fn apply_transmission_hack(
1791 transmission: f32,
1792 base_color: &mut [f32; 4],
1793 metallic: &mut f32,
1794 roughness: &mut f32,
1795) {
1796 if transmission > 0.5 {
1797 *metallic = 1.0;
1798 *roughness = roughness.min(0.05);
1799 base_color[0] *= 0.85;
1800 base_color[1] *= 0.85;
1801 base_color[2] *= 0.85;
1802 base_color[3] = 1.0;
1803 }
1804}
1805
1806/// Reference: Khronos glTF sample specGloss→metallicRoughness
1807/// converter (https://github.com/KhronosGroup/glTF/pull/1355).

Callers 2

load_gltf_with_texturesFunction · 0.85
load_gltf_stagedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected