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
0
Question by Ltank129 · May 08, 2014 at 03:30 AM · cameracamerasdepth

Rendering different cameras with the same depth?

So I decided to take a simple concept and work with it to make a game. But the main component of the game is that the player has to work with two the fps character having two slightly offset cameras operating at the same time on the same view port with the same depth, rendering different object layers. Ideally I would want them to operate like a single camera would, objects farther away on camera A rendering behind closer objects on camera B, and objects farther away on camera B rending behind closer objects on camera A. I set them up on the same depth, but they render as if the last camera set to that depth has a higher depth. Is there any way to truly set them to an equal depth?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by riazrizvi2 · Oct 23, 2014 at 11:09 PM

You have two points of view, and you already have two cameras that capture those points of view in your scene's Hierarchy. You have set the viewport of each camera to cover just one side of the application screen, left side for camera 1, right side for camera 2.

Your problem is that when you play the scene, only one camera's view is displayed. The solution is that you need to choose one of the Camera's to have a Camera.Depth=2, and also to set Camera.ClearFlag=DepthOnly. If you are drawing to the whole viewport with each camera, then you would also need to fix this by altering Camera.Viewport.

To clarify what's happening. Each Camera overlays the application window with it's view. The Camera with the lower Camera.Depth goes first. The Camera.ClearFlag setting determines whether that camera covers the parts of the screen it doesn't render to with the Skybox or with a Background Color. Camera.ClearFlag=Don'tClear just combines one pixel color on top of another, but you want each view to be a stencil, since you are not creating semi-transparent layers.

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

21 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

Related Questions

How can I mimic this game's camera in Unity? 1 Answer

How to get a camera state to wait with coroutine? 0 Answers

Camera Viewport issue: Being Drawn Behined GUI 1 Answer

Integration of ARtoolkit with Unity3D for using several markers 1 Answer

First Person Camera Pixelation 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