Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 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
0
Question by FIR3FLY · Mar 23, 2011 at 07:41 AM · cameraviewanglesfieldfrustrum

Camera frustums + custom field of view

I got the planes of my camera frustum using GeometryUtility.CalculateFrustumPlanes and they seem to be created at random positions and rotations. I am using the example script from the documentation.

Another thing I need to do is set the camera's field of view to custom angles, vertically and horizontally. The vertical angle can be set by the camera's field of view value, and I've read that using the aspect ratio is the only way of adjusting the horizontal field of view. Will this distort the image, or will it simply adjust the size of the game view to keep it in proportion if necessary?

Is this:

static function CalculateFrustumPlanes (worldToProjectionMatrix : Matrix4x4) : Plane[] 

the best way to go about it?

Thanks

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by StephanK · Mar 23, 2011 at 09:47 AM

If you want to create an asymmetric frustum (used for headtracking, stereo rendering etc.) you are better off modifying the projection matrix directly. If you want to do something else a little more info would be appreciated.

Comment
Add comment · Show 2 · 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 FIR3FLY · Mar 24, 2011 at 03:21 AM 0
Share

Thanks for the quick reply. What I am basically doing is making a system that allows users to manipulate cameras in the scene. They can adjust the vertical and horizontal angles of the field of view, and can also "see" which areas are being looked at by a particular camera (this is where the frustum comes into play).

No headtracking or stereo rendering is involved.

avatar image StephanK · Mar 24, 2011 at 09:21 AM 0
Share

I still think if you need to set the horizontal opening angle you'll need to modify the projection matrix. As you know Unity only allows to set the fov which is the vertical angle directly.

avatar image
0

Answer by sean · Sep 09, 2011 at 09:33 PM

I've been able to get any combination of render rect and field of view I've needed so far using just the fieldOfView and viewportRect/pixelInset, and I've needed to do some obscure edge-use-case stuff. By default, Unity will set the aspect ratio and field of view to be consistent with the size of the viewport rect. From there, however, you can manually adjust any of the above in script without the others being auto-adjusted. So say your viewport is square but you want to render a wider horizontal angle: just change camera.aspect to a larger value. The field of view (vertical angle) will stay the same, the horizontal angle will increase, and the viewport contents will be proportionally distorted (unless you then change the viewport rect or screen size). If you want to render taller than square, you'll need to increase the field of view but decrease the aspect ratio proportionally (say, multiply the FoV by 4/3, but then multiply aspect by 3/4). If you want an asymmetric frustum... yeh. That's actually going to be one of my upcoming questions if I don't see anything in the Answers after a bit of searching.

Comment
Add comment · 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

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

2 People are following this question.

avatar image avatar image

Related Questions

How can I know if a gameObject is 'seen' by a particular camera? 11 Answers

How to draw an outline of a camera view along a path ? 0 Answers

Viewer position lost in Space. How to get back to scene? 1 Answer

How do I calculate a view matrix using Matrix4x4.LookAt? 2 Answers

Screen position out of view frustum error? 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