00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef LUX_FRESNELBLEND_H
00024 #define LUX_FRESNELBLEND_H
00025
00026 #include "lux.h"
00027 #include "bxdf.h"
00028 #include "spectrum.h"
00029
00030 namespace lux
00031 {
00032
00033 class FresnelBlend : public BxDF
00034 {
00035 public:
00036
00037 FresnelBlend(const SWCSpectrum &Rd,
00038 const SWCSpectrum &Rs,
00039 const SWCSpectrum &Alpha,
00040 float d,
00041 MicrofacetDistribution *dist);
00042 virtual ~FresnelBlend() { }
00043 virtual void f(const TsPack *tspack, const Vector &wo, const Vector &wi, SWCSpectrum *const f) const;
00044 SWCSpectrum SchlickFresnel(float costheta) const {
00045 return Rs + powf(1.f - costheta, 5.f) * (SWCSpectrum(1.f) - Rs);
00046 }
00047 virtual bool Sample_f(const TsPack *tspack, const Vector &wo, Vector *wi,
00048 float u1, float u2, SWCSpectrum *const f, float *pdf, float *pdfBack = NULL,
00049 bool reverse = false) const;
00050 virtual float Pdf(const TsPack *tspack, const Vector &wi, const Vector &wo) const;
00051
00052 private:
00053
00054 SWCSpectrum Rd, Rs, Alpha;
00055 float depth;
00056 MicrofacetDistribution *distribution;
00057 };
00058
00059 }
00060
00061 #endif // LUX_FRESNELBLEND_H
00062