00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef LUX_EXPHOTONMAP_H
00025 #define LUX_EXPHOTONMAP_H
00026
00027
00028 #include "lux.h"
00029 #include "transport.h"
00030 #include "scene.h"
00031 #include "kdtree.h"
00032 #include "sampling.h"
00033 #include "photonmap.h"
00034
00035 namespace lux
00036 {
00037
00038 class ExPhotonIntegrator : public SurfaceIntegrator {
00039 public:
00040
00041 enum RenderingMode { RM_DIRECTLIGHTING, RM_PATH };
00042 enum LightStrategy {
00043 SAMPLE_ALL_UNIFORM, SAMPLE_ONE_UNIFORM,
00044 SAMPLE_AUTOMATIC
00045 };
00046
00047
00048 ExPhotonIntegrator(
00049 RenderingMode rm,
00050 LightStrategy st,
00051 int ndir, int ncaus, int nindir, int nrad,
00052 int nLookup, int mdepth, int mpdepth,
00053 float maxdist, bool finalGather, int gatherSamples, float ga,
00054 PhotonMapRRStrategy rrstrategy, float rrcontprob,
00055 float distThreshold,
00056 string *mapsFileName,
00057 bool dbgEnableDirect, bool dbgEnableDirectMap, bool dbgEnableCaustic,
00058 bool dbgEnableIndirect, bool dbgEnableSpecular);
00059 virtual ~ExPhotonIntegrator();
00060
00061 virtual int Li(const TsPack *tspack, const Scene *scene,
00062 const Sample *sample) const;
00063 virtual void RequestSamples(Sample *sample, const Scene *scene);
00064 virtual void Preprocess(const TsPack *tspack, const Scene *scene);
00065
00066 static SurfaceIntegrator *CreateSurfaceIntegrator(const ParamSet ¶ms);
00067 private:
00068 SWCSpectrum LiDirectLightingMode(const TsPack *tspack, const Scene *scene,
00069 const RayDifferential &ray, const Sample *sample, float *alpha,
00070 const int reflectionDepth, const bool specularBounce) const;
00071 SWCSpectrum LiPathMode(const TsPack *tspack, const Scene *scene,
00072 const RayDifferential &ray, const Sample *sample, float *alpha) const;
00073
00074
00075 RenderingMode renderingMode;
00076 LightStrategy lightStrategy;
00077 u_int nDirectPhotons, nCausticPhotons, nIndirectPhotons, nRadiancePhotons;
00078 u_int nLookup;
00079 int maxDepth, maxPhotonDepth;
00080 float maxDistSquared;
00081
00082 bool finalGather;
00083 float cosGatherAngle;
00084 int gatherSamples;
00085 PhotonMapRRStrategy rrStrategy;
00086 float rrContinueProbability;
00087 float distanceThreshold;
00088
00089
00090 string *mapsFileName;
00091
00092
00093 bool debugEnableDirect, debugUseRadianceMap, debugEnableCaustic,
00094 debugEnableIndirect, debugEnableSpecular;
00095
00096 int bufferId;
00097
00098
00099 int sampleOffset;
00100 int sampleFinalGather1Offset;
00101 int sampleFinalGather2Offset;
00102
00103 LightPhotonMap *causticMap;
00104 LightPhotonMap *indirectMap;
00105 RadiancePhotonMap *radianceMap;
00106 };
00107
00108 }
00109
00110 #endif