Skip to content

Commit

Permalink
Fixed per pixel normal correction.
Browse files Browse the repository at this point in the history
  • Loading branch information
ponchio committed Nov 19, 2024
1 parent f5d0311 commit 63291c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion relight/normalstask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void NormalsWorker::solveL2()

if(m_Imageset.light3d) {
for(size_t i = 0; i < m_Lights3d.size(); i++) {
Vector3f light = m_Imageset.relativeLight(m_Lights3d[i], p, row);
Vector3f light = m_Imageset.relativeLight(m_Lights3d[i], p, m_Imageset.height - row);
light.normalize();
for (int j = 0; j < 3; j++)
mLights(i, j) = light[j];
Expand Down
7 changes: 6 additions & 1 deletion src/lens.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ class Lens {
Vector3f viewDirection(float x, float y) {
if(!focalLength)
return Vector3f(0, 0, -1);
float focal = focalLength;
if(focal35equivalent) {
double w = pixelSizeX * width;
focal = focalLength * w / 35;
}
x -= width/2;
y -= height/2;
return Vector3f(x*pixelSizeX, -y*pixelSizeY, -focalLength);
return Vector3f(x*pixelSizeX, -y*pixelSizeY, -focal);
}

double ccdWidth() {
Expand Down

0 comments on commit 63291c1

Please sign in to comment.