Skip to main content

REFLECTION_ROUGHNESS_CUT

Constant REFLECTION_ROUGHNESS_CUT 

Source
pub const REFLECTION_ROUGHNESS_CUT: f32 = 0.6; // 0.600000024f32
Expand description

Canonical roughness cut for sharp reflections: surfaces rougher than this get no screen-space / ray-traced reflection. One value drives four shaders that must agree for the reflection pipeline to be self-consistent:

  • the SSR resolve gate (ssr.metal)
  • the RT-reflection resolve gate (rt_reflections.slang)
  • the roughness blur ramp (reflection_composite.metal)
  • the forward double-count fade (REFL_RESOLVE_CUT in main.metal)

All four shaders are compiled offline, so each declares the literal itself and a unit test locks every declaration to this value (the engine shaders in reflection_shaders_lock_shared_roughness_cut, main.metal alongside this module). As an MSL constant it folds at compile time: sharing it costs nothing at runtime.