PBRT_V2 总结记录 <20> Sampler

本文总结了PBRT_V2中的Sampler类的作用和主要方法,包括采样器用于生成高质量图像样本点,提高光线追踪效率。Sampler的任务是生成多维样本位置,用于光照估算等任务,其构造函数接收图像分辨率、像素采样数和快门时间等参数。重点介绍了GetMoreSamples、MaximumSampleCount、ReportResults、GetSubSampler和RoundSize等方法的功能和应用场景。
摘要由CSDN通过智能技术生成

总结一下:

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值