Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

LightShader Class Reference

Base class for LightShader plugins to describe emission of light. More...

#include <core/LightShader.h>

Inheritance diagram for LightShader:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual rgb emittedRadiance (const HitRecord &rec, Context &context) const
virtual void estimateRadiance (const HitRecord &rec, Context &context, Vector3 &w_in, double &distance, rgb &radiance) const
virtual rgb estimateBGRadiance (const HitRecord &rec, const Vector3 &w_in, Context &context) const
virtual bool sampleDirection (const HitRecord &rec, Context &context, Vector3 &w_in, double &pdf) const
virtual double pdfDirection (const Vector3 &w_in, const HitRecord &rec, Context &context) const

Detailed Description

Base class for LightShader plugins to describe emission of light.

The LightShader class describes the emission of light. This applies to area lights, singular light shaders (point lights, directional lights, etc) and background light.

When sampling light sources, the returned value of the pdf must be equivalent to calling pdfDirection with the the same inputs and the generated direction. Otherwise the mismatch will cause an invalid result.


Member Function Documentation

virtual rgb LightShader::emittedRadiance const HitRecord rec,
Context context
const [inline, virtual]
 

Used for area lights. The area light's surface has been intersected, so the shader should return the emitted radiance at the hit point in the direction ray came from.

Parameters:
[in] rec HitRecord describing the hit point on the luminaire.
[in] context Rendering Context containing the ray data.
Returns:
rgb value representing the emitted radiance.

Reimplemented in DiffuseLightShader, and SpectralLight.

virtual void LightShader::estimateRadiance const HitRecord rec,
Context context,
Vector3 w_in,
double &  distance,
rgb radiance
const [inline, virtual]
 

Estimate the radiance this light deposits towards a point in the scene. The light should not attempt an intersection with the scene to determine if an occlusion exists. Occlusion testing can be performed by the caller with the retured 'w_in' and 'distance'. Singular light sources, such as point lights, would only implement this function and allow the caller to test for occlusion. LightShaders intended for area lights may also implement this function as it may allow for importance sampling of luminaires based on estimated radiance.

Parameters:
[in] rec HitRecord for the point asking for a radiance estimate.
[in] context The standard rendering context.
[out] w_in The unit length vector to the light.
[out] distance Distance from the shading point to the light.
[out] radiance The radiance estimate.

Reimplemented in ConstantEnvironment, CylindricalEnvironment, and UberLight.

virtual rgb LightShader::estimateBGRadiance const HitRecord rec,
const Vector3 w_in,
Context context
const [inline, virtual]
 

Estimate the radiance this light produces along the ray given by the input direction and the hit point in rec. This function is intended for background environments and should be called for rays that leave the scene without intersecting any geometry.

Parameters:
[in] rec HitRecord for the point being lit.
[in] w_in Unit length vector towards the light.
[in] context The standard rendering context.
Returns:
rgb value representing the incident radiance.

Reimplemented in ConstantEnvironment, and CylindricalEnvironment.

virtual bool LightShader::sampleDirection const HitRecord rec,
Context context,
Vector3 w_in,
double &  pdf
const [inline, virtual]
 

Attempt to generate a directional sample towards this light source.

Parameters:
[in] rec The HitRecord for the point being lit.
[in] context The standard rendering context.
[out] w_in Unit length vector pointing towards the light source.
[out] pdf The value of the pdf for this vector.
Returns:
True if a sample was generated.

Reimplemented in ConstantEnvironment, and CylindricalEnvironment.

virtual double LightShader::pdfDirection const Vector3 w_in,
const HitRecord rec,
Context context
const [inline, virtual]
 

Evaluate the pdf of generating the sampled direction.

Parameters:
[in] w_in Unit length vector.
[in] rec The HitRecord of the point being lit.
[in] context The standard rendering context.
Returns:
Evaluation of the pdf for the direction.

Reimplemented in ConstantEnvironment, and CylindricalEnvironment.


The documentation for this class was generated from the following file:
Generated on Wed Jul 20 16:15:24 2005 for galileo by  doxygen 1.4.3