• 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
Question by darkyoddd · Mar 28, 2013 at 08:19 PM · camerarenderingviewport

How to vertically stretch camera view

What I have is two cameras in the exact same location in a scene, but they are both sharing a Normalized Viewport Rect of half width, such that the game view has a vertical split screen appearance. I am trying to make game compatible with a head-mounted display for my class, and as such, i need both cameras to produce a vertically stretched rendering of the scene, something similar to this image:

alt text

I am looking for either an inspector-based or scripted solution. Thanks in advanced!

Comment

People who like this

0 Show 0
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
Best Answer

Answer by Yokimato · Mar 28, 2013 at 08:43 PM

You're not going to be getting it from the default camera editor options. You'll need to create a script which overrides the projection matrix of the camera. If you're not familiar with what the projection matrix is, or how it works, I hope you're comfortable with trigonometry functions, as it's required to get a firm grasp.

Once you understand how it works, you can definitely make your changes encapsulated into a variable which is in turn exposed to the editor.

Here's is the property on Camera you're going to set to your custom projection matrix: http://docs.unity3d.com/Documentation/ScriptReference/Camera-projectionMatrix.html

Comment
Loius
Bunny83
Estecka

People who like this

3 Show 3 · 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 darkyoddd · Mar 28, 2013 at 09:23 PM 0
Share

Thanks for the response. Do you have an idea as to what kind of matrix would produce a "50% width" effect?

avatar image Alekxss darkyoddd · Jun 09, 2016 at 06:41 AM 2
Share

3 years later

cam.ResetProjectionMatrix();

var m = cam.projectionMatrix;

m.m00 = 2; // width m.m11 = 2; // height

cam.projectionMatrix = m;

avatar image bitcoinhibby Alekxss · Jun 12, 2016 at 12:02 AM 0
Share

thank you!

avatar image

Answer by ClaudioPasca · Nov 11, 2016 at 12:12 PM

Easy way

https://www.reddit.com/r/unity_tutorials/comments/4su2lf/how_to_stretch_what_the_camera_renders/

Comment
Estecka
chanon81

People who like this

2 Show 0 · 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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

13 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

Related Questions

In-game video monitor without render-to-texture 0 Answers

Rendering to a portion of screen without cutting off anything that was visible during fullscreen 1 Answer

Network restrictive rendering 1 Answer

Minimap Camera Question 1 Answer

Using multiple cameras (split screen) with LWRP? 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