Jump to content
  • Advertisement
Sign in to follow this  
thames

Visibility question

This topic is 4828 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

Hi i have a model of the earth and an object above the earth, say 30km above a point on the ground of the earth. The earth is an ellipsoid and the object a mesh of about 100 polys. When i rotate the earth the object moves as well, staying anchored above the same point on the surface of the earth. How can i tell when this object goes behind the earth? Many Thanx Tom

Share this post


Link to post
Share on other sites
Advertisement
I assume you mean 'behind the earth' in relation to a specific viewpoint? One way to test for this would be to intersect a line segment from the viewpoint to the object center with the earth; if it intersects, the object is not visible. This will have some error, depending on the relative size of the object.

For more accuracy, you could require that the segment not only intersect the Earth, but also penetrate by some distance, such as the approximate radius of the object. This will also have some error, but will give false positives rather than false negatives, which is generally better.

If your Earth is a sphere, these tests are pretty easy. If you really need it to be an ellipsoid for some reason, the tests are a little more complex.

Share this post


Link to post
Share on other sites
ahh cool, i had just came to that conclusion myself last night. But now i am wondering how do i do that? Are there are good sites to look at? it might sound trivial to everyone else, but im not sure how to achieve this.

Share this post


Link to post
Share on other sites
In a similar vein, you could use occlusion queries on the graphics hardware to determine the relative visibility of one object behind another.

The accuracy would depend on your implementation; specifically the type of bounding volumes (if any) you used.

I've not tried this approach myself, but i'm just going on what I understand about occlusion queries. (mostly from a good article in the first "GPU Gems" series of books covering their use - in this instance for lens flare effects).

I would guess that a ray intersection test might be easier to code, but if anything at least its another option.

Cheers,
Ben

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!