0
\$\begingroup\$

I'm new to CG and I'm building a ray tracer.

I don't quite understand how to set camera parameters and film(pixel plane) parameters.

Say I want to get an image of 400x300 resolution. I can set an fov, and then the distance between the film and camera can be calculated.

If that's true, a high resolution and a "reasonable" fov, e.g 80 degree, will result in a large distance. Does that makes the object small on the final image?

And I feel like people like to determine resolution at first, in order to get an expected image size. To avoid distortion of objects(fish eye), the fov cannot be too large.

So how do I get close look of an object on a high resolution image?

I think the rasterization way is different from ray tracing one since I can project an object into NDC(normalized device coordinate) to make it big, but what about ray tracers?

\$\endgroup\$
  • \$\begingroup\$ There seems to be a lot of questions packed into one here. Consider shortening to only contain one question and it will be more clear how to help you. \$\endgroup\$ – Charanor Sep 18 '17 at 16:03
  • 1
    \$\begingroup\$ It sounds like you're assuming that "pixels" have some fixed size in your virtual world. So if you double the size of your output image, then the rectangle of your image plane has to get bigger to fit all those pixels, which means it needs to move further away from the camera to maintain the same FoV. Is that accurate? It's more conventional to treat the distance between the image plane and the camera as an arbitrary constant, and the size of the pixels in the world (to the extent that this is even a thing — usually we don't use this) shrinks as we increase the resolution of the output image. \$\endgroup\$ – DMGregory Sep 20 '17 at 2:26
  • \$\begingroup\$ @DMGregory So you mean I can set a fixed distance and a fixed FOV, and assume that the size of the image plane is therefore fixed. And the resolution is independent from the image plane size. I can understand this, but how to implement it? I mean, in a ray tracer, I don't really have a "rasterization" process, so when I do ray casting, every sample on the image plane is mapped exactly to a pixel on my final image? \$\endgroup\$ – jinglei Sep 20 '17 at 5:48
  • 1
    \$\begingroup\$ That mapping is your rasterization process. The stride between each ray you fire corresponds to your pixel density (ignoring supersampling or non-uniform sampling for the moment). So for a higher res image, you're tracing more rays, with smaller gaps between them, all other parameters remaining equal. \$\endgroup\$ – DMGregory Sep 20 '17 at 10:36
1
\$\begingroup\$

When you read "FOV", think "zoom". Decreasing the field of view is like zooming into the center of an image. When you decrease the FOV-angle, anything still in the field of view will appear larger and more detailed.

\$\endgroup\$
  • \$\begingroup\$ Thanks. But if I calculate image size with given distance and FOV, h = 2d*(atan(fov/2)), when FOV decreases, the image size also gets decrease. I even can't see the whole object. And since the image size decreases, the number of pixels also decreases(so number of rays is fewer and samples on the object are fewer), why the object appears more detailed? \$\endgroup\$ – jinglei Sep 19 '17 at 0:59
  • \$\begingroup\$ @Jinglei.Y Where did you get that formula from? Usually you have a fixed image width and height and use the FOV angle to calculate the direction-vectors for the individual rays. \$\endgroup\$ – Philipp Sep 19 '17 at 8:33
  • \$\begingroup\$ As I mentioned in the question detail, this is where I'm confused. If I have fixed width and height in the first place, given a FOV value, I think I can derive the distance between camera and the image plane. And a large image size coupled with a reasonable FOV, may results in a large distance. Does that make sense? \$\endgroup\$ – jinglei Sep 19 '17 at 8:46
  • \$\begingroup\$ @Jinglei.Y What do you mean with "distance" in the second to last sentence of the above comment? Maximum distance your rays travel? Distance between camera and near-plane? horizontal/vertical distance depicted at a given depth? \$\endgroup\$ – Philipp Sep 19 '17 at 8:53
  • \$\begingroup\$ I think it's the distance between camera and near-plane. BTW, does "near plane" and "far plane" exist when talking about ray tracers? I think "near plane" and "far plane" are used to get the "clip coordinate" and do projection to the NDC. But I think ray tracers are totally different from the rasterization pipeline, so we actually only have one plane, i.e. the near plane, which is the "film/image plane" in my description. \$\endgroup\$ – jinglei Sep 19 '17 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.