Skip to content

Commit

Permalink
Fix (for real this time) buggy ProjectionLight cosTotalWidth initiali…
Browse files Browse the repository at this point in the history
…zation
  • Loading branch information
mmp committed Jun 18, 2018
1 parent e077418 commit 095f6fd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/lights/projection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ ProjectionLight::ProjectionLight(const Transform &LightToWorld,
yon = 1e30f;
lightProjection = Perspective(fov, hither, yon);

// Compute cosine of cone surrounding projection directions
// Distance from origin to a corner of the screen window.
Float h = (screenBounds.pMin.x * screenBounds.pMin.x +
screenBounds.pMin.y * screenBounds.pMin.y + 1);
cosTotalWidth = 1 / h;
Transform screenToLight = Inverse(lightProjection);
Point3f pCorner(screenBounds.pMax.x, screenBounds.pMax.y, 0);
Vector3f wCorner = Normalize(Vector3f(screenToLight(pCorner)));
cosTotalWidth = wCorner.z;
}

Spectrum ProjectionLight::Sample_Li(const Interaction &ref, const Point2f &u,
Expand Down

0 comments on commit 095f6fd

Please sign in to comment.