美文网首页
Ray-Tracing: Generating Camera R

Ray-Tracing: Generating Camera R

作者: kkjusdoit | 来源:发表于2022-09-06 17:57 被阅读0次

    raster space 光栅空间
    (the point coordinates are expressed in pixels with coordinates(0,0) being the top-left corder of the frame)
    is a two-dimensional pixel location on the screen bounded by (0, 0) in the lower left corner of the image, and the rendered image resolution.
    The center of the pixel in the lower left corner of raster space has the coordinates (0.5, 0.5).

    NDC space
    in ray-tracing (0,0) top-left range(0, 1) is different than NDC space in the rasterization world where it generally maps to the range [-1,1])

    screen space 屏幕空间
    is defined such that (-1, -1/a) is in the lower left corner of the screen and (1, 1/a) is in the upper right, where a is the aspect ratio of the screen (the relation between its width and height).

    world space 世界空间
    (is basically the space in which all objects of the scene, the geometry, the lights and the cameras have their coordinates expressed into)

    we know:
    1. the image plane is located exactly one unit away from the world origin and aligned along the negative z axis.
    2. the image is square therefore the portion of the image plane on which the image is projected is also necessarily square( the dimension of this projection area is 2 by 2 units )

    find a relation between
    the coordinates of these pixels in raster space
    and
    the coordinates of the same pixels but expressed in world space.

    steps:
    1.normalize this pixel position using the frame's dimensions(raster space --> NDC space)
    (NDC space in ray-tracing is different than NDC space in the rasterization world where it generally maps to the range [-1,1])
    2.NDC --> screen space(consider ImageAspectRatio)
    3.account for the field of view.

    Figure 5: converting the coordinate of a point in the middle of a pixel to world coordinates requires a few steps. The coordinates of this point are first expressed in raster space (the pixels coordinate plus an offset of 0.5), then converted to NDC space (the coordinates are remapped to the range [0,1]) then converted to screen space (the NDC coordinates are remapped to the [-1,1]). Applying the final camera-to-world transformation 4x4 matrix transform the coordinates in screen space to world space.

    参考链接:https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-generating-camera-rays/generating-camera-rays

    相关文章

      网友评论

          本文标题:Ray-Tracing: Generating Camera R

          本文链接:https://www.haomeiwen.com/subject/dewgnrtx.html