• 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
Question by GlenDiesel · Jul 17, 2020 at 12:49 PM · meshprocedural meshprocedural generation

Do i have to use shared vertices if i want my proceduraly generated mesh to look smooth?

I made a procedurally generated island and it came out looking like this alt text alt text to generate this mesh each face here has it's own unique vertices, so do i have to use shared vertices if i want a decent smooth looking terrain?

capture.png (187.6 kB)
capture.png (121.7 kB)
Comment
Bunny83

People who like this

1 Show 0
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
Best Answer

Answer by Bunny83 · Jul 17, 2020 at 03:35 PM

No, you don't have to use shared vertices. However having them seperate when it's not necessary just create additional problems. First of all when every triangle has its own vertices using RecalculateNormals is pretty pointless since it will make every triangle flatshaded. So if you want the mesh to look smooth, you have to manually calculate the normal vectors for each vertex. Of course in order for the mesh to look smooth, all vertices which essentially belong to the same vertex position have to have the exact same normal vector. If they don't, the mesh wouldn't look smooth.


If you want to know how to calculate the shared normal, just have a look at this question.

Comment
GlenDiesel

People who like this

1 Show 5 · 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 GlenDiesel · Jul 18, 2020 at 11:03 AM 0
Share

That completly makes sense i should of thought about it instead of trusting the recalculatenormals methode, now i'll just have to figure out how to calculate those normals thank you

avatar image Bunny83 GlenDiesel · Jul 18, 2020 at 11:20 AM 0
Share

Well as you can read in my linked answer the calculation itself isn't really difficult. The main issue is to figure out which vertices belong together. Since your mesh looks like it's a regular quad grid in the x-z-plane you should be able to figure out which vertices belong together just by looking at their indices. Of course this requires information about how you actually generated / laid out the vertices in the vertices array.


If each triangle has it's own 3 vertices and the diagonal cut through the "quads" is always oriented the same way you should have exactly 6 vertices at one location. Of course there are literally "edge" cases at the edges / corners where there are only 3, 2 or 1 vertices. Every outer edge vertex has 3 vertices. The corners can have 2 or 1 vertices.


Since you need each triangle flat surface normal in order to combine them you could still call RecalculateNormals and after that you just do the combining.

avatar image GlenDiesel · Jul 18, 2020 at 11:22 AM 0
Share

what would be better, to recalculate normals manually or have shared vertices?

avatar image Bunny83 GlenDiesel · Jul 18, 2020 at 11:37 AM 0
Share

Well, if the whole mesh should have smooth normals everywhere of course using shared vertices is better and faster ^^. With shared vertices you would only need about 1/6 of the vertices.

Though I simply assumed that, for some reason, you want to have the triangles seperated. Maybe because of texturing or you want to carve holes in later. If you don't have any of those specific needs using shared vertices is much simpler and more memory friendly ^^.


Note that by "texturing" I was talking about specific texturing needs. Of course a shared mesh can still be textured. However it's essentially just one big subdivided quad.

avatar image GlenDiesel Bunny83 · Jul 18, 2020 at 12:10 PM 0
Share

yeah i think i'll just use shared vertices for now and if i find out i need to use unique vertices then i'll go ahead and recalculate normals

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

150 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Procedural mesh with texture atlas, how to get rid of material artifacts? 0 Answers

cant see mesh 1 Answer

Splitting vertices in a mesh specifically a plane 0 Answers

C# Proceducal Mesh terrain 2 Answers

How do I optimize loads of quads generated as a Tile map for my procedurally generated tileSet? 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