diff --git a/src/common/camera.cpp b/src/common/camera.cpp index d7951ee..a2eec62 100644 --- a/src/common/camera.cpp +++ b/src/common/camera.cpp @@ -11,7 +11,7 @@ Camera createCamera( const float aspectRatio) { const float theta = vfov.as_radians(); - const float halfHeight = glm::tan(0.5f * theta); + const float halfHeight = focusDistance * glm::tan(0.5f * theta); const float halfWidth = aspectRatio * halfHeight; const glm::vec3 w = glm::normalize(lookAt - origin); diff --git a/src/pt/fly_camera_controller.cpp b/src/pt/fly_camera_controller.cpp index 5f2a515..df95a09 100644 --- a/src/pt/fly_camera_controller.cpp +++ b/src/pt/fly_camera_controller.cpp @@ -121,7 +121,7 @@ glm::vec3 FlyCameraController::generateCameraRayDir( const MousePos& pos) const { const float aspect = aspectRatio(mWindowSize); - const float halfHeight = std::tan(0.5f * mVfov.as_radians()); + const float halfHeight = mFocusDistance * std::tan(0.5f * mVfov.as_radians()); const float halfWidth = aspect * halfHeight; // UV coordinates in [0, 1] range with (0, 0) in the top-left corner. diff --git a/src/pt/main.cpp b/src/pt/main.cpp index 666aacc..fcf70fc 100644 --- a/src/pt/main.cpp +++ b/src/pt/main.cpp @@ -54,7 +54,7 @@ int main() { pt::Extent2i curFramebufferSize = window.resolution(); - float vfovDegrees = 80.0f; + float vfovDegrees = 70.0f; while (!glfwWindowShouldClose(window.ptr())) { glfwPollEvents();