PBRT_V2 总结记录 Phase Functions

Just as there is a wide variety of BSDF models to describe scattering from surfaces, many
phase functions have been developed.

phase functions actually define probability distributions for scattering in a particular direction. (phase functions 其实就是一个 散射 到某一个方向 的 概率分布函数,理解起来类似 BRDF)

In a slightly confusing(迷惑) overloading(重载) of terminology(术语), phase functions themselves can be
isotropic or anisotropic as well.

For phase function implementations in pbrt, the incident direction
points toward the scattering point and the outgoing direction points away from it.
This matches the usual convention for phase functions.

Figure 11.11: Phase functions are written with the convention that the incident direction points
toward the point where scattering happens and the outgoing direction ω' points away from it. This is
a different convention than was used for BSDFs. The angle between them is denoted by θ.

Isotropic Phase Function

An isotropic phase function describes equal scattering
in all directions and is thus independent of either of the two directions. Because phase
functions are normalized, there is only one such function, and it must be the constant
1/4π:

float PhaseIsotropic(const Vector &, const Vector &) {
    return 1.f / (4.f * M_PI);
}

Anisotropic Phase Functions

1. PhaseRayleigh And PhaseMieHazy And  PhaseMieMurky

pbrt includes implementations of phase functions that model Rayleigh scattering and
Mie scattering. The Rayleigh model describes scattering from very small particles such
as the molecules(分子) in the Earth’s atmosphere.
If the particles have radii that are smaller
than the wavelength of light λ, (r/λ < 0.05), the Rayleigh model accurately describes the
distribution of scattered light. Wavelength-dependent Rayleigh scattering is the reason
that the sky is blue and sunsets are red.Mie scattering is based on a more general theory;
it is derived from Maxwell’s equations and can describe scattering from a wider range
of particle sizes.
For example, it is a good model for scattering in the atmosphere due to
water droplets and fog.

float PhaseRayleigh(const Vector &w, const Vector &wp) {
    float costheta = Dot(w, wp);
    return  3.f/(16.f*M_PI) * (1 + costheta * costheta);
}


float PhaseMieHazy(const Vector &w, const Vector &wp) {
    float costheta = Dot(w, wp);
    return (0.5f + 4.5f * powf(0.5 * (1.f + costheta), 8.f)) / (4.f*M_PI);
}


float PhaseMieMurky(const Vector &w, const Vector &wp) {
    float costheta = Dot(w, wp);
    return (0.5f + 16.5f * powf(0.5 * (1.f + costheta), 32.f)) / (4.f*M_PI);
}

2. PhaseHG

A widely used phase function, particularly in computer graphics, was developed by
Henyey and Greenstein (1941). This phase function was specifically designed to be easy
to fit to measured scattering data.
A single parameter g (called the asymmetry parameter)
controls the distribution of scattered light:

Figure 11.12 shows plots of the Henyey–Greenstein phase function with varying asymmetry(不对称)
parameters. The value of g for this model must be in the range (−1, 1). Negative
values of g correspond to back-scattering, where light is mostly scattered back toward the
incident direction, and positive values correspond to forward-scattering.
The greater the
magnitude of g, the more scattering occurs close to the −ω or ω directions (for backscattering
and forward-scattering, respectively).

Figure 11.12: Plots of the Henyey–Greenstein Phase Function for Asymmetry g Parameters
−.35 and .67. Negative g values (solid line) describe phase functions that primarily scatter light back
in the incident direction, and positive g values (dashed line) describe phase functions that primarily
scatter light forward in the direction it was already traveling.

The asymmetry parameter has a precise meaning. It is the average value of the product
of the phase function being approximated and the cosine of the angle between ω‘ and ω.
Given an arbitrary phase function, g can be computed as

Thus, an isotropic phase function gives g = 0, as expected.

float PhaseHG(const Vector &w, const Vector &wp, float g) {
    float costheta = Dot(w, wp);
    return 1.f / (4.f * M_PI) *
        (1.f - g*g) / powf(1.f + g*g - 2.f * g * costheta, 1.5f);
}

3. PhaseSchlick

Blasi, Le Sa¨ec, and Schlick (1993) developed an efficient approximation to the Henyey–
Greenstein function that has been widely used in computer graphics due to its computational
efficiency.
It avoids the expensive powf() function:

The k parameter has a similar effect on the distribution to the g term of the Henyey–
Greenstein model, where −1 corresponds to total back-scattering, 0 corresponds to
isotropic scattering, and 1 corresponds to total forward-scattering. For immediate values,
we have found that the polynomial equation

gives an accurate correspondence between k and g values. Figure 11.13 shows a plot of
the Schlick model and the Henyey–Greenstein model.

Figure 11.13: Plot of the Schlick phase function with k = .8112 (dashed lines) superimposed with
plot of the Henyey–Greenstein phase function (solid lines) with g = .6. The Schlick model closely
matches Henyey–Greenstein and is less computationally expensive to evaluate.

float PhaseSchlick(const Vector &w, const Vector &wp, float g) {
    // improved g->k mapping derived by Thies Heidecke
    // see http://pbrt.org/bugtracker/view.php?id=102
    float alpha = 1.5f;
    float k = alpha * g + (1.f - alpha) * g * g * g;
    float kcostheta = k * Dot(w, wp);
    return 1.f / (4.f * M_PI) *
        (1.f - k*k) / ((1.f - kcostheta) * (1.f - kcostheta));
}

猜你喜欢

转载自blog.csdn.net/aa20274270/article/details/84026998
今日推荐