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 4258244
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:37:23+00:00 2026-05-21T05:37:23+00:00

Assume that the camera is located at (0,0,1) point looking into the origin. -z

  • 0

Assume that the camera is located at (0,0,1) point looking into the origin. -z direction is going into the screen. Objects beyond z = -100 are not visible ( far viewing plane). At the far viewing plane x and y are clipped at 100 at right and -100 at left for x-axis and likewise for y-axis.

The viewport window is 600 pixel wide and 300 pixel height. On the 2d pixel coordinates (x2d, y2d), (0,0) is the top left corner, x2d increases to right and y2d increases going downward.

Given above parameters, what are the formulas that calculates (x2d,y2d) given a point (x,y,z)? Each 3d point maps to a pixel unless 3d point is clipped ( not visible in the viewport).
Assume perspective projection.

Please don’t provide a link that talks about the theory of 3d projections. I am looking for specific solution to this specific problem with the given parameters.

  • 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-05-21T05:37:24+00:00Added an answer on May 21, 2026 at 5:37 am

    If all you want to do is find 2D screen locations from 3D locations its easy if you know similar triangles. No triggers are required. just make up some variable that is about the distance in pixels out of the screen to your eyes – call that the focal_length. You can adjust that figure to make it look more realistic (too low looks really stretchy)

    This solution is for looking forward in x, looking backwards just needs and extra line to negative the z which is just needless complexity in my humble opinion but i don’t know your purpose.

    first clip out pixels outside of your range (just use a couple of if statements. I’m not gonna pseudocode that out)

    then position yourself in the 3D world:

    x0 = x - yourx
    y0 = y - youry
    z0 = z - yourz
    

    (in your example yourx = 0, youry = 0, yourz = -1)

    Then project away:

    x2d = focal_length * x0 / z0
    y2d = focal_length * y0 / z0
    

    Simple huh? I just made this up by thinking about train tracks and am now trying to make a basic 3d game 😉

    If you want to get into the math of 3D rotation or hiding faces etc… that’s when things gets … tricky.

    By the way depending on how your screen coordinates are, you might need negative signs on one or the other or both of x2d or y2d equations. Meh you figure it out.

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

Sidebar

Related Questions

No related questions found

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.