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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:52:05+00:00 2026-05-16T23:52:05+00:00

i want to refine a previous question : How do i project a sphere

  • 0

i want to refine a previous question:

How do i project a sphere onto the screen?

(2) gives a simple solution:

approximate radius on screen[CLIP SPACE] = world radius * cot(fov / 2) / Z

with:
fov = field of view angle
Z   = z distance from camera to sphere

result is in clipspace, multiply by viewport size to get size in pixels

Now my problem is that i don’t have the FOV. Only the view and projection matrices are known. (And the viewport size if that does help)

Anyone knows how to extract the FOV from the projection matrix?

Update:

This approximation works better in my case:

float radius = glm::atan(radius/distance);
radius *= glm::max(viewPort.width, viewPort.height) / glm::radians(fov);
  • 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-16T23:52:06+00:00Added an answer on May 16, 2026 at 11:52 pm

    Update: see below.

    Since you have the view and projection matrices, here’s one way to do it, though it’s probably not the shortest:

    • transform the sphere’s center into view space using the view matrix: call the result point C
    • transform a point on the surface of the sphere, e.g. C+(r, 0, 0) in world coordinates where r is the sphere’s world radius, into view space; call the result point S
    • compute rv = distance from C to S (in view space)
    • let point S1 in view coordinates be C + (rv, 0, 0) – i.e. another point on the surface of the sphere in view space, for which the line C -> S1 is perpendicular to the “look” vector
    • project C and S1 into screen coords using the projection matrix as Cs and S1s
    • compute screen radius = distance between Cs and S1s

    But yeah, like Brandorf said, if you can preserve the camera variables, like FOVy, it would be a lot easier. 🙂

    Update:
    Here’s a more efficient variant on the above: make an inverse of the projection matrix. Use it to transform the viewport edges back into view space. Then you won’t have to project every box into screen coordinates.

    Even better, do the same with the view matrix and transform the camera frustum back into world space. That would be more efficient for comparing many boxes against; but harder to figure out the math.

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

Sidebar

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.