07.01.2013 Views

3D graphics eBook - Course Materials Repository

3D graphics eBook - Course Materials Repository

3D graphics eBook - Course Materials Repository

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Path tracing 98<br />

History<br />

Further information: Rendering, Chronology of important published ideas<br />

The rendering equation and its use in computer <strong>graphics</strong> was presented by James Kajiya in 1986. kajiya1986rendering<br />

This presentation contained what was probably the first description of the path tracing algorithm. A decade later,<br />

Lafortune suggested many refinements, including bidirectional path tracing. lafortune1996mathematical<br />

Metropolis light transport, a method of perturbing previously found paths in order to increase performance for<br />

difficult scenes, was introduced in 1997 by Eric Veach and Leonidas J. Guibas.<br />

More recently, CPUs and GPUs have become powerful enough to render images more quickly, causing more<br />

widespread interest in path tracing algorithms. Tim Purcell first presented a global illumination algorithm running on<br />

a GPU in 2002. purcell2002ray In February 2009 Austin Robison of Nvidia demonstrated the first commercial<br />

implementation of a path tracer running on a GPU robisonNVIRT , and other implementations have followed, such as<br />

that of Vladimir Koylazov in August 2009. pathGPUimplementations This was aided by the maturing of GPGPU<br />

programming toolkits such as CUDA and OpenCL and GPU ray tracing SDKs such as OptiX.<br />

Description<br />

In the real world, many small amounts of light are emitted from light sources, and travel in straight lines (rays) from<br />

object to object, changing colour and intensity, until they are absorbed (possibly by an eye or camera). This process<br />

is simulated by path tracing, except that the paths are traced backwards, from the camera to the light. The<br />

inefficiency arises in the random nature of the bounces from many surfaces, as it is usually quite unlikely that a path<br />

will intersect a light. As a result, most traced paths do not contribute to the final image.<br />

This behaviour is described mathematically by the rendering equation, which is the equation that path tracing<br />

algorithms try to solve.<br />

Path tracing is not simply ray tracing with infinite recursion depth. In conventional ray tracing, lights are sampled<br />

directly when a diffuse surface is hit by a ray. In path tracing, a new ray is randomly generated within the<br />

hemisphere of the object and then traced until it hits a light — possibly never. This type of path can hit many diffuse<br />

surfaces before interacting with a light.<br />

A simple path tracing pseudocode might look something like this:<br />

Color TracePath(Ray r,depth) {<br />

if(depth == MaxDepth)<br />

return Black; // bounced enough times<br />

r.FindNearestObject();<br />

if(r.hitSomething == false)<br />

return Black; // nothing was hit<br />

Material m = r.thingHit->material;<br />

Color emittance = m.emittance;<br />

// pick a random direction from here and keep going<br />

Ray newRay;<br />

newRay.origin = r.pointWhereObjWasHit;<br />

newRay.direction = RandomUnitVectorInHemisphereOf(r.normalWhereObjWasHit);<br />

float cos_omega = DotProduct(newRay.direction, r.normalWhereObjWasHit);<br />

Color BDRF = m.reflectance*cos_omega;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!