00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if defined(_MSC_VER)
00025 #pragma once
00026 #endif
00027
00028 #ifndef PBRT_INTEGRATORS_IGI_H
00029 #define PBRT_INTEGRATORS_IGI_H
00030
00031
00032 #include "pbrt.h"
00033 #include "integrator.h"
00034
00035
00036 struct VirtualLight {
00037 VirtualLight() { }
00038 VirtualLight(const Point &pp, const Normal &nn, const Spectrum &c,
00039 float reps)
00040 : p(pp), n(nn), pathContrib(c), rayEpsilon(reps) { }
00041 Point p;
00042 Normal n;
00043 Spectrum pathContrib;
00044 float rayEpsilon;
00045 };
00046
00047
00048
00049
00050 class IGIIntegrator : public SurfaceIntegrator {
00051 public:
00052
00053 ~IGIIntegrator();
00054 Spectrum Li(const Scene *scene, const Renderer *renderer,
00055 const RayDifferential &ray, const Intersection &isect,
00056 const Sample *sample, RNG &rng, MemoryArena &arena) const;
00057 void RequestSamples(Sampler *sampler, Sample *sample, const Scene *scene);
00058 void Preprocess(const Scene *, const Camera *, const Renderer *);
00059 IGIIntegrator(uint32_t nl, uint32_t ns, float rrt, int maxd, float gl, int ng) {
00060 nLightPaths = RoundUpPow2(nl);
00061 nLightSets = RoundUpPow2(ns);
00062 rrThreshold = rrt;
00063 maxSpecularDepth = maxd;
00064 virtualLights.resize(nLightSets);
00065 gLimit = gl;
00066 nGatherSamples = ng;
00067 lightSampleOffsets = NULL;
00068 bsdfSampleOffsets = NULL;
00069 }
00070 private:
00071
00072
00073
00074 LightSampleOffsets *lightSampleOffsets;
00075 BSDFSampleOffsets *bsdfSampleOffsets;
00076 uint32_t nLightPaths, nLightSets;
00077 float gLimit;
00078 int nGatherSamples;
00079 float rrThreshold;
00080 int maxSpecularDepth;
00081 int vlSetOffset;
00082 BSDFSampleOffsets gatherSampleOffset;
00083 vector<vector<VirtualLight> > virtualLights;
00084 };
00085
00086
00087 IGIIntegrator *CreateIGISurfaceIntegrator(const ParamSet ¶ms);
00088
00089 #endif // PBRT_INTEGRATORS_IGI_H