Replies: 4 comments 6 replies
-
As presented above, your focus distance is derived from the look-from and look-at points. However, you don't need to make your focus distance dependent on these two parameters. Instead, set the focus distance independently to the distance between the camera "from" point and the focus plane (parallel to the image plane) that you want. If you don't want to go through the math, you can zero in iteratively with different focus distances (like fiddling with the focus ring on your physical camera). |
Beta Was this translation helpful? Give feedback.
-
if i use this code: point3 lookfrom(480, 250, -600); I don't get the desired result because the whole scene is blurred. I want only one object to be in focus with the rest of the scene out of focus. what am I doing wrong? |
Beta Was this translation helpful? Give feedback.
-
Ah, I made a mistake. cosθ = adjacent / hypotenuse = d/b. So
|
Beta Was this translation helpful? Give feedback.
-
Well, you could try reverse-engineering it. Did you try a search for values to see which one gets you the result you're looking for? |
Beta Was this translation helpful? Give feedback.
-
I replicated the code from the second book. I would like to focus on a single object of the scene, as was the case in the first book with the three spheres.
How do I focus on a single area like the one highlighted in yellow in the following figure?
the relative code is:
` const auto aspect_ratio = 1.0;
const int image_width = 400;
const int image_height = static_cast(image_width / aspect_ratio);
const int samples_per_pixel = 100;
const int max_depth = 10;
point3 lookfrom(480, 250, -600);
point3 lookat(200, 280, 300);
vec3 vup(0, 1, 0);
double vfov = 40;
auto dist_to_focus = (lookfrom - lookat).length();
auto aperture = 0.2; `
thank you for the support, best regards.
Beta Was this translation helpful? Give feedback.
All reactions