总结一下:
1. 采样器作用:
整个 Film Plane 上的 incident radiance 实际上是一个连续函数 ,但是Pixel是离散的,这些离散的Pixel其实是从incident radiance 连续函数中采样计算出来, 而最终的目的就是利用离散的Pixel去重新构建一个新的函数,逼近 原来的连续函数,采样器就是为了从incident radiance 连续函数采样出来的更好的Pixel出来。
Sampler 类
// Sampling Declarations
class Sampler {
public:
// Sampler Interface
virtual ~Sampler();
Sampler(int xstart, int xend, int ystart, int yend,
int spp, float sopen, float sclose);
virtual int GetMoreSamples(Sample *sample, RNG &rng) = 0;
virtual int MaximumSampleCount() = 0;
virtual bool ReportResults(Sample *samples, const RayDifferential *rays,
const Spectrum *Ls, const Intersection *isects, int count);
virtual Sampler *GetSubSampler(int num, int count) = 0;
virtual int RoundSize(int size) const = 0;
// Sampler Public Data
const int xPixelStart, xPixelEnd, yPixelStart, yPixelEnd;
const int samplesPerPixel;
const float shutterOpen, shutterClose;
protected:
void ComputeSubWindow(int num, int count, int *xstart, int *xend, int *ystart, int *yend) const;
};
类的作用:
(好的采样模式可以大幅度地改善光线追踪器的效率,可以用少量的射线就可以创建一个高质量的图片)
We can now describe the operation of a few classes that generate good image sampling
patterns. It may be surprising to see that some of them have a significant amount of
complexity behind them. In practice, creating good sample patterns can substantially
improve a ray tracer’s efficiency, allowing it to create a high-quality image with fewer
rays than if a lower-quality pattern was used. Because the run time expense for using
the best sampling patterns is approximately the same as for lower-quality patterns, and
because evaluating the radiance for each image sample is expensiv