Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 BerenBotje · Jul 25, 2019 at 02:27 PM · renderingoverlayrenderqueue

Why Is overlay(e.g. health bar) not rendered first since it can prevent overdraw?

In the Unity documents was said that overlay is rendered a the end. Why not at the begging to prevent overdraw? I noticed a render queue 3000 from my default UI material.

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 JonPQ · Aug 12, 2019 at 07:20 PM

because then you could not have semi transparency on your health bar, no nice soft alpha'd edges. only hard pix-elated(aliased) edges.

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 BerenBotje · Aug 13, 2019 at 03:18 PM 0
Share

I don't need semi transparency on my health bar and I'am using mostly squares for my UI. So how can I change the Render queue value from my material because when I click on it the properties are grayed out. ( I think 1/4 of my screen is covered in UI overlay so wouldn't I get much more performance? I'am using the UI default material) @JonPQ

avatar image JonPQ BerenBotje · Aug 13, 2019 at 04:04 PM 1
Share

you could not use Overlay mode, switch to one of the other two modes. Put all your Ui you want drawn first in a 'UI-first' layer, then add another camera jsut to draw that Ui, set its render layer mask to just draw that layer, and it's depth (draw order) to be before the main camera(s) and make sure the other cameras do not draw that layer... and you should now have that layer drawing first.

..but for the trouble you are giving yourself.. make sure you really need to do it.... are your FPS too low, is there no other way to hit your FPS target ? are you using simplest mobile or legacy shaders (if you are not drawing anything fancy)

mobile can suffer badly from overdraw... I've occasionally gone as far as making a shader for a health bar, that can draw it in 1 call, with 0 overdraw for the fill bar.... but there are usually other ways to improve FPS before going so far.

avatar image
1

Answer by Bunny83 · Aug 13, 2019 at 03:33 PM

UI is generally drawn after 3d scene geometry since the 3d scene as well es the UI has to use the same depth buffer. The camera maps the whole viewing frustum to the whole depth buffer range. If you draw UI first it would be possible that you get z fighting with geometry that clips into the near clipping plane.


I've seen some cases where they essentially mask out large opaque UI areas first by just writing into the depth buffer, then rendering the scene and finally rendering the UI on top of the mask regions. However depending on the size of the UI stuff it's usually not worth doing this. Some older strategy games actually had a seperate viewport for the 3d view and the UI around. So the viewport already clips everything the UI covers. However most modern UI design is an actual HUD over the game scene and often contains semi transparent elements.


How much performance overdraw costs highly depends on the platform and how complex the actual 3d scene behind the UI actually is. The screen space UI generally is drawn last and as far as i know starts with a completely cleared depth buffer.

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

130 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

Related Questions

Shader queue tags not working...? -3 Answers

How would I fix this DrawMeshInstancedIndirect and Translucent object problem? 0 Answers

How do i change the Alphasorting Center to the Pivot in Meshrenderers? 0 Answers

Rendering a 3d mesh over Unity UI,Rendering over Unitys UI 3 Answers

Problem with rendering? 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