Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
2
Question by DaveA · May 05, 2011 at 12:02 AM · image-effects

How to get Fisheye from Field Of View

I'm needing to get the 'Fisheye' effect based on the camera's Field of View. In other words, if I set it to like 180 degrees (extreme fisheye), I need the on-screen effect to match what a real 180 degree lens would see (I'm matching real cameras to 3d scenes).

Is that possible with the Fisheye Image Effect, if so, what math would map FoV to those distortion params? Or would it be better to just code my own? Or does anyone know of something like this already?

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
1

Answer by leith · Sep 09, 2011 at 11:34 PM

The fisheye effect is one of extreme lens distortion. Usually its a radial function. Radial lens distortion is not part of the standard camera model used by OpenGL and Unity3d. To get a good quality effect, where lines that are straight in the real world, are bent on screen, you'll likely need to use a "render to texture" to take a very wide angle image and render it onto a piece of geometry that has been distorted radially to distort the image.

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 DaveA · Sep 14, 2011 at 07:50 PM 0
Share

That sounds like a pretty good idea, I'll try that.

avatar image
0

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

The hack I once used for a true fisheye effect (that is, one screen pixel represents x angular-degrees-around-the-camera rather than x linear-units-at-distance-from-the-camera) was a custom pro-only rig that took a real-time script-generated cubemap and a full-screen normal-map-esque coordinate-to-vector mapping image (basically, the direction I wanted to see into the scene at each pixel). I knocked out a quick shader to apply to a fullscreen quad which simply returned the cubemap contents in the map-texture-indicated direction at a given pixel. I haven't used the Fisheye Image Effect, so that may be simpler/faster if it's already packed in.

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 DaveA · Sep 14, 2011 at 07:50 PM 0
Share

I don't suppose you'd be willing to share that code? (I do have pro)

avatar image sean · Sep 15, 2011 at 02:07 PM 0
Share

I'd love to if it were my own project, but it was for work in an industry which is paranoid enough on regulation and IP that I'm not comfortable sending anything written in-house out the door, even if it's not fundamentally groundbreaking. I will say that the sum total of the shader was basically just a cubemap lookup, so if you don't want to research and write your own from scratch, you could probably strip all the extraneous camera-object-world calculations off a simple reflection-map shader and leave just the lookup. The old Island Demo reflective water shader/script rig will generate the cubemap in real time (although you can probably read up on how to roll your own simpler script). The screen texture I ended up literally measuring out the angles by hand and creating a gradient grid in Illustrator. $$anonymous$$y "lens" geometry was a bit custom, though, so you may even be able to go without a specific map image if you're ai$$anonymous$$g for straight-up spherical curvature. Protip: smaller normal-map resolutions work better for this- try to match the screen resolution and it comes out grainy, but let the GPU do the texture UV interpolation and the result is much smoother.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Image Effect on single camera only 1 Answer

Enable Camera Image Effect on Button Down 1 Answer

crop or offset the camera display? 0 Answers

Anti-Aliasing causes post processing effects to flip. 3 Answers

Documentation on the bloom filter 0 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