Sign in to follow this  

Finding bounding cone/pyramid for spot light

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

I have the following problem : given: -a direction vector for the light ( from the origin to the target ) -the lenght of the vector ( the brightness of the light ) -the cone opening ( degrees/radians ) How do I find the bounding cone for the light ? Or bounding pyramid even better, less vertices. I need it for checking stuff against this volume.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You also need the position p of the light.

To test if a vertex is inside the bounding cone, test if the angle between the direction vector of the light and the vector from the lightsource to p is smaller than the cone opening. You get the cosine of the angle between two vectors by normalizing the vectors and then computing the dot product. Compare the cosine with the cosine of the cone opening - if the latter is smaller, the vertex is inside the cone.

Share this post


Link to post
Share on other sites
That doesn`t work if the surface is not highly tesselated.
So if the surface is huge and the light only lits the middle of the surface then the formula doesn`t work, tryed it already.
That`s why I need the bounding cone, so I can check against each of the planes if a vertex is in front/back of it.

Share this post


Link to post
Share on other sites
Rather than converting the cone to a bunch of planes, you'd probably be better off intersecting the cone directly with a simple bounding volume. It would be much less expensive and easier to code. For example, you could use bounding spheres. If that is of interest to you, a thread on sphere/cone intersection can be found here.

Share this post


Link to post
Share on other sites

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