Sign in to follow this  

How to determine if one billboard is in front of another?

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

When using a billboard system, what would be the best way to determine whether one billboard is in front of another from a given viewpoint? I have thought about using raytracing, but to do this i dont know how to find the vertices for each triangle for each billboard. Any ideas/help/suggestions would be appreciated? Khaine

Share this post


Link to post
Share on other sites
Well one way of doing this would be to take the average distance that each vertex of the billboards is away from the user. Then compare one average to another.

It really depends on what you mean by '1 in front of the other'.

What about intersecting billboards, do they matter?

If ur not familiar with the maths then

Let A be the user and B be the billboard and D be the distance

D = sqrt( (Ax - Bx)^2 + (Ay - By)^2 + (Az - Bz)^2 )

I think this is right.

Ace

Share this post


Link to post
Share on other sites
I'll see if I can clarify what im trying to do...

Imagine that you've got a viewport and two billboards, A & B.

We'll say that A is closer to the viewport than B.

What I want to be able to figure out is, when looking at B, is A in the way?

I know how to setup a ray between the viewport and B, and i can use D3DXIntersectTri to see if the ray intersects with a triangle, but how would I get the vertices out of A to test with?

Share this post


Link to post
Share on other sites
What you can do to see if one is COMPLETELY behind another is to test whether rays going from the biewpoint to the four corners of one go through the other billboard.

ace

Share this post


Link to post
Share on other sites
Quote:
Original post by ace_lovegrove
What you can do to see if one is COMPLETELY behind another is to test whether rays going from the biewpoint to the four corners of one go through the other billboard.

ace


Except when the one completely encloses the other.

Isn't this just a simple bounding box check problem?

Share this post


Link to post
Share on other sites
Khaine, I think that the simplest way to determine if a billboard occludes another is to take the vertices of both billboards and manually transform them to screen space. (multiply by world, view & projection matrices) Then you only check that if the two 2D-space bounding boxes intersect. Note that the tranformed vertices most probably create a shape of a diamond or another non-square form.

Share this post


Link to post
Share on other sites
What you want to do is generally referred to as "Occlusion culling" - Finding whether one object occludes another or not. This is a very broad subject, but you specifically want billboards, so it's a lot more simple.

1. Project both billboards to screen space
2. If their projected rectangles intersect, then one occludes the other

Share this post


Link to post
Share on other sites

This topic is 4714 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this