MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / RenderEyeSample

Method RenderEyeSample

src/slg/engines/pathtracer.cpp:303–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303void PathTracer::RenderEyeSample(IntersectionDevice *device, const Scene *scene, const Film *film,
304 Sampler *sampler, vector<SampleResult> &sampleResults) const {
305 SampleResult &sampleResult = sampleResults[0];
306
307 // Set to 0.0 all result colors
308 sampleResult.emission = Spectrum();
309 for (u_int i = 0; i < sampleResult.radiance.size(); ++i)
310 sampleResult.radiance[i] = Spectrum();
311 sampleResult.directDiffuse = Spectrum();
312 sampleResult.directGlossy = Spectrum();
313 sampleResult.indirectDiffuse = Spectrum();
314 sampleResult.indirectGlossy = Spectrum();
315 sampleResult.indirectSpecular = Spectrum();
316 sampleResult.directShadowMask = 1.f;
317 sampleResult.indirectShadowMask = 1.f;
318 sampleResult.irradiance = Spectrum();
319 sampleResult.albedo = Spectrum();
320 sampleResult.passThroughPath = true;
321 sampleResult.specularGlossyCausticPath = true;
322
323 // To keep track of the number of rays traced
324 const double deviceRayCount = device->GetTotalRaysCount();
325
326 Ray eyeRay;
327 PathVolumeInfo volInfo;
328 GenerateEyeRay(scene->camera, film, eyeRay, volInfo, sampler, sampleResult);
329 // This is used by light strategy
330 Normal lastNormal(eyeRay.d);
331 bool lastFromVolume = false;
332
333 bool photonGIShowIndirectPathMixUsed = false;
334 bool photonGICausticCacheAlreadyUsed = false;
335 bool photonGICacheEnabledOnLastHit = false;
336 bool albedoToDo = true;
337 BSDFEvent lastBSDFEvent = SPECULAR; // SPECULAR is required to avoid MIS
338 float lastPdfW = 1.f;
339 float lastGlossiness = 0.f;
340 Spectrum pathThroughput(1.f);
341 PathDepthInfo depthInfo;
342 BSDF bsdf;
343 for (;;) {
344 sampleResult.firstPathVertex = (depthInfo.depth == 0);
345 const u_int sampleOffset = eyeSampleBootSize + depthInfo.depth * eyeSampleStepSize;
346
347 RayHit eyeRayHit;
348 Spectrum connectionThroughput;
349 const float passThrough = sampler->GetSample(sampleOffset);
350 const bool hit = scene->Intersect(device, false, sampleResult.firstPathVertex,
351 &volInfo, passThrough,
352 &eyeRay, &eyeRayHit, &bsdf, &connectionThroughput,
353 &pathThroughput, &sampleResult);
354 pathThroughput *= connectionThroughput;
355 // Note: pass-through check is done inside Scene::Intersect()
356
357 if (!hit) {
358 // Nothing was hit, look for env. lights
359 if ((!forceBlackBackground || !sampleResult.passThroughPath) &&
360 (!hybridBackForwardEnable || (depthInfo.depth <= 1) ||

Callers 5

RenderThreadImplMethod · 0.80
RenderThreadImplMethod · 0.80
RTRenderFuncMethod · 0.80
RenderFuncMethod · 0.80
RenderFuncMethod · 0.80

Calls 15

GenerateEyeRayFunction · 0.85
isnanFunction · 0.85
isinfFunction · 0.85
IsAlbedoEndPointMethod · 0.80
GetMaterialIDMethod · 0.80
GetObjectIDMethod · 0.80
IsLastPathVertexMethod · 0.80
GetDebugTypeMethod · 0.80
GetIndirectRadianceMethod · 0.80
GetCausticRadianceMethod · 0.80

Tested by

no test coverage detected