#include <RayTracer.h>
Classes | |
class | Photon |
The abstraction of a Photon class that stores the origin, direction and power of a photon three methods implemented to use the PointKDTree data structre. More... | |
class | Settings |
class | Stats |
Public Member Functions | |
shared_ptr< Image > | render (const Settings &settings, const Array< shared_ptr< Surface > > &surfaceArray, const shared_ptr< LightingEnvironment > &lighting, const shared_ptr< Camera > &camera, Stats &stats) |
Render the specified image. More... | |
Static Public Member Functions | |
static shared_ptr< RayTracer > | create () |
Protected Types | |
typedef PointKDTree< Photon, Photon, Photon, Photon > | PhotonTree |
Protected Member Functions | |
shared_ptr< Surfel > | castRay (const Ray &ray, float maxDistance=finf(), bool anyHit=false) const |
void | createPhotonMap () |
Creates a photon map from the settings specified in m_settings. More... | |
Radiance3 | L_i (const Point3 P, const Vector3 &wi, int bouncesLeft, Random &rnd) const |
Find the intersection of the incoming ray, from eye to source and thus computes the radiance of the ray Used in backward raytracing. More... | |
Radiance3 | L_o (const shared_ptr< Surfel > &surfel, const Vector3 &wo, int bouncesLeft, Random &rnd) const |
Computes the radiance of a surfel to return that to L_i. More... | |
Radiance3 | L_scatteredDirect (const shared_ptr< Surfel > &surfel, const Vector3 &wo, Random &rnd) const |
Computes the direct illumination of a surface. More... | |
Radiance3 | L_scatteredIndirect (const shared_ptr< Surfel > &surfel, const Vector3 &wo, Random &rnd) const |
Computes the radiance contribtued by indirect illumination, excluding the impulses. More... | |
Radiance3 | L_scatteredSpecularIndirect (const shared_ptr< Surfel > &surfel, const Vector3 &wo, int bouncesLeft, Random &rnd) const |
Computes the radiance contributed by specular indirect illumination (impulses) More... | |
RayTracer () | |
void | traceAllPixels (int numThreads) |
Called from render(). More... | |
void | traceOnePixel (int x, int y, int threadID) |
Called from GThread::runConcurrently2D(), which is invoked in traceAllPixels() More... | |
void | tracePhotons (Photon p, int bouncesLeft) |
Trace each photons created to store them in the photon map named photons. More... | |
Color3 | visiblePercentage (Ray ray, const shared_ptr< Light > &light, float distance) const |
Computes the partial coverage between a certain light source and the surfel When shadowcasting is disabled or the light is non shadow-casting, always return 1 When partial coverage is disabled, return 1 if visible and 0 if not visible. More... | |
Protected Attributes | |
shared_ptr< Camera > | m_camera |
shared_ptr< Image > | m_image |
shared_ptr< LightingEnvironment > | m_lighting |
Array< shared_ptr< Random > > | m_rnd |
Array of random number generators so that each threadID may have its own without using locks. More... | |
Settings | m_settings |
Stats * | m_stats |
int | m_testInt |
TriTree | m_triTree |
PhotonTree | photons |
|
protected |
|
protected |
|
protected |
ray | The ray in world space |
maxDistance | Don’t trace farther than this |
anyHit | If true, return any surface hit, even if it is not the first |
|
static |
|
protected |
Creates a photon map from the settings specified in m_settings.
|
protected |
Find the intersection of the incoming ray, from eye to source and thus computes the radiance of the ray Used in backward raytracing.
P | origin of ray |
wi | direction of ray |
bouncesLeft | maximum number of recursions before we stop |
rnd | passed random generator to enable multithreading |
|
protected |
Computes the radiance of a surfel to return that to L_i.
Considers direct, specular, emitted and indirect illuminations Used in backward raytracing
surfel | surfel we want to evaluate |
wo | direction of outgoing ray(eye to source) |
bouncesLeft | maximum number of recursions before we stop |
rnd | passed random generator to enable multithreading |
|
protected |
Computes the direct illumination of a surface.
surfel | the surfel we want to evalutate |
wo | outgoing ray direction (towards eye) |
rnd | passed random generator to enable multithreading |
|
protected |
Computes the radiance contribtued by indirect illumination, excluding the impulses.
Currently only called when photon mapping is enabled, and is also taking care of the direct illumination
surfel | surfel we want to evaluate |
wo | outgoing ray direction (towards eye) |
rnd | passed random generator to enable multithreading |
|
protected |
Computes the radiance contributed by specular indirect illumination (impulses)
surfel | surfel we want to evaluate |
wo | outgoing ray direction (towards eye) |
bouncesLeft | maximum number of recursions before we stop |
rnd | passed random generator to enable multithreading |
shared_ptr< Image > RayTracer::render | ( | const Settings & | settings, |
const Array< shared_ptr< Surface > > & | surfaceArray, | ||
const shared_ptr< LightingEnvironment > & | lighting, | ||
const shared_ptr< Camera > & | camera, | ||
Stats & | stats | ||
) |
Render the specified image.
|
protected |
Called from render().
Writes to m_image.
|
protected |
Called from GThread::runConcurrently2D(), which is invoked in traceAllPixels()
|
protected |
Trace each photons created to store them in the photon map named photons.
p | the photon to trace |
bouncesLeft | maximum number of forward bounces left |
|
protected |
Computes the partial coverage between a certain light source and the surfel When shadowcasting is disabled or the light is non shadow-casting, always return 1 When partial coverage is disabled, return 1 if visible and 0 if not visible.
|
protected |
|
protected |
|
protected |
|
protected |
Array of random number generators so that each threadID may have its own without using locks.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |