# Calculating surface area of a plane covered by cameras' frustums

Hello, I am currently working on an application where I need to find the surface area covered by one (or more) camera FOV. The end goal is to be able to determine which potential camera spots would cover the most surface area of a floor, and eventually, with two or more cameras, cover as many angles so an object the player may be holding is in view as with as lateral and rotational movement possible. There’s also a few obstructions that could be in place to block parts of the view as well. Essentially, I want to be able to build a room/layout then find the best spots for a camera to be placed for maximum impact.

So far I’ve tried breaking the floor plane down into vertices and raycasting from the camera spot to each vertices and testing the angle of the line to make sure it’s within the camera’s FOV, but this seems to get a bit expensive when I try and increase the number of spots to test/vertices in the floor. I also want to eventually be able to test volume coverage rather than just the floor’s surface, but before I attempt that, I was hoping someone may have a more efficient method of “scoring” a potential camera spot. Thanks for any help!

hmm. offhand, cast a ray through each corner of the viewport, see where it hits the ground plane, then view those four points on the plane as defining two triangles, and calculate the areas of those.
you may also want to consider edge cases where 1 to all 4 of the rays do not intersect the plane.
i’m not sure how to handle occluding objects cheaply. you could approximate each one by a screen-space rectangle and do a similar projection and subtract that from you “visible ground” area, but it’ll be more complex if the bounding rect is partially outside the viewport.
i guess another approach might be to chop the viewport up into a grid, then for each cell test if the center of the cell “sees” the ground, and if so then project the corners of each cell onto the plane and add em up. depending on the fidelity you want you can choose a finer or coarser grid.

I am currently working on the same issue and would love to hear how you solved it.
I will probably go with the grids to cut up the surface into little pieces, however, I am sure there could be better solutions as well.