00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "distributedpath.h"
00025 #include "bxdf.h"
00026 #include "material.h"
00027 #include "camera.h"
00028 #include "paramset.h"
00029 #include "dynload.h"
00030
00031 using namespace lux;
00032
00033
00034 DistributedPath::DistributedPath(LightStrategy st, bool da, int ds, bool dd, bool dg, bool ida, int ids, bool idd, bool idg,
00035 int drd, int drs, int dtd, int dts, int grd, int grs, int gtd, int gts, int srd, int std,
00036 bool drer, float drert, bool drfr, float drfrt,
00037 bool grer, float grert, bool grfr, float grfrt) {
00038 lightStrategy = st;
00039
00040 directAll = da;
00041 directSamples = ds;
00042 directDiffuse = dd;
00043 directGlossy = dg;
00044 indirectAll = ida;
00045 indirectSamples = ids;
00046 indirectDiffuse = idd;
00047 indirectGlossy = idg;
00048 diffusereflectDepth = drd;
00049 diffusereflectSamples = drs;
00050 diffuserefractDepth = dtd;
00051 diffuserefractSamples = dts;
00052 glossyreflectDepth = grd;
00053 glossyreflectSamples = grs;
00054 glossyrefractDepth = gtd;
00055 glossyrefractSamples = gts;
00056 specularreflectDepth = srd;
00057 specularrefractDepth = std;
00058
00059 diffusereflectReject = drer;
00060 diffusereflectReject_thr = drert;
00061 diffuserefractReject = drfr;
00062 diffuserefractReject_thr = drfrt;
00063 glossyreflectReject = grer;
00064 glossyreflectReject_thr = grert;
00065 glossyrefractReject = grfr;
00066 glossyrefractReject_thr = grfrt;
00067 }
00068
00069 void DistributedPath::RequestSamples(Sample *sample, const Scene *scene) {
00070 if (lightStrategy == SAMPLE_AUTOMATIC) {
00071 if (scene->sampler->IsMutating() || scene->lights.size() > 7)
00072 lightStrategy = SAMPLE_ONE_UNIFORM;
00073 else
00074 lightStrategy = SAMPLE_ALL_UNIFORM;
00075 }
00076
00077
00078 maxDepth = diffusereflectDepth;
00079 maxDepth = max(maxDepth, diffuserefractDepth);
00080 maxDepth = max(maxDepth, glossyreflectDepth);
00081 maxDepth = max(maxDepth, glossyrefractDepth);
00082 maxDepth = max(maxDepth, specularreflectDepth);
00083 maxDepth = max(maxDepth, specularrefractDepth);
00084
00085
00086
00087 lightSampleOffset = sample->Add2D(directSamples);
00088 lightNumOffset = sample->Add1D(directSamples);
00089 bsdfSampleOffset = sample->Add2D(directSamples);
00090 bsdfComponentOffset = sample->Add1D(directSamples);
00091
00092 indirectlightSampleOffset = sample->Add2D(indirectSamples * maxDepth);
00093 indirectlightNumOffset = sample->Add1D(indirectSamples * maxDepth);
00094 indirectbsdfSampleOffset = sample->Add2D(indirectSamples * maxDepth);
00095 indirectbsdfComponentOffset = sample->Add1D(indirectSamples * maxDepth);
00096
00097
00098
00099 diffuse_reflectSampleOffset = sample->Add2D(diffusereflectSamples);
00100 diffuse_reflectComponentOffset = sample->Add1D(diffusereflectSamples);
00101
00102 indirectdiffuse_reflectSampleOffset = sample->Add2D(diffusereflectDepth);
00103 indirectdiffuse_reflectComponentOffset = sample->Add1D(diffusereflectDepth);
00104
00105
00106
00107 diffuse_refractSampleOffset = sample->Add2D(diffuserefractSamples);
00108 diffuse_refractComponentOffset = sample->Add1D(diffuserefractSamples);
00109
00110 indirectdiffuse_refractSampleOffset = sample->Add2D(diffuserefractDepth);
00111 indirectdiffuse_refractComponentOffset = sample->Add1D(diffuserefractDepth);
00112
00113
00114
00115 glossy_reflectSampleOffset = sample->Add2D(glossyreflectSamples);
00116 glossy_reflectComponentOffset = sample->Add1D(glossyreflectSamples);
00117
00118 indirectglossy_reflectSampleOffset = sample->Add2D(glossyreflectDepth);
00119 indirectglossy_reflectComponentOffset = sample->Add1D(glossyreflectDepth);
00120
00121
00122
00123 glossy_refractSampleOffset = sample->Add2D(glossyrefractSamples);
00124 glossy_refractComponentOffset = sample->Add1D(glossyrefractSamples);
00125
00126 indirectglossy_refractSampleOffset = sample->Add2D(glossyrefractDepth);
00127 indirectglossy_refractComponentOffset = sample->Add1D(glossyrefractDepth);
00128
00129 }
00130 void DistributedPath::Preprocess(const TsPack *tspack, const Scene *scene)
00131 {
00132
00133 BufferType type = BUF_TYPE_PER_PIXEL;
00134 scene->sampler->GetBufferType(&type);
00135 bufferId = scene->camera->film->RequestBuffer(type, BUF_FRAMEBUFFER, "eye");
00136 }
00137
00138 void DistributedPath::Reject(const TsPack *tspack, vector< vector<SWCSpectrum> > &LL,
00139 vector<SWCSpectrum> &L, float rejectrange) const {
00140 float totallum = 0.f;
00141 float samples = LL.size();
00142 for(int i=0; i<samples; i++)
00143 for(u_int j=0; j<LL[i].size(); j++)
00144 totallum += LL[i][j].Y(tspack) * samples;
00145 float avglum = totallum / samples;
00146
00147 float validlength;
00148 if(avglum > 0.f) {
00149 validlength = avglum * rejectrange;
00150
00151
00152 int rejects = 0;
00153 vector<SWCSpectrum> Lo(L.size(), SWCSpectrum(0.f));
00154 for(int i=0; i<samples; i++) {
00155 float y = 0.f;
00156 for(u_int j=0; j<LL[i].size(); j++) {
00157 y += LL[i][j].Y(tspack) * samples;
00158 }
00159 if(y > avglum + validlength) {
00160 rejects++;
00161 } else {
00162 for(u_int j=0; j<LL[i].size(); j++)
00163 Lo[j] += LL[i][j];
00164 }
00165 }
00166
00167
00168
00169
00170 for(u_int i=0; i<L.size(); i++)
00171 L[i] += Lo[i];
00172 } else {
00173 for(u_int i=0; i<samples; i++)
00174 for(u_int j=0; j<LL[i].size(); j++)
00175 L[j] += LL[i][j];
00176 }
00177 }
00178
00179 void DistributedPath::LiInternal(const TsPack *tspack, const Scene *scene,
00180 const RayDifferential &ray, const Sample *sample,
00181 vector<SWCSpectrum> &L, float *alpha, float *zdepth, int rayDepth,
00182 bool includeEmit, int &nrContribs) const
00183 {
00184 Intersection isect;
00185 const float time = ray.time;
00186
00187 if (scene->Intersect(ray, &isect)) {
00188
00189 BSDF *bsdf = isect.GetBSDF(tspack, ray);
00190 Vector wo = -ray.d;
00191 const Point &p = bsdf->dgShading.p;
00192 const Normal &n = bsdf->dgShading.nn;
00193
00194
00195 if(rayDepth == 0) {
00196 const Vector zv(p - ray.o);
00197 *zdepth = zv.Length();
00198 }
00199
00200
00201
00202
00203
00204
00205
00206
00207 if((bsdf->compParams->tVl && rayDepth == 0) || (bsdf->compParams->tiVl && rayDepth > 0))
00208 if (includeEmit) {
00209 const SWCSpectrum Le(isect.Le(tspack, wo));
00210 if (Le.Filter(tspack) > 0.f) {
00211 L[isect.arealight->group] += Le;
00212 ++nrContribs;
00213 }
00214 }
00215
00216
00217 if(bsdf->compParams->oA && rayDepth == 0)
00218 *alpha = bsdf->compParams->A;
00219
00220
00221 if(!bsdf->compParams->tVm && rayDepth == 0) {
00222
00223 if(bsdf->compParams->oA)
00224 *alpha = bsdf->compParams->A;
00225 else
00226 *alpha = 0.f;
00227 return;
00228 }
00229 if(!bsdf->compParams->tiVm && rayDepth > 0) {
00230
00231 return;
00232 }
00233
00234
00235 if (scene->lights.size() > 0) {
00236 int samples = directSamples;
00237 if (rayDepth > 0) {
00238 samples = indirectSamples;
00239 }
00240 float invsamples = 1.f / samples;
00241 float *lightSample, *lightNum, *bsdfSample, *bsdfComponent;
00242 for (int i = 0; i < samples; ++i) {
00243
00244 if (rayDepth > 0) {
00245 lightSample = &sample->twoD[indirectlightSampleOffset][2 * i * rayDepth];
00246 lightNum = &sample->oneD[indirectlightNumOffset][i * rayDepth];
00247 bsdfSample = &sample->twoD[indirectbsdfSampleOffset][2 * i * rayDepth];
00248 bsdfComponent = &sample->oneD[indirectbsdfComponentOffset][i * rayDepth];
00249 } else {
00250 lightSample = &sample->twoD[lightSampleOffset][2 * i];
00251 lightNum = &sample->oneD[lightNumOffset][i];
00252 bsdfSample = &sample->twoD[bsdfSampleOffset][2 * i];
00253 bsdfComponent = &sample->oneD[bsdfComponentOffset][i];
00254 }
00255
00256
00257 switch (lightStrategy) {
00258 case SAMPLE_ALL_UNIFORM:
00259 for (u_int i = 0; i < scene->lights.size(); ++i) {
00260 const SWCSpectrum Ld(EstimateDirect(tspack, scene, scene->lights[i], p, n, wo, bsdf,
00261 sample, lightSample[0], lightSample[1], *lightNum, bsdfSample[0], bsdfSample[1], *bsdfComponent));
00262 if (Ld.Filter(tspack) > 0.f) {
00263 L[scene->lights[i]->group] += invsamples * Ld;
00264 ++nrContribs;
00265 }
00266
00267 }
00268 break;
00269 case SAMPLE_ONE_UNIFORM:
00270 {
00271 SWCSpectrum Ld;
00272 int g = UniformSampleOneLight(tspack, scene, p, n,
00273 wo, bsdf, sample,
00274 lightSample, lightNum, bsdfSample, bsdfComponent, &Ld);
00275 if (Ld.Filter(tspack) > 0.f) {
00276 L[g] += invsamples * Ld;
00277 ++nrContribs;
00278 }
00279 break;
00280 }
00281 default:
00282 break;
00283 }
00284 }
00285 }
00286
00287 BxDFType flags;
00288 float pdf;
00289 Vector wi;
00290 SWCSpectrum f;
00291 int samples;
00292 float invsamples;
00293
00294
00295 if (rayDepth < diffusereflectDepth) {
00296 if (rayDepth > 0)
00297 samples = 1;
00298 else
00299 samples = diffusereflectSamples;
00300 invsamples = 1.f / samples;
00301
00302 vector< vector<SWCSpectrum> > LL;
00303
00304 for (int i = 0; i < samples; ++i) {
00305 float u1, u2, u3;
00306 if (rayDepth > 0) {
00307 u1 = sample->twoD[indirectdiffuse_reflectSampleOffset][2 * i * rayDepth];
00308 u2 = sample->twoD[indirectdiffuse_reflectSampleOffset][(2 * i * rayDepth) + 1];
00309 u3 = sample->oneD[indirectdiffuse_reflectComponentOffset][i * rayDepth];
00310 } else {
00311 u1 = sample->twoD[diffuse_reflectSampleOffset][2 * i];
00312 u2 = sample->twoD[diffuse_reflectSampleOffset][2 * i + 1];
00313 u3 = sample->oneD[diffuse_reflectComponentOffset][i];
00314 }
00315
00316 if (bsdf->Sample_f(tspack, wo, &wi, u1, u2, u3, &f,
00317 &pdf, BxDFType(BSDF_REFLECTION | BSDF_DIFFUSE), &flags, NULL, true)) {
00318 RayDifferential rd(p, wi);
00319 rd.time = time;
00320 vector<SWCSpectrum> Ll(L.size(), SWCSpectrum(0.f));
00321 LiInternal(tspack, scene, rd, sample, Ll, alpha, zdepth, rayDepth + 1, false, nrContribs);
00322 f *= invsamples * AbsDot(wi, n) / pdf;
00323 if(diffusereflectReject && (rayDepth == 0 || includeEmit)) {
00324 for(u_int j=0; j<Ll.size(); j++) {
00325 Ll[j] *= f;
00326 }
00327 LL.push_back(Ll);
00328 } else {
00329 for(u_int j=0; j<L.size(); j++)
00330 L[j] += f * Ll[j];
00331 }
00332 }
00333 }
00334
00335 if(rayDepth == 0)
00336 Reject(tspack, LL, L, diffusereflectReject_thr);
00337 }
00338 if (rayDepth < diffuserefractDepth) {
00339 if (rayDepth > 0)
00340 samples = 1;
00341 else
00342 samples = diffuserefractSamples;
00343 invsamples = 1.f / samples;
00344
00345 vector< vector<SWCSpectrum> > LL;
00346
00347 for (int i = 0; i < samples; ++i) {
00348 float u1, u2, u3;
00349 if (rayDepth > 0) {
00350 u1 = sample->twoD[indirectdiffuse_refractSampleOffset][2 * i * rayDepth];
00351 u2 = sample->twoD[indirectdiffuse_refractSampleOffset][(2 * i * rayDepth) + 1];
00352 u3 = sample->oneD[indirectdiffuse_refractComponentOffset][i * rayDepth];
00353 } else {
00354 u1 = sample->twoD[diffuse_refractSampleOffset][2 * i];
00355 u2 = sample->twoD[diffuse_refractSampleOffset][2 * i + 1];
00356 u3 = sample->oneD[diffuse_refractComponentOffset][i];
00357 }
00358
00359 if (bsdf->Sample_f(tspack, wo, &wi, u1, u2, u3, &f,
00360 &pdf, BxDFType(BSDF_TRANSMISSION | BSDF_DIFFUSE), &flags, NULL, true)) {
00361 RayDifferential rd(p, wi);
00362 rd.time = time;
00363 vector<SWCSpectrum> Ll(L.size(), SWCSpectrum(0.f));
00364 LiInternal(tspack, scene, rd, sample, Ll, alpha, zdepth, rayDepth + 1, false, nrContribs);
00365 f *= invsamples * AbsDot(wi, n) / pdf;
00366 if(diffuserefractReject && (rayDepth == 0 || includeEmit)) {
00367 for(u_int j=0; j<Ll.size(); j++) {
00368 Ll[j] *= f;
00369 }
00370 LL.push_back(Ll);
00371 } else {
00372 for(u_int j=0; j<L.size(); j++)
00373 L[j] += f * Ll[j];
00374 }
00375 }
00376 }
00377
00378 if(rayDepth == 0)
00379 Reject(tspack, LL, L, diffuserefractReject_thr);
00380 }
00381
00382
00383 if (rayDepth < glossyreflectDepth) {
00384 if (rayDepth > 0)
00385 samples = 1;
00386 else
00387 samples = glossyreflectSamples;
00388 invsamples = 1.f / samples;
00389
00390 vector< vector<SWCSpectrum> > LL;
00391
00392 for (int i = 0; i < samples; ++i) {
00393 float u1, u2, u3;
00394 if (rayDepth > 0) {
00395 u1 = sample->twoD[indirectglossy_reflectSampleOffset][2 * i * rayDepth];
00396 u2 = sample->twoD[indirectglossy_reflectSampleOffset][(2 * i * rayDepth) + 1];
00397 u3 = sample->oneD[indirectglossy_reflectComponentOffset][i * rayDepth];
00398 } else {
00399 u1 = sample->twoD[glossy_reflectSampleOffset][2 * i];
00400 u2 = sample->twoD[glossy_reflectSampleOffset][2 * i + 1];
00401 u3 = sample->oneD[glossy_reflectComponentOffset][i];
00402 }
00403
00404 if (bsdf->Sample_f(tspack, wo, &wi, u1, u2, u3, &f,
00405 &pdf, BxDFType(BSDF_REFLECTION | BSDF_GLOSSY), &flags, NULL, true)) {
00406 RayDifferential rd(p, wi);
00407 rd.time = time;
00408 vector<SWCSpectrum> Ll(L.size(), SWCSpectrum(0.f));
00409 LiInternal(tspack, scene, rd, sample, Ll, alpha, zdepth, rayDepth + 1, false, nrContribs);
00410 f *= invsamples * AbsDot(wi, n) / pdf;
00411 if(glossyreflectReject && (rayDepth == 0 || includeEmit)) {
00412 for(u_int j=0; j<Ll.size(); j++) {
00413 Ll[j] *= f;
00414 }
00415 LL.push_back(Ll);
00416 } else {
00417 for(u_int j=0; j<L.size(); j++)
00418 L[j] += f * Ll[j];
00419 }
00420 }
00421 }
00422
00423 if(rayDepth == 0)
00424 Reject(tspack, LL, L, glossyreflectReject_thr);
00425 }
00426 if (rayDepth < glossyrefractDepth) {
00427 if (rayDepth > 0)
00428 samples = 1;
00429 else
00430 samples = glossyrefractSamples;
00431 invsamples = 1.f / samples;
00432
00433 vector< vector<SWCSpectrum> > LL;
00434
00435 for (int i = 0; i < samples; ++i) {
00436 float u1, u2, u3;
00437 if (rayDepth > 0) {
00438 u1 = sample->twoD[indirectglossy_refractSampleOffset][2 * i * rayDepth];
00439 u2 = sample->twoD[indirectglossy_refractSampleOffset][(2 * i * rayDepth) + 1];
00440 u3 = sample->oneD[indirectglossy_refractComponentOffset][i * rayDepth];
00441 } else {
00442 u1 = sample->twoD[glossy_refractSampleOffset][2 * i];
00443 u2 = sample->twoD[glossy_refractSampleOffset][2 * i + 1];
00444 u3 = sample->oneD[glossy_refractComponentOffset][i];
00445 }
00446
00447 if (bsdf->Sample_f(tspack, wo, &wi, u1, u2, u3, &f,
00448 &pdf, BxDFType(BSDF_TRANSMISSION | BSDF_GLOSSY), &flags, NULL, true)) {
00449 RayDifferential rd(p, wi);
00450 rd.time = time;
00451 vector<SWCSpectrum> Ll(L.size(), SWCSpectrum(0.f));
00452 LiInternal(tspack, scene, rd, sample, Ll, alpha, zdepth, rayDepth + 1, false, nrContribs);
00453 f *= invsamples * AbsDot(wi, n) / pdf;
00454 if(glossyrefractReject && (rayDepth == 0 || includeEmit)) {
00455 for(u_int j=0; j<Ll.size(); j++) {
00456 Ll[j] *= f;
00457 }
00458 LL.push_back(Ll);
00459 } else {
00460 for(u_int j=0; j<L.size(); j++)
00461 L[j] += f * Ll[j];
00462 }
00463 }
00464 }
00465
00466 if(rayDepth == 0)
00467 Reject(tspack, LL, L, glossyrefractReject_thr);
00468 }
00469
00470
00471 if (rayDepth < specularreflectDepth) {
00472 if (bsdf->Sample_f(tspack, wo, &wi, 1.f, 1.f, 1.f, &f,
00473 &pdf, BxDFType(BSDF_REFLECTION | BSDF_SPECULAR), NULL, NULL, true)) {
00474 RayDifferential rd(p, wi);
00475 rd.time = time;
00476 vector<SWCSpectrum> Ll(L.size(), SWCSpectrum(0.f));
00477 LiInternal(tspack, scene, rd, sample, Ll, alpha, zdepth, rayDepth + 1, true, nrContribs);
00478 f *= AbsDot(wi, n);
00479 for (u_int j = 0; j < L.size(); ++j)
00480 L[j] += f * Ll[j];
00481 }
00482 }
00483 if (rayDepth < specularrefractDepth) {
00484 if (bsdf->Sample_f(tspack, wo, &wi, 1.f, 1.f, 1.f, &f,
00485 &pdf, BxDFType(BSDF_TRANSMISSION | BSDF_SPECULAR), NULL, NULL, true)) {
00486 RayDifferential rd(p, wi);
00487 rd.time = time;
00488 vector<SWCSpectrum> Ll(L.size(), SWCSpectrum(0.f));
00489 LiInternal(tspack, scene, rd, sample, Ll, alpha, zdepth, rayDepth + 1, true, nrContribs);
00490 f *= AbsDot(wi, n);
00491 for (u_int j = 0; j < L.size(); ++j)
00492 L[j] += f * Ll[j];
00493 }
00494 }
00495
00496 } else {
00497
00498 for (u_int i = 0; i < scene->lights.size(); ++i) {
00499 const SWCSpectrum Le(scene->lights[i]->Le(tspack, ray));
00500 if (Le.Filter(tspack) > 0.f) {
00501 L[scene->lights[i]->group] += Le;
00502 ++nrContribs;
00503 }
00504 }
00505 if (rayDepth == 0)
00506 *alpha = 0.f;
00507 }
00508
00509 SWCSpectrum Lt(1.f);
00510 scene->volumeIntegrator->Transmittance(tspack, scene, ray, sample, alpha, &Lt);
00511 for (u_int i = 0; i < L.size(); ++i)
00512 L[i] *= Lt;
00513 SWCSpectrum Lv(0.f);
00514 int g = scene->volumeIntegrator->Li(tspack, scene, ray, sample, &Lv, alpha);
00515 L[g] += Lv;
00516 }
00517
00518 int DistributedPath::Li(const TsPack *tspack, const Scene *scene,
00519 const Sample *sample) const
00520 {
00521 int nrContribs = 0;
00522 float zdepth = 0.f;
00523 RayDifferential ray;
00524 float rayWeight = tspack->camera->GenerateRay(*sample, &ray);
00525 if (rayWeight > 0.f) {
00526
00527 ++(sample->imageX);
00528 float wt1 = tspack->camera->GenerateRay(*sample, &ray.rx);
00529 --(sample->imageX);
00530 ++(sample->imageY);
00531 float wt2 = tspack->camera->GenerateRay(*sample, &ray.ry);
00532 ray.hasDifferentials = (wt1 > 0.f) && (wt2 > 0.f);
00533 --(sample->imageY);
00534 }
00535
00536 vector<SWCSpectrum> L(scene->lightGroups.size(), SWCSpectrum(0.f));
00537 float alpha = 1.f;
00538 LiInternal(tspack, scene, ray, sample, L, &alpha, &zdepth, 0, true, nrContribs);
00539
00540 for (u_int i = 0; i < L.size(); ++i)
00541 sample->AddContribution(sample->imageX, sample->imageY,
00542 L[i].ToXYZ(tspack) * rayWeight, alpha, zdepth, bufferId, i);
00543
00544 return nrContribs;
00545 }
00546
00547 SurfaceIntegrator* DistributedPath::CreateSurfaceIntegrator(const ParamSet ¶ms) {
00548
00549
00550 bool directall = params.FindOneBool("directsampleall", true);
00551 int directsamples = params.FindOneInt("directsamples", 1);
00552 bool directdiffuse = params.FindOneBool("directdiffuse", true);
00553 bool directglossy = params.FindOneBool("directglossy", true);
00554
00555 bool indirectall = params.FindOneBool("indirectsampleall", false);
00556 int indirectsamples = params.FindOneInt("indirectsamples", 1);
00557 bool indirectdiffuse = params.FindOneBool("indirectdiffuse", true);
00558 bool indirectglossy = params.FindOneBool("indirectglossy", true);
00559
00560
00561 int diffusereflectdepth = params.FindOneInt("diffusereflectdepth", 3);
00562 int diffusereflectsamples = params.FindOneInt("diffusereflectsamples", 1);
00563 int diffuserefractdepth = params.FindOneInt("diffuserefractdepth", 5);
00564 int diffuserefractsamples = params.FindOneInt("diffuserefractsamples", 1);
00565
00566 int glossyreflectdepth = params.FindOneInt("glossyreflectdepth", 2);
00567 int glossyreflectsamples = params.FindOneInt("glossyreflectsamples", 1);
00568 int glossyrefractdepth = params.FindOneInt("glossyrefractdepth", 5);
00569 int glossyrefractsamples = params.FindOneInt("glossyrefractsamples", 1);
00570
00571 int specularreflectdepth = params.FindOneInt("specularreflectdepth", 2);
00572 int specularrefractdepth = params.FindOneInt("specularrefractdepth", 5);
00573
00574 LightStrategy estrategy;
00575 string st = params.FindOneString("strategy", "auto");
00576 if (st == "one") estrategy = SAMPLE_ONE_UNIFORM;
00577 else if (st == "all") estrategy = SAMPLE_ALL_UNIFORM;
00578 else if (st == "auto") estrategy = SAMPLE_AUTOMATIC;
00579 else {
00580 std::stringstream ss;
00581 ss<<"Strategy '"<<st<<"' for direct lighting unknown. Using \"auto\".";
00582 luxError(LUX_BADTOKEN,LUX_WARNING,ss.str().c_str());
00583 estrategy = SAMPLE_AUTOMATIC;
00584 }
00585
00586
00587 bool diffusereflectreject = params.FindOneBool("diffusereflectreject", false);
00588 float diffusereflectreject_thr = params.FindOneFloat("diffusereflectreject_threshold", 10.0f);
00589 bool diffuserefractreject = params.FindOneBool("diffuserefractreject", false);;
00590 float diffuserefractreject_thr = params.FindOneFloat("diffuserefractreject_threshold", 10.0f);
00591 bool glossyreflectreject = params.FindOneBool("glossyreflectreject", false);;
00592 float glossyreflectreject_thr = params.FindOneFloat("glossyreflectreject_threshold", 10.0f);
00593 bool glossyrefractreject = params.FindOneBool("glossyrefractreject", false);;
00594 float glossyrefractreject_thr = params.FindOneFloat("glossyrefractreject_threshold", 10.0f);
00595
00596 return new DistributedPath(estrategy, directall, directsamples,
00597 directdiffuse, directglossy, indirectall, indirectsamples, indirectdiffuse, indirectglossy,
00598 diffusereflectdepth, diffusereflectsamples, diffuserefractdepth, diffuserefractsamples, glossyreflectdepth, glossyreflectsamples,
00599 glossyrefractdepth, glossyrefractsamples, specularreflectdepth, specularrefractdepth,
00600 diffusereflectreject, diffusereflectreject_thr, diffuserefractreject, diffuserefractreject_thr,
00601 glossyreflectreject, glossyreflectreject_thr, glossyrefractreject, glossyrefractreject_thr);
00602 }
00603
00604 static DynamicLoader::RegisterSurfaceIntegrator<DistributedPath> r("distributedpath");