Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You've described what needs to be done quite well already. Your field of view is determined by the distance between your camera and your "film" that you're going to cast your rays through. The further away the camera is from the film, the narrower your field of view is.</p> <p>Imagine the film as a bitmap image that the camera is pointing to. Say we position the camera one unit away from the bitmap. We then have to cast a ray though each of the bitmap's pixels.</p> <p>The vector is extremely simple. If we put the camera location to (0,0,0), and the bitmap film right in front of it with it's center at (0,0,1), then the ray to the bottom right is - tada - (1,1,1), and the one to the bottom left is (-1,1,1).</p> <p>That means that the difference between the bottom right and the bottom left is (2,0,0).</p> <p>Assume that your horizontal bitmap resolution should be 1000, then you can iterate through the bottom line pixels as follows:</p> <pre><code>width = 1000; cameraToBottomLeft = (-1,1,1); bottomLeftToBottomRight = (2,0,0); for (x = 0; x &lt; width; x++) { ray = cameraToBottomLeft + (x/width) * bottomLeftToBottomRight; ... } </code></pre> <p>If that's clear, then you just add an equivalent outer loop for your lines, and you have all the rays that you will need. </p> <p>You can then add appropriate variables for the distance of the camera to the film and horizontal and vertical resolution. When that's done, you could start changing your look vector and your up vector with matrix transformations.</p> <p>If you want to wrap your head around computer graphics, an <a href="http://www.amazon.com/s/ref=nb_ss?url=search-alias%3Dstripbooks&amp;field-keywords=Computer+Graphics&amp;x=14&amp;y=19" rel="nofollow noreferrer">introductory textbook</a> could be of great help. I used <a href="http://rads.stackoverflow.com/amzn/click/0201848406" rel="nofollow noreferrer">this one</a> in college, and I think I liked it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload