ModifiedPhongBSDF.h

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @class  ModifiedPhongBSDF
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Fall 2008
00006    
00007    @brief
00008       Physically-correct modified phong model for glossy/specular surfaces, 
00009    defined at a single point on a surface in 3-space. The modified phong 
00010    model has two inputs: Kd, and Ks in [0, 1] subject to Kd + Ks <= 1, 
00011    where Kd and Ks represent the diffuse and specular reflectivity of the 
00012    surface respectively (fraction of incoming energy that is reflected 
00013    diffusely/specularly). A third input, n, represents the specular 
00014    shininess of the surface, where higher values of n correspond to tighter /
00015    sharper specular highlights, and lower values of n correspond to wider / 
00016    glossier highlights.
00017    
00018    @note For more information, please see: 
00019       E. Lafortune and Y. Willems. Using the modified Phong reflectance 
00020    model for physically based rendering. Technical Report CW197, Dept of 
00021    Computer Science, K.U. Leuven, 1994.
00022    
00023    @param
00024       kd - SpectralSampleSet which scales / attenuates the overall reflectance 
00025    of the material (diffuse albedo)
00026    
00027    @param
00028       ks - SpectralSampleSet which scales / attenuates the overall reflectance 
00029    of the material (specular albedo)
00030    
00031    @param
00032       n  - Wavelength-dependent shininess exponent
00033    
00034    @note Also known as modified Blinn-Phong model
00035    <!-------------------------------------------------------------------->**/
00036 
00037 #ifndef MODIFIED_PHONG_BSDF_H_
00038 #define MODIFIED_PHONG_BSDF_H_
00039 
00040 #include <materials/BSDF.h>
00041 
00042 class ModifiedPhongBSDF : public BSDF {
00043    public:
00044       ///@name Constructors
00045       //@{-----------------------------------------------------------------
00046       
00047       inline explicit ModifiedPhongBSDF(SurfacePoint &pt, 
00048                                         Material *parent = NULL)
00049          : BSDF(pt, parent), m_n(SpectralSampleSet::fill(-1))
00050       { }
00051       
00052       virtual ~ModifiedPhongBSDF()
00053       { }
00054       
00055       
00056       //@}-----------------------------------------------------------------
00057       ///@name Initialization
00058       //@{-----------------------------------------------------------------
00059       
00060       virtual void init();
00061       
00062       
00063       //@}-----------------------------------------------------------------
00064       ///@name Main usage interface
00065       //@{-----------------------------------------------------------------
00066       
00067       virtual Event sample();
00068        
00069       virtual real_t getPdf(const Event &event);
00070       
00071       virtual SpectralSampleSet getBSDF(const Vector3 &wi, const Vector3 &wo);
00072       
00073       
00074       //@}-----------------------------------------------------------------
00075       
00076    protected:
00077       SpectralSampleSet m_kd;
00078       SpectralSampleSet m_ks;
00079       SpectralSampleSet m_n;
00080       
00081       real_t   m_kda; // average kd
00082       real_t   m_ksa; // average ks
00083       real_t   m_na;  // average n
00084 };
00085 
00086 #endif // MODIFIED_PHONG_BSDF_H_
00087 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6