PBRT_V2 总结记录 <35> FresnelBlend

FresnelBlend 类

class FresnelBlend : public BxDF {
public:
    // FresnelBlend Public Methods
    FresnelBlend(const Spectrum &Rd,
                 const Spectrum &Rs,
                 MicrofacetDistribution *dist);
    Spectrum f(const Vector &wo, const Vector &wi) const;
    Spectrum SchlickFresnel(float costheta) const {
        return Rs + powf(1 - costheta, 5.f) * (Spectrum(1.) - Rs);
    }
    Spectrum Sample_f(const Vector &wi, Vector *sampled_f, float u1, float u2, float *pdf) const;
    float Pdf(const Vector &wi, const Vector &wo) const;
private:
    // FresnelBlend Private Data
    Spectrum Rd, Rs;
    MicrofacetDistribution *distribution;
};

类的作用:

(模拟 菲尼尔 效果,当 你正面看一个表面的时候,你可以看到这个表面的 diffuse效果,当你 不是正面看这个表面,而是 慢慢 斜视 看,那么你就看到镜面反射效果)

Most BRDF models in graphics do not account for the fact that Fresnel reflection reduces
the amount of light that reaches the bottom level of layered objects. Consider a polished(擦亮)
wood table or a wall with glossy paint: if you look at their surfaces head-on(正面地), you primarily
see the wood or the paint pigment color. As you move your viewpoint toward a glancing
angle, you see less of the underlying color as it is overwhelmed by increasing glossy
reflection due to Fresnel effects.

 

In this section, we will implement a BRDF model developed by Ashikhmin and Shirley
(2000, 2002) that models a diffuse underlying surface with a glossy specular surface above
it.
The effect of reflection from the diffuse surface is modulated by the amount of energy
left after Fresnel effects have been considered. Figure 8.21 shows this idea: When the
incident direction is close to the normal, most light is transmitted to the diffuse layer
and the diffuse term dominates(占据支配地位). When the incident direction is close to glancing, glossy
reflection is the primary mode of reflection.

 

Figure 8.21: The FresnelBlend BRDF models the effect of a surface with a glossy layer on top of
a diffuse substrate. As the angle of incidence of the vectors ωi and ωo heads toward glancing (right),
the amount of light that reaches the diffuse substrate is reduced by Fresnel effects and the diffuse
layer becomes less visibly apparent.

 

1. 构造函数

FresnelBlend::FresnelBlend(const Spectrum &d, const Spectrum &s,
                           MicrofacetDistribution *dist)
    : BxDF(BxDFType(BSDF_REFLECTION | BSDF_GLOSSY)), Rd(d), Rs(s) {
    distribution = dist;
}

作用:

(构造函数需要 diffuse 和 specular 反射比率 和 1个 microfacet distribution)

The model takes two spectra, representing diffuse and specular reflectance, and a microfacet
distribution for the glossy layer.

 

2. Spectrum f(const Vector &wo, const Vector &wi) const;

Spectrum FresnelBlend::f(const Vector &wo, const Vector &wi) const {
    Spectrum diffuse = (28.f/(23.f*M_PI)) * Rd *
        (Spectrum(1.f) - Rs) *
        (1.f - powf(1.f - .5f * AbsCosTheta(wi), 5)) *
        (1.f - powf(1.f - .5f * AbsCosTheta(wo), 5));
    Vector wh = wi + wo;
    if (wh.x == 0. && wh.y == 0. && wh.z == 0.) return Spectrum(0.f);
    wh = Normalize(wh);
    Spectrum specular = distribution->D(wh) /
        (4.f * AbsDot(wi, wh) * max(AbsCosTheta(wi), AbsCosTheta(wo))) *
        SchlickFresnel(Dot(wi, wh));
    return diffuse + specular;
}

Spectrum SchlickFresnel(float costheta) const {
    return Rs + powf(1 - costheta, 5.f) * (Spectrum(1.) - Rs);
}

作用:

(FresnelBlend 分为 两项,Diffuse 和 Specular,

Diffuse :

Specular :   ,其中F(wo) 是

 

This model is based on the weighted sum of a glossy specular term and a diffuse term.

The diffuse term in the following equation successfully models
Fresnel-based reduced diffuse reflection in a physically plausible manner:

The glossy specular termis derived as :

where D(ωh) is a microfacet distribution term and F(ωo) represents Fresnel reflectance.

 

(上面的代码直接翻译公式)

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值