JPBRT 0.5

org.jpbrt.core
Class Light

java.lang.Object
  extended by org.jpbrt.core.Light
Direct Known Subclasses:
AreaLight, DistantLight, InfiniteAreaLight, PointLight, SimpleInfiniteAreaLight

public abstract class Light
extends java.lang.Object

Light defines the origin of a light source and the distribution of energy that it emits.

References:
M. Pharr, G. Humphreys. (2004). Physically Based Rendering. Morgan Kaufmann.
Page 598.

Version:
1.0 2010-09-06 Created.
Author:
Werner Randelshofer

Field Summary
protected  Transform lightToWorld
          Light-to-world transformation.
 int nSamples
          The number of samples is used for area light sources where it may be desirable to trace multiple shadow rays to the light to compute soft shadows.
protected  Transform worldToLight
          The inverse of the light-to-world transformation.
 
Constructor Summary
Light(Transform l2w)
           
Light(Transform l2w, int nSamples)
           
 
Method Summary
 int getNumSamples()
           
abstract  boolean isDeltaLight()
          Indicates whether the light is described by a delta distribution.
 Spectrum Le(RayDifferential ray)
          Returns the emitted radiance of the light along a ray that didn't hit anything in the scene, page 625.
abstract  float pdf(Point p, Vector wi)
          The probability density function PDF describes the relative probability of a random variable taking on a particular value, page 634.
abstract  Spectrum power(Scene s)
          Returns the total emitted power of the light into the scene.
abstract  Spectrum sampleL(Point p, float pEpsilon, LightSample ls, float time, Vector wi, float[] pdf, VisibilityTester vis)
          Returns the incident radiance from the light at a point p and also returns the direction vector wi that gives the direction from which radiance is arriving, assuming that there are no occluding objects between them.
abstract  Spectrum sampleL(Scene scene, LightSample ls, float u1, float u2, float time, Ray ray, Normal Ns, float[] pdf)
           
 void SHProject(Point p, float pEpsilon, int lmax, Scene scene, boolean computeLightVisibility, float time, RNG rng, Spectrum[] coeffs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nSamples

public final int nSamples
The number of samples is used for area light sources where it may be desirable to trace multiple shadow rays to the light to compute soft shadows.


lightToWorld

protected final Transform lightToWorld
Light-to-world transformation.


worldToLight

protected final Transform worldToLight
The inverse of the light-to-world transformation.

Constructor Detail

Light

public Light(Transform l2w)

Light

public Light(Transform l2w,
             int nSamples)
Parameters:
l2w - The light-to-world transform.
nSamples - Number of samples that should be taken for shadow rays. Specify one for point light sources, and a value greater than one for area light sources.
Method Detail

Le

public Spectrum Le(RayDifferential ray)
Returns the emitted radiance of the light along a ray that didn't hit anything in the scene, page 625. Only InfiniteAreaLight's return a value different than 0.


pdf

public abstract float pdf(Point p,
                          Vector wi)
The probability density function PDF describes the relative probability of a random variable taking on a particular value, page 634.


getNumSamples

public int getNumSamples()

sampleL

public abstract Spectrum sampleL(Point p,
                                 float pEpsilon,
                                 LightSample ls,
                                 float time,
                                 Vector wi,
                                 float[] pdf,
                                 VisibilityTester vis)
Returns the incident radiance from the light at a point p and also returns the direction vector wi that gives the direction from which radiance is arriving, assuming that there are no occluding objects between them.

For some types of lights (usually area lights), light may arrive at p from many directions. For these types of lights, the sampleL method must randomly sample a poin on the light source's surface, so that Monte Carlo integration can be used to find the reflected light at p due to illumination from the light.

Page 598.

Parameters:
p - A point in world coordinates.
wi - Output parameter. A direction vector giving the incident direction of the light. Pointing from p to a randomly selected point on the surface of the light source.
vis - Output parameter. The VisibilityTester is only initialized if the returned spectrum is not black. The visibility tester must be traced to verify that there are no occluding objects between the light source and p.
Returns:
The spectrum of the emitted light.

sampleL

public abstract Spectrum sampleL(Scene scene,
                                 LightSample ls,
                                 float u1,
                                 float u2,
                                 float time,
                                 Ray ray,
                                 Normal Ns,
                                 float[] pdf)

SHProject

public void SHProject(Point p,
                      float pEpsilon,
                      int lmax,
                      Scene scene,
                      boolean computeLightVisibility,
                      float time,
                      RNG rng,
                      Spectrum[] coeffs)

power

public abstract Spectrum power(Scene s)
Returns the total emitted power of the light into the scene. This quantity is useful for light transport algorithms that may want to devote additional computational resources to lights in the scene that make the largest distributions.


isDeltaLight

public abstract boolean isDeltaLight()
Indicates whether the light is described by a delta distribution. Such lights include point lights, which emit illumination from a single point, and directional lights, where all light arrives from the same direction. The only way to detect illumination from light sources like these is to call their sampleL(org.jpbrt.core.Point, float, org.jpbrt.core.LightSample, float, org.jpbrt.core.Vector, float[], org.jpbrt.core.VisibilityTester) methods. It is impossible to randomly choose a direction from a point p that happens to find such a light source.


Copyright 2010 © by the authors and contributors of the JPBRT project.
Some rights reserved.