PBRT_V2 总结记录 <83> Microfacet::Sample_f

Spectrum Microfacet::Sample_f(const Vector &wo, Vector *wi,
                              float u1, float u2, float *pdf) const {
    distribution->Sample_f(wo, wi, u1, u2, pdf);
    if (!SameHemisphere(wo, *wi)) return Spectrum(0.f);
    return f(wo, *wi);
}


float Microfacet::Pdf(const Vector &wo, const Vector &wi) const {
    if (!SameHemisphere(wo, wi)) return 0.f;
    return distribution->Pdf(wo, wi);
}

作用:

(参考《PBRT_V2 总结记录 Microfacet 和 MicrofacetDistribution》可以看到Microfacet的作用,对于Microfacet.Sample_f  来说,其实简单化了,直接使用D项,那就是直接使用 MicrofacetDistribution 的Sample_f 来进行 ,所以 MicrofacetDistribution 一定要实现 Sample_f 和 Pdf)

BRDFs based on microfacet distribution functions are more difficult to sample. For these
models, the BRDF is a product of three terms, D, G, and F, which is then divided by two
cosine terms; recall Equation (8.8). It is impractical to find the probability distribution
that matches the complete model, so instead we will derive a method for drawing samples
from the distribution described by the microfacet distribution function D alone.
This
is an effective strategy for importance sampling the complete model, since the D term
accounts for most of its variation.
Therefore, all MicrofacetDistribution implementations must implement methods for
sampling from their distribution and computing the value of their PDF, each with the
same signature as the corresponding BxDF function, except that their Sample_f() methods
return void.

virtual void Sample_f(const Vector &wo, Vector *wi, float u1, float u2, float *pdf) const = 0;
virtual float Pdf(const Vector &wo, const Vector &wi) const = 0;

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值