Fix microfacet bug and put dragon into box

This commit is contained in:
hal8174 2024-12-30 21:07:08 +01:00
parent c26285a98e
commit 9195b48079
3 changed files with 36 additions and 14 deletions

View file

@ -30,7 +30,7 @@ pub fn fresnel_real(cos_theta_in: Float, nu1: Float, nu2: Float) -> Float {
impl<R: Rng, D: MicrofacetDistribution + Debug + Sync> Material<R> for Microfacet<D> {
fn eval(&self, w_in: Dir3, w_out: Dir3, _rng: &mut R) -> ray_tracing_core::prelude::Color {
if w_out.y() > 0.0 {
if w_out.y() > 0.0 && w_in.y() > 0.0 {
let w_h = (w_in + w_out).normalize();
let g = self.dist.g1(w_in, w_h) * self.dist.g1(w_out, w_h);