From ab637e3bd5f9b6a0ba5a876f4e41639a237af9e4 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Thu, 9 Aug 2018 14:43:32 -0700 Subject: [PATCH] Fixed bug in GTR and GGX BRDFs. --- src/shading/surface_closure.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shading/surface_closure.rs b/src/shading/surface_closure.rs index a9fa2e1..2a9f228 100644 --- a/src/shading/surface_closure.rs +++ b/src/shading/surface_closure.rs @@ -572,7 +572,7 @@ impl SurfaceClosure for GTRClosure { return (col_f, 0.0); } else { // Calculate D - Distribution - let dist = self.dist(nh, self.roughness); + let dist = self.dist(nh, self.roughness) / na; // Calculate G1 - Geometric microfacet shadowing let g1 = { @@ -833,7 +833,7 @@ impl SurfaceClosure for GGXClosure { return (col_f, 0.0); } else { // Calculate D - Distribution - let dist = Self::ggx_d(nh, self.roughness); + let dist = Self::ggx_d(nh, self.roughness) / na; // Calculate G1 and G2- Geometric microfacet shadowing let g1 = Self::ggx_g(ha, na, self.roughness);