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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:03:35+00:00 2026-05-12T05:03:35+00:00

Since I was 13 and playing around with AMOS 3D I’ve been wanting to

  • 0

Since I was 13 and playing around with AMOS 3D I’ve been wanting to learn how to code 3D graphics. Now, 10 years later, I finally think I have have accumulated enough maths to give it a go.

I have followed various tutorials, and defined screenX (and screenY, equivalently) as

screenX = (pointX * cameraX) / distance

(Plus offsets and scaling.)

My problem is with what the distance variable actually refers to. I have seen distance being defined as the difference in z between the camera and the point. However, that cannot be completely right though, since x and y have the same effect as z on the actual distance from the camera to the point. I implemented distance as the actual distance, but the result gives a somewhat skewed perspective, as if it had “too much” perspective.

My “actual distance” implementation was along the lines of:

distance = new Vector(pointX, pointY, cameraZ - pointZ).magnitude()

Playing around with the code, I added an extra variable to my equation, a perspectiveCoefficient as follows:

distance = new Vector(pointX * perspectiveCoefficient, 
  pointY * perspectiveCoefficient, cameraZ - pointZ).magnitude()

For some reason, that is beyond me, I tend to get the best result setting the perspectiveCoefficient to 1/sqrt(2).

My 3D test cube is at http://vega.soi.city.ac.uk/~abdv866/3dcubetest/3dtest.svg. (Tested in Safari and FF.) It prompts you for a perspectiveCoefficient, where 0 gives a perspective without taking x/y distance into consideration, and 1 gives you a perspective where x, y and z distance is equally considered. It defaults to 1/sqrt(2). The cube can be rotated about x and y using the arrow keys. (For anyone interested, the relevant code is in update() in the View.js file.)

Grateful for any ideas on this.

  • 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-12T05:03:35+00:00Added an answer on May 12, 2026 at 5:03 am

    Usually, projection is done on the Z=0 plane from an eye position behind this plane. The projected point is the intersection of the line (Pt,Eye) with the Z=0 plane. At the end you get something like:

    screenX = scaling * pointX / (1 + pointZ/eyeDist)
    screenY = scaling * pointY / (1 + pointZ/eyeDist)
    

    I assume here the camera is at (0,0,0) and eye at (0,0,-eyeDist). If eyeDist becomes infinite, you obtain a parallel projection.

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

Sidebar

Related Questions

I have been playing around with GTK since a couple of days now,while going
I been playing around with some custom html helpers and I now I am
I have been playing around with Python's FTP library and am starting to think
I've been playing around with Apple's aurioTouch demo which is sample code for their
I have been playing around with this problem since yesterday. I can't seem to
i have been playing around with apache SOLR since last 3 weeks and very
Since the code below looks very old fashion and ugly. But after playing around
I'm playing around with Entity Framework 4 and code only. The tutorial I'm following
I've been playing around with adding hidden iframe elements to a page, and I
I've been playing around with Android development and one of the things I'd like

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.