Jump to content
  • Advertisement
Sign in to follow this  
nooan

On screen projection of a bounding box

This topic is 4456 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ciao, Is there a quick and robust algorithm to determine the projection on screen of a bounding box, taking into account all possible cases? In particular, I am interested in the case when the bbox crosses the camera's near plane, which prevents the simple projection of the bbox corners. I can only think of calculating the intersection between the bbox planes and the camera plane in this case but maybe there's a more clever way. Thanks! Stefano

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by nooan
Is there a quick and robust algorithm to determine the projection on screen of a bounding box, taking into account all possible cases? In particular, I am interested in the case when the bbox crosses the camera's near plane, which prevents the simple projection of the bbox corners. I can only think of calculating the intersection between the bbox planes and the camera plane in this case but maybe there's a more clever way.

You may want to start with this article:

http://jgt.akpeters.com/papers/SchmalstiegTobler99/

You can find a (tech report) copy here:

http://www.cg.tuwien.ac.at/research/publications/1999/Fuhr-1999-Conc/TR-186-2-99-05Paper.pdf

Share this post


Link to post
Share on other sites
Thanks Christer for that link, that tech report was actually already opened on my desktop ;-)
That paper does not deal with the case of a bounding box crossing the view plane. This could happen in extreme cases when the viewer is very close to the bounding box (even just a bit inside). I guess in this case the only solution is to simply calculate the intersections between the view plane and the bbox, project the remaining points lying in front of the view plane, and take the bounding rect of these.
Thanks anyway,

Stefano

Share this post


Link to post
Share on other sites
If you can't just project the corners then isn't the camera inside the box? In which case the box covers your entire view ...

Share this post


Link to post
Share on other sites
Quote:

If you can't just project the corners then isn't the camera inside the box? In which case the box covers your entire view ...


Generally yes but there are some cases where this is not true. For example, the camera is underwater, but you can partially see outside because part of the view plane goes out of the water bounding box, despite the viewer being inside the box. Assuming that the box covers the entire screen might be a good approximation anyway.
Thanks again!

Stefano

Share this post


Link to post
Share on other sites
You could 'chop' the bounding box with the near view plane, which would result in a new convex polygon. (If your bounding box is camera-aligned, this step is really easy and always will produce a new box.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!