PathVertex.h

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @class  PathVertex
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Fall 2008
00006    
00007    @brief
00008       A Path is composed of zero or more PathVertex vertices stored in a 
00009    PathVertexList.  Each PathVertex stores the underlying SurfacePoint, 
00010    representing a single point on a surface (and all relevant associated 
00011    metadata, eg, UV coords, normal, BSDF, etc.).  In addition to storing 
00012    the underlying SurfacePoint, each PathVertex also stores a set of 
00013    carefully chosen, local values which facilitate efficient computation
00014    of the unweighted, bidirectional contributions of all possible 
00015    combinations of light and eye subpaths.  Specifically, 'alphaL' and 
00016    'alphaE' store the cumulative light and eye contributions respectively, 
00017    with respect to this vertex' index within its parent Path.
00018    
00019    @note
00020       Density with respect to projected solid angle is density with respect to 
00021    ordinary solid angle divided by cos(theta) where theta is the angle between 
00022    wo and the surface normal at v (PathVertex::pdfL and PathVertex::pdfE are 
00023    both probability densities with respect to projected solid angle)
00024    
00025    @see section 10.2 (pgs 302-305) of Veach's thesis for more details
00026    <!-------------------------------------------------------------------->**/
00027 
00028 #ifndef PATH_VERTEX_H_
00029 #define PATH_VERTEX_H_
00030 
00031 #include <utils/SpectralSampleSet.h>
00032 #include <core/SurfacePoint.h>
00033 #include <stats/Event.h>
00034 
00035 #include <ostream>
00036 #include <deque>
00037 
00038 struct PathVertex : public SSEAligned {
00039    ///@name Fast-access public data
00040    //@{-----------------------------------------------------------------
00041    
00042    SurfacePointPtr pt;         // PT
00043    
00044    // pt->bsdf if normal vertex; pt->emitter if initial vertex on light source
00045    //                            pt->sensor  if initial vertex on sensor (camera)
00046    BSDF          *bsdf;       // PT
00047    
00048    // G(xi<->xi+1)
00049    real_t         GL;         // L
00050    // G(xi-1<->xi)
00051    real_t         GE;         // E
00052    
00053    Vector3        wi;         // PT
00054    
00055    // cumulative, unweighted bidirectional contributions of light and eye 
00056    // subpaths respectively
00057    SpectralSampleSet alphaL;     // L
00058    SpectralSampleSet alphaE;     // E
00059    
00060    // fs(xi-1,xi,xi+1)
00061    // BSDF value centered at this vertex which always follows flow of light 
00062    // because fs in the opposite direction is never needed / evaluated
00063    // (note that we are not assuming BSDF reciprocity here)
00064    SpectralSampleSet fs;         // PT
00065    
00066    // probability density with respect to projected solid angle of sampling 
00067    // the following vertex in the direction of lightflow in the parent Path 
00068    // from this vertex; p(xi-1 -> xi -> xi+1) = p(xi+1 | xi, xi-1)
00069    real_t         pdfL;       // L
00070    
00071    // probability density with respect to projected solid angle of sampling 
00072    // the previous vertex in the direction of lightflow in the parent Path 
00073    // from this vertex; p(xi-1 <- xi <- xi+1) = p(xi-1 | xi, xi+1)
00074    real_t         pdfE;       // E
00075    
00076    // cumulative probability density up to and including this vertex in parent path
00077    real_t         pL;         // L
00078    real_t         pE;         // E
00079    
00080    // event which generated the next vertex in the parent Path from this 
00081    // vertex; metadata associated with this event is used for future BSDF
00082    // evaluations, s.t. mixture BSDFs which are, for instance, composed of 
00083    // specular and diffuse components will remain consistent throughout the 
00084    // lifetime of this PathVertex
00085    Event          event;      // PT
00086    
00087    
00088    //@}-----------------------------------------------------------------
00089    ///@name Constructors
00090    //@{-----------------------------------------------------------------
00091    
00092    /**
00093     * @brief
00094     *    Initializes a PathVertex
00095     * 
00096     * @note if alphaL_ is specified, vertex is assumed to be sampled starting 
00097     *    from an emitter
00098     * @note if alphaE_ is specified, vertex is assumed to be sampled starting 
00099     *    from a  sensor (camera)
00100     * @note this means that one of alphaL_ or alphaE_ will be disregarded
00101     */
00102    inline PathVertex(SurfacePoint *pt_, const Vector3 &wi_, 
00103                      real_t GL_, real_t GE_, 
00104                      const SpectralSampleSet &alphaL_, 
00105                      const SpectralSampleSet &alphaE_, 
00106                      real_t pL_ = 1, real_t pE_ = 1)
00107       : pt(SurfacePointPtr(pt_)), bsdf(pt->bsdf), GL(GL_), GE(GE_), wi(wi_), 
00108         alphaL(alphaL_), alphaE(alphaE_), pdfL(1), pdfE(1), pL(pL_), pE(pE_)
00109    {
00110       _init();
00111    }
00112    
00113    PathVertex(SurfacePoint *pt_, real_t pL_, real_t pE_);
00114    
00115    inline PathVertex(const PathVertex &copy)
00116       : pt(copy.pt), bsdf(copy.bsdf), GL(copy.GL), GE(copy.GE), wi(copy.wi), 
00117         alphaL(copy.alphaL), alphaE(copy.alphaE), fs(copy.fs), 
00118         pdfL(copy.pdfL), pdfE(copy.pdfE), pL(copy.pL), pE(copy.pE), 
00119         event(copy.event)
00120    { }
00121    
00122    inline PathVertex()
00123    { }
00124    
00125    
00126    //@}-----------------------------------------------------------------
00127    
00128    private:
00129       void _init();
00130 };
00131 
00132 DECLARE_STL_TYPEDEF(std::deque<PathVertex>, PathVertexList);
00133 
00134 /// Prints a PathVertex to an output stream
00135 std::ostream &operator<<(std::ostream &os, const PathVertex &v);
00136 
00137 #endif // PATH_VERTEX_H_
00138 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6