Skip to content

Commit aa56251

Browse files
committed
Fix: near clamping ignored in shadow ray check during light-eye connection.
This issue was introduced as a side-effect of commit aac4031
1 parent 662e612 commit aa56251

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/slg/engines/bidircpu/bidircputhread.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,19 +372,22 @@ void BiDirCPURenderThread::ConnectToEye(const float time,
372372
0.f,
373373
eyeDistance,
374374
time);
375+
// Do not clamp the ray here because of the check inside ProjectToImage
375376
sampleSuccess = scene.GetCamera().ProjectToImage(&eyeRay, &filmX, &filmY);
376377
} else {
377378
eyeRay = Ray(lensPoint, eyeDir,
378379
0.f,
379380
eyeDistance,
380381
time);
382+
// Do not clamp the ray here because of the check inside GetSamplePosition
381383
sampleSuccess = scene.GetCamera().GetSamplePosition(&eyeRay, &filmX, &filmY);
382384
}
383385
if (sampleSuccess) {
384386
// I have to flip the direction of the traced ray because
385387
// the information inside PathVolumeInfo are about the path from
386388
// the light toward the camera (i.e. ray.o would be in the wrong
387389
// place).
390+
scene.GetCamera().ClampRay(&eyeRay); // Clamp the ray here (see comment above)
388391
Ray traceRay(lightVertex.bsdf.GetRayOrigin(-eyeRay.d), -eyeRay.d,
389392
eyeDistance - eyeRay.maxt,
390393
eyeDistance - eyeRay.mint,

src/slg/engines/pathtracer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ void PathTracer::ConnectToEye(IntersectionDevice *device,
734734
0.f,
735735
eyeDistance,
736736
time);
737+
// Do not clamp the ray here because of the check inside ProjectToImage
737738
sampleSuccess = scene.GetCamera().ProjectToImage(&eyeRay, &filmX, &filmY);
738739
} else {
739740
eyeDir = Vector(bsdf.hitPoint.p - lensPoint);
@@ -744,6 +745,7 @@ void PathTracer::ConnectToEye(IntersectionDevice *device,
744745
0.f,
745746
eyeDistance,
746747
time);
748+
// Do not clamp the ray here because of the check inside GetSamplePosition
747749
sampleSuccess = scene.GetCamera().GetSamplePosition(&eyeRay, &filmX, &filmY);
748750
}
749751

@@ -756,6 +758,7 @@ void PathTracer::ConnectToEye(IntersectionDevice *device,
756758
// the information inside PathVolumeInfo are about the path from
757759
// the light toward the camera (i.e. ray.o would be in the wrong
758760
// place).
761+
scene.GetCamera().ClampRay(&eyeRay); // Clamp the ray here (see comment above)
759762
Ray traceRay(bsdf.GetRayOrigin(-eyeRay.d), -eyeRay.d,
760763
eyeDistance - eyeRay.maxt,
761764
eyeDistance - eyeRay.mint,

0 commit comments

Comments
 (0)