Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by GiantDwarf01 · Nov 23, 2019 at 05:51 AM · mathgeometrysurfaceareafov

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!

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image soapbubblegirl · May 28 at 10:30 AM 0
Share

Hi @GiantDwarf01 ,

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.

Thank you in advance!

avatar image elenzil soapbubblegirl · May 28 at 01:44 PM 0
Share

you could also consider rendering to a small texture with a special material for the floor and then count up the pixels. that might introduce a frame of latency.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by elenzil · Nov 23, 2019 at 11:24 PM

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image elenzil · Nov 23, 2019 at 11:25 PM 0
Share

from a performance POV, i'd expect you'd be fine with a 5x5 grid and probably fine with 10x10 or possibly more. computers are fast.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

127 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Starting point or library for freehand drawing 2D shapes, calculating intersection areas and basic translations? 0 Answers

Get / Calculate edges of a 3D object - C # 1 Answer

3D. How to get 1 pixel to equal 1 degree camera FOV 0 Answers

Finding Point on a Bounds (2D Rectangle) using its Centre and an Angle. 1 Answer

SetFromToRotation vs SetLookRotation 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges