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 tuf91497 · Aug 07, 2019 at 11:40 PM · meshrenderingverticesnormalstriangles

Why does the default Unity sphere have duplicate vertices?

If I print the length of the default Unity sphere mesh, I get 515 vertices. If I run vertices.Distinct().ToArray(), I get 386 vertices.

From Anatomy of a Mesh:

By calling Mesh.RecalculateNormals, you can get Unity to work out the normals’ directions for you by making some assumptions about the “meaning” of the mesh geometry; it assumes that vertices shared between triangles indicate a smooth surface while doubled-up vertices indicate a crisp edge.


So, if duplicate vertices indicate a crisp edge to the Unity renderer, and a sphere is supposed to be a perfectly smooth object, then why does the default Unity sphere mesh have any duplicate vertices at all? Wouldn't duplicate vertices only hurt the renderer's ability to draw a perfectly smooth sphere?

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
2
Best Answer

Answer by Bunny83 · Aug 08, 2019 at 12:02 AM

The answer is simple: UV mapping. The vertex normals are not the only reason why you need to split vertices. Any time two or more faces which meet at a vertex need different vertex attributes at this point it need to be split. That's why most of the vertices of a sphere are actually fully shared. However UV seams will force some duplicates.


In the past Unity had a sphere mesh which is often called a UV sphere. This mesh only had one UV seam and that was one seam from tne north pole to the south pole. Note that the north and south pole were duplicated several times (once for each longitude). At this projection the top edge of the texture would collapse into a single point (the north pole) and the bottom edge of the texture forms the south pole.


Since this projection generally causes a lot of distortion at the poles Unity switched to to a cube sphere. That's essentially 6 subdivided planes of a cube which have been "spherified". The advantage is that you don't get that extreme distortions at the poles. Only minor distortions at the "cube corners". Unity also defines two different unwraps (UV channel 0 and 1) which are unwrapped differently. This probably helps with lightmap projections onto the sphere.


Note that in order to draw a perfectly smooth sphere all you need are equal normals at the duplicated vertices. RecalculateNormals will most likely produce artifacts on Unity's default sphere. The normals are already setup correctly. The normals for a perfect sphere are actually quite easy to calculate. If the mesh origin is the center of the sphere (which is almost always the case) then the local vertex position is the same as the normal vector at this point. You just need to normalize that vector. Of course if you apply some kind of deformations to the sphere so it's not really a sphere anymore, this is not true anymore.

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

141 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

Related Questions

Unity is welding vertices when I enter Play mode 0 Answers

Realtime mesh triangles do not appear depending on camera angle 1 Answer

Problem drawing a mesh with Graphics.DrawMeshNow 1 Answer

Holes in procedural mesh 0 Answers

How to make sure two meshes have the same vertex count 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