Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8741775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:22:36+00:00 2026-06-13T11:22:36+00:00

I am currently working on ray-tracing techniques and I think I’ve made a pretty

  • 0

I am currently working on ray-tracing techniques and I think I’ve made a pretty good job; but, I haven’t covered camera yet.

Until now, I used a plane fragment for view plane which is located between (-width/2, height/2, 200) and (width/2, -height/2, 200) [200 is just a fixed number of z, can be changed].

Addition to that, I use the camera mostly on e(0, 0, 1000), and I use a perspective projection.

I send rays from point e to pixels, and print it to image’s corresponding pixel after calculating the pixel color.enter image description here

Here is a image I created. Hopefully you can guess where eye and view plane are by looking at the image.

My question starts from here. It’s time to move my camera around, but I don’t know how to map 2D view plane coordinates to the canonical coordinates. Is there a transformation matrix for that?

The method I think requires to know the 3D coordinates of pixels on view plane. I am not sure it’s the right method to use. So, what do you suggest?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:22:37+00:00Added an answer on June 13, 2026 at 11:22 am

    There are a variety of ways to do it. Here’s what I do:

    1. Choose a point to represent the camera location (camera_position).
    2. Choose a vector that indicates the direction the camera is looking (camera_direction). (If you know a point the camera is looking at, you can compute this direction vector by subtracting camera_position from that point.) You probably want to normalize (camera_direction), in which case it’s also the normal vector of the image plane.
    3. Choose another normalized vector that’s (approximately) “up” from the camera’s point of view (camera_up).
    4. camera_right = Cross(camera_direction, camera_up)
    5. camera_up = Cross(camera_right, camera_direction) (This corrects for any slop in the choice of “up”.)

    Visualize the “center” of the image plane at camera_position + camera_direction. The up and right vectors lie in the image plane.

    You can choose a rectangular section of the image plane to correspond to your screen. The ratio of the width or height of this rectangular section to the length of camera_direction determines the field of view. To zoom in you can increase camera_direction or decrease the width and height. Do the opposite to zoom out.

    So given a pixel position (i, j), you want the (x, y, z) of that pixel on the image plane. From that you can subtract camera_position to get a ray vector (which then needs to be normalized).

    Ray ComputeCameraRay(int i, int j) {
      const float width = 512.0;  // pixels across
      const float height = 512.0;  // pixels high
      double normalized_i = (i / width) - 0.5;
      double normalized_j = (j / height) - 0.5;
      Vector3 image_point = normalized_i * camera_right +
                            normalized_j * camera_up +
                            camera_position + camera_direction;
      Vector3 ray_direction = image_point - camera_position;
      return Ray(camera_position, ray_direction);
    }
    

    This is meant to be illustrative, so it is not optimized.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on my ray-tracer and I think I've made some significant achievements.
Currently working with Oracle, but will also need a solution for MS SQL. I
Im currently working on making a flash platformer engine...but my collision detect needs some
Im currently working on a RTX/Janrain integration with bbPress, but im stuck with a
Currently working on a pretty basic hosted PHP app which I'm in the process
I'm currently working on a ray-tracer in C# as a hobby project. I'm trying
Im currently working on a timer app similar to apple's default Clock utility but
Currently working on rails 3. I made changes in my css file to add
I'm sorry, but I haven't been able to find a working solution from any
Currently working with converting SQLException error messages into messages that are more useful for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.