pub fn sample_f(
        &self,
        wo: &Vector3f,
        wi: &mut Vector3f,
        u: &Point2f,
        pdf: &mut Float,
        _sampled_type: &mut u8,
    ) -> Spectrum {
        if wo.z == 0.0 {
            return Spectrum::zero();
        }

        let wh: Vector3f = self.distribution.sample_wh(wo, u);
        let eta = if cos_theta(wo) > 0.0 {
            self.eta_a / self.eta_b
        } else {
            self.eta_b / self.eta_a
        };

        if refract(wo, &wh.into(), eta, wi) {
            *pdf = self.pdf(wo, &wi);
            if let Some(sc) = self.sc_opt {
                sc * self.f(wo, wi)
            } else {
                self.f(wo, wi)
            }
        } else {
            Spectrum::zero()
        }
    }
/// Override sample_f() to use a better importance sampling method than weighted cosine based
/// on the microface distribution
Override sample_f() to use a better importance sampling method than weighted cosine based
on the microface distribution
Override sample_f () to use a better importance sampling method than weighted cosine based on the microface distribution
pub fn sample_f(
        &self,
        wo: &Vector3f,
        wi: &mut Vector3f,
        u: &Point2f,
        pdf: &mut Float,
        _sampled_type: &mut u8,
    ) -> Spectrum {
        if wo.z == 0.0 {
            return Spectrum::zero();
        }
        let wh: Vector3f = self.distribution.sample_wh(wo, u);
        let eta = if cos_theta(wo) > 0.0 {
            self.eta_a / self.eta_b
        } else {
            self.eta_b / self.eta_a
        };
        if refract(wo, &wh.into(), eta, wi) {
            *pdf = self.pdf(wo, &wi);
            if let Some(sc) = self.sc_opt {
                sc * self.f(wo, wi)
            } else {
                self.f(wo, wi)
            }
        } else {
            Spectrum::zero()
        }
    }
pub fn sample_f ( & self , wo : & Vector3f , wi : & mut Vector3f , u : & Point2f , pdf : & mut Float , _sampled_type : & mut u8 , ) -> Spectrum { if wo . z == 0.0 { return Spectrum :: zero ( ) ; } let wh : Vector3f = self . distribution . sample_wh ( wo , u ) ; let eta = if cos_theta ( wo ) > 0.0 { self . eta_a / self . eta_b } else { self . eta_b / self . eta_a } ; if refract ( wo , & wh . into ( ) , eta , wi ) { * pdf = self . pdf ( wo , & wi ) ; if let Some ( sc ) = self . sc_opt { sc * self . f ( wo , wi ) } else { self . f ( wo , wi ) } } else { Spectrum :: zero ( ) } }
Override sample_f() to use a better importance sampling method than weighted cosine based
on the microface distribution
Override sample_f () to use a better importance sampling method than weighted cosine based on the microface distribution
&self
wo
&Vector3f
wi
&mut Vector3f
u
&Point2f
pdf
&mut Float
_sampled_type
&mut u8