Skip to content

Commit 82208c1

Browse files
committed
Solve small vertical FOV issue
1 parent 23b3364 commit 82208c1

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/common/camera.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Camera createCamera(
1111
const float aspectRatio)
1212
{
1313
const float theta = vfov.as_radians();
14-
const float halfHeight = glm::tan(0.5f * theta);
14+
const float halfHeight = focusDistance * glm::tan(0.5f * theta);
1515
const float halfWidth = aspectRatio * halfHeight;
1616

1717
const glm::vec3 w = glm::normalize(lookAt - origin);

src/pt/fly_camera_controller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ glm::vec3 FlyCameraController::generateCameraRayDir(
121121
const MousePos& pos) const
122122
{
123123
const float aspect = aspectRatio(mWindowSize);
124-
const float halfHeight = std::tan(0.5f * mVfov.as_radians());
124+
const float halfHeight = mFocusDistance * std::tan(0.5f * mVfov.as_radians());
125125
const float halfWidth = aspect * halfHeight;
126126

127127
// UV coordinates in [0, 1] range with (0, 0) in the top-left corner.

src/pt/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ int main()
5454

5555
{
5656
pt::Extent2i curFramebufferSize = window.resolution();
57-
float vfovDegrees = 80.0f;
57+
float vfovDegrees = 70.0f;
5858
while (!glfwWindowShouldClose(window.ptr()))
5959
{
6060
glfwPollEvents();

0 commit comments

Comments
 (0)