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
-1
Question by sershe · Sep 19, 2016 at 06:21 PM · meshrenderinglinerenderer

Ordering glitches when far away from camera?

I have a textured mesh where every vertex has y == 0, and a camera looking straight down at it. I also have a LineRenderer that I use to draw on top of the mesh in solid color (e.g. to outline a part of the mesh). For the LineRenderer, I set every line vertex to have e.g. y == 1. All is good when the camera is relatively close to the mesh; however, when the camera is some distance away, the lines reliably "jump" under the mesh - I can see them properly only thru the transparent holes in the mesh texture. The jump is not gradual, as I move the camera very slowly at some point the lines just "disappear"/"reappear". Is this a bug of some sort? Is there a better way to enforce ordering of what's visible in this case?

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 tanoshimi · Sep 19, 2016 at 07:28 PM

What you're describing sounds like a case of Z-fighting. Try increasing the distance between the linerenderer and the mesh, increasing your camera's near clip plane, or reducing its far clip plane.

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 sershe · Sep 20, 2016 at 04:30 AM 0
Share

How does unity resolve it for sprites? I am using meshes because sprite logic seems unwieldy for rendering a large dynamic map, but now I wonder if I should switch from meshes from sprites or if I could managed to do what unity does for sorting layers.

avatar image tanoshimi sershe · Sep 20, 2016 at 06:03 AM 0
Share

Sprites are really just billboarded quads - there's nothing special about the way they're rendered. But yes, sorting layers is another option.

avatar image sershe tanoshimi · Sep 20, 2016 at 06:29 AM 0
Share

What I mean is, how does Unity make sure there's no z-fighting between these quads? How is sorting layer implemented, in principle? If two quads for two sprites have the same z, Unity presumably does some magic to make sure they are always in sorting order on the screen... Is it using some special renderer?

avatar image
0

Answer by flaviusxvii · Sep 21, 2016 at 02:34 AM

I think @tanoshimi is on the right track. An alternate solution would be to use a material/shader that doesn't do depth testing. That way the line will always appear on top. Also, if this is going on far from the origin (like the camera position has elements in the thousands.. then floating point precision issues will creep into everything causing jitters and whatnot.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Geometry in one room has a silhouette that shows through other geometry? 0 Answers

Heap problem when creating a large number of objects. 1 Answer

More tris after adding material?! 0 Answers

Remove part of a mesh or points of pointcloud 1 Answer

[PS4] Mesh becomes invisible in-game after it rotates for a while 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