Unity - Is there a fast way of calculating the volume of a space where a light is visible?

Viewed 37

Given a spotlight in a 3D space, is there a fast way to calculate the volume of the illuminated area?

It’s fairly trivial to calculate the volume of a simple cone, but any obstructions and areas shadowed by those obstructions must be subtracted.

The end result should, for example, allow me to calculate the probability of a player being able to see the spotlight’s point of origin when being placed at random in its total covered area.

1 Answers

By what you're describing it seems like it would be possible to have a raycast from the player camera towards the spotlight and by that you can see if there's anything blocking it.

otherwise maybe you could try calculating it with something like frustum culling Frustum culling learnopenGL

Related