Schlick's Fresnel approximation. `f0` is reflectance at normal incidence; `cos_theta` is dot(surface_normal, view_dir).
(cos_theta: f32, f0: Vec3)
| 1069 | /// Schlick's Fresnel approximation. `f0` is reflectance at normal |
| 1070 | /// incidence; `cos_theta` is dot(surface_normal, view_dir). |
| 1071 | fn fresnel_schlick(cos_theta: f32, f0: Vec3) -> Vec3 { |
| 1072 | let m = (1.0 - cos_theta).clamp(0.0, 1.0); |
| 1073 | f0 + (Vec3::ONE - f0) * (m * m * m * m * m) |
| 1074 | } |
| 1075 | |
| 1076 | /// GGX (Trowbridge-Reitz) normal distribution. |
| 1077 | fn d_ggx(n_dot_h: f32, alpha: f32) -> f32 { |
no outgoing calls
no test coverage detected