Graphics Reference
In-Depth Information
15
16
17
18
19
20
21
22
23
24
25
typedef std::vector<Impulse> ImpulseArray;
BSDF () {}
virtual
/ ** Evaluates the finite portion of f(wi, wo) at a surface
whose normal is n. * /
virtual Color3 evaluateFiniteScatteringDensity
( const Vector3&
wi,
const Vector3&
wo) const =0;
...
Listing 14.7 is an interface for the remaining methods needed for algorithms
like photon mapping, recursive (Whitted) ray tracing, and path tracing. These are
the methods for which the implementation and underlying mathematics are some-
what more complicated. We will not discuss them further here, except to note
that the scattering methods are still straightforward to implement, given both the
finite scattering density and the impulses, if we are willing to use rather ineffi-
cient implementations. There is nothing sacred about the particular methods we've
included in this interface. In some implementations of path tracing, for instance,
we want to sample with respect to a distribution proportional to the BSDF, without
the extra weighting factor of
v i ·
n , and we might include a method for that in our
interface.
Listing 14.7: An interface for a scattering function's scattering
and impulse methods.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class BSDF {
...
/ ** Given wi, returns all wo directions that yield impulses in
f(wi, wo). Overwrites the impulseArray. * /
virtual void getOutgoingImpulses
( const Vector3 &
wi,
ImpulseArray&
impulseArray) const =0;
/ ** Given wi, samples wo from the normalized PDF of
wo -> g(wi, wo) * |wi . n|,
where the shape of g is ideally close to that of f. * /
virtual Vector3 scatterOut
( const Vector3 &
wi,
Color3 &
weight) const =0;
/ ** Given wi, returns the probability of scattering
(vs. absorption). By default, this is computed by sampling
since analytic forms do not exist for many scattering models. * /
virtual Color3 probabilityOfScatteringOut(
const Vector3 & wi) const ;
/ ** Given wo, returns all impulses for wi. * /
virtual void getIncomingImpulses
( const Vector3 &
wo,
ImpulseArray&
impulseArray) const =0;
 
Search WWH ::




Custom Search