Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 drslaphead · Oct 29, 2019 at 08:11 PM · cameraviewport

camera or viewport

alt text

the two rectangles are for player one & two, a frog character is in the bottom center of each window when they jump they move up and down and the level moves, how do I setup cameras and viewports to accomplish this??

background.png (7.6 kB)
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
Best Answer

Answer by MoonBoop · Oct 30, 2019 at 10:55 PM

If what you need is split screen, then you can set up two cameras in the scene and have them render to half of the screen each by using the view port rect variables. viewport rect

if you set the width of each camera to 0.5, and then set the x coordinate to 0.5 in viewport rect, you will get two cameras each rendering to half a screen each like this.

alt text

but since I think you want it to look more like the diagram you've provided, you can adjust the width and height of each camera to suit your layout. This will leave some empty screen space, but you can have a gui overlay this blank screen space


screen-shot-2019-10-31-at-93536-am.png (118.2 kB)
screen-shot-2019-10-31-at-94952-am.png (243.1 kB)
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
avatar image
0

Answer by Rocketman_Dan · Oct 30, 2019 at 11:47 AM

You need to add 2 more cameras besides the main one. Set these extra two's render target to two render textures. You wll set each render texture to a material and apply each material to a square. Remember to set the material shader to unlit texture. The main camera points at both panels. The viewport is just the space that is viewable through a camera.

You can make the camera follow the players by making the cameras children of the player charactersin the hierarchy. Make sure your camera aspect ratio fits your render quads or else it will look streteched. Play with your camera settings till you get something that looks good to you.

Comment
Add comment · 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 drslaphead · Oct 30, 2019 at 10:13 PM 0
Share

Ok, lets pretend this is new to me, I've never used any of the functions you talking about, if you could point me to any tutorial of link of any kind as to how to setup a render texture and render my output to it i'd appreciate it cos you lost me in the second sentence!

Thx

avatar image Bunny83 · Oct 31, 2019 at 01:12 AM 0
Share

While using rendertextures is a solution, it adds unnecessary overhead, requires additional GPU memory and requires render texture support from the target device. Since you can set a viewport area for each camera you can simply set a smaller viewport rect for each sub camera so they only render to their respective area. Also ensure that you set the camera "depth" of your sub cameras to a higher value than the main camera. The main camera usually has a depth of "-1". So since the two viewport cameras do not overlap each other you can set both depth values to "0".

avatar image drslaphead Bunny83 · Oct 31, 2019 at 04:46 PM 0
Share

Perfect thank you sooooooo much

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

185 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 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

Clamp camera to multiple on-screen players 0 Answers

Second Camera Position on Viewport to UI Element Position on Screen 2 Answers

Is it possible to shift the camera viewport? 3 Answers

Unable to see proper view in viewPort 0 Answers

Two cameras rendering to same viewport rect sometimes causes lower camera to render incorrectly 1 Answer


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