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 Luiz_Thiago · May 25, 2017 at 05:16 PM · camerarenderingdepth

Problem with render order using 3 cameras!

Problems with rendering order using 3 cameras!

Hello guys! My project is structured as follows: - A "Main Camera" that renders the game properly; - A "GUI Camera" to render the GUI! I had to separate the GUI from the Main Camera, because for some reason the "Bloom" effect did not work on the GUI buttons in "Overlay" mode, so I had to create a GUI Camera in Screen Space - Camera mode; - A "Skybox Camera" to render only the Skybox. It was the only way I found that I had a little control in the position of the Skybox;

The problem is that even setting the Depth correctly on the cameras, the rendering order gets messy when I press Play. In the editor, everything is fine, but in Play mode, the Main Camera is rendered in front of the GUI Camera.

Could someone help me with this problem?

Settings

In Game

01-setting.png (243.0 kB)
02-game.png (358.1 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
0

Answer by arvindiitkgp · May 25, 2017 at 07:22 PM

The problem is with the combination of canvas plane distance, gui camera near clip plane and mainCamera near clip plane values. These values should be in the following order: GUICameraNearClipPlane < CanvasPlaneDistance < GUICameraFarClipPlane < MainCameraNearPlaneDistance

Try these values:

GUICameraNearClipPlane = 0.01

CanvasPlaneDistance = 0.02

GUICameraFarClipPlane = 0.03 (Not required though, but should be greater than CanvasPlaneDistance)

MainCameraNearPlaneDistance = 0.3

In your case you are using more cameras than required, each new camera has got performance overhead, to achieve the bloom effect on UI elements just make the canvas render mode as world space and parent it to the moving camera.

Hope this helps :)

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 meejabych · Aug 07, 2018 at 06:22 PM 0
Share

Thank you for this. I've spent the whole afternoon trying to fix a problem that I was sure was caused by camera rendering order. Unity docs state that rendering order is controlled by the camera's depth setting. This is the only mention I've found anywhere of the clipping planes affecting render order, but sure enough this has fixed my problem.

avatar image
0

Answer by Owen-Reynolds · May 22, 2020 at 08:55 PM

The problem is the DontClear setting (on GUICamera in the middle). Things you want shown as overlays should be DepthOnly, which means: always draw the whole sprite, covering up lower-depth cameras, and being coverable-up-able by higher depth cameras.

DontClear is DepthOnly with an extra restriction: it says to check each pixel of your sprite for being behind a rock or a tree from a previous camera. Not only do you almost never want that, but it makes no sense for a GUI camera off to the side, with different settings. Even so, the computer tries. Technically, a sprite's depth is its percent distance between the near and far clipping planes. That's why messing around with them "fixes" it (there are a million ways to make the sprite count as "very low depth".

A way to use DontClear would be to have a world canvas, actually in the scene, using a camera exactly following the 3D scene camera. Then the depths would be computed using the same scale as the world, and parts would be properly blocked by closer 3D objects (I think).

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

99 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

Related Questions

Second camera has higher depth, but terrain still occluding camera image. 1 Answer

What is the best way to render a depth map to Texture2D? 0 Answers

"Motion vectors" and "depth with normals" from camera's target texture 1 Answer

Rendering to DepthTextureMode.Depth 0 Answers

Rendering different shader when camera get near object 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