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

  • Home
  • SEARCH
  • 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 8099701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:29:49+00:00 2026-06-05T22:29:49+00:00

I’ve completely stuck with camera in ray tracing. Please, take a look at my

  • 0

I’ve completely stuck with camera in ray tracing. Please, take a look at my calculations and point me out where is the error. I’m using left handed coordinate system.

x,y // range [0..S) x [0..S) //pixels coordinates

Now, let’s transform pixels coordinates to parametric coordinates of camera plane:

xp = x/S * 2 – 1; 
yp = y/S * 2 – 1;

xp, yp // range [-1..1] x [-1..1]

calculation of camera basis:

//eye - camera position
//up - camera up vector
//look_at - camera target point

vec3 w = normalize(look_at-eye);
vec3 u = cross(up,w);
vec3 v = cross(w,u);

so ray direction should have following coordinates:

vec3 dir = look_at – eye + xp*u + yp*v;
ray3 ray = {eye, normalize(dir)};
  • 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-05T22:29:51+00:00Added an answer on June 5, 2026 at 10:29 pm

    I think the mistake is here:

    vec3 dir = look_at – eye + xp*u + yp*v;
    

    The image plane should have a normal vector w, and either be between the eye and the look at point (the more common way in ray tracers), or be behind the eye (more closely models an actual pinhole camera). So let’s create a scalar zoom_factor. A positive number will put the plane in front of the eye, and a negative one will put it behind the eye (and flip the image).

    The center of the image plane is thus:

    eye + zoom_factor*w
    

    A point (xp, yp) on the image plane is thus:

    eye + zoom_factor*w + xp*u + yp*v
    

    Now you want the direction to be from the eye to this point on this image plane:

    vec3 dir = eye + zoom_factor*w + xp*u + yp*v - eye;
    

    The eyes cancel, so it simplifies to:

    vec3 dir = zoom_factor*w + xp*u + yp*v
    

    This assumes xp an yp are each in a range like (-0.5, 0.5). Note that (0, 0) is the middle of the image plane with this arrangement.

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

Sidebar

Related Questions

I'm completely stuck on this error. Using Rails 3.1 trying to implement Formastic Bootstrap
I am completely stuck with this: I start out with a flat file type
I'm completely stuck . I'm testing MetaTrader API and getting next error when tries
OK, I'm completely stuck. I'm really hoping that someone out there might have experience
Still completely stuck with regex's and square brackets. Hopefully someone can help me out.
I'm completely stuck and need your help... I've created a webservice stub with jaxb
I'm completely stuck with calling a method from a UIView subclass, the method just
So I haven't been doing this for long but I'm completely stuck on this.
I am completely stuck on this issue so your help is greatly appreciated! I
Hej folks, I'm currently completely stuck with the following and don't even have the

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.