• 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 koptehe · Jul 31, 2018 at 12:57 PM · terrainmeshpolygonhuge

Large triangular polygon with a large number of points in the mesh

Hello everyone! When creating the mesh, I had a problem: both in the game, and in the scene appears a large triangular polygon. The problem is that with a system size of 250 by 250 points there aren't this polygon. At a size of 400 by 400 points, it already appears.

What I did:

 void Start () {
             MeshFilter mf = GetComponent<MeshFilter>();
             Mesh mesh = mf.mesh;
             int size = 400;
             Vector3[] vertices = new Vector3[size * size];
             Vector3[] normals = new Vector3[size * size];
             Vector2[] uvc = new Vector2[size * size];
     
             int c = 0;
             for (int i =0; i < size; i++)
             {
                 for(int j =0; j < size; j++)
                 {
                     vertices[c] = new Vector3(i, j, Mathf.Sin(j+i+Mathf.PI));
                     normals[c] = -Vector3.forward;
                     float mult = 1.0f / ((float)(size));
                     uvc[c] = new Vector2(((float)(i))*mult, ((float)(j)) * mult);
                     c++;
                 }
             };
     
             int[] triangles = new int[(size-1)*(size-1)*6];
             int counter = 0;
             
             {
                 for (int i = 0; i < size - 1; i++)
                 {
                     for (int j = 0; j < size - 1; j++)
                     {
                         setTriangle(ref triangles, ref counter, i * size + j);
                         setTriangle(ref triangles, ref counter, (i + 1) * size + j);
                         setTriangle(ref triangles, ref counter, i * size + j + 1);
     
                         setTriangle(ref triangles, ref counter, (i + 1) * size + j);
                         setTriangle(ref triangles, ref counter, (i + 1) * size + j + 1);
                         setTriangle(ref triangles, ref counter, i * size + j + 1);
     
                     };
                 }
             };
     
             mesh.Clear();
             mesh.vertices = vertices;
             mesh.triangles = triangles;
             mesh.normals = normals;
             mesh.uv = uvc;
             mesh.RecalculateNormals();
     
             gameObject.transform.position = new Vector3(-55, -60, 90);
     
         void setTriangle(ref int[] triangle, ref int index, int num)
         {
             triangle[index++] = num;
         }
 
 

And what I have in results. The first picture is with 250 by 250 points. The second is with 400 by 400. The third is just bigger picture.alt text

250x250.jpg (217.5 kB)
400x400.jpg (130.2 kB)
Comment

People who like this

0 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

0 Replies

· Add your reply
  • Sort: 

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.

Update about the future of Unity Answers

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta later in June. Please note, we are aiming to set Unity Answers to read-only mode on the 31st of May in order to prepare for the final data migration.

For more information, please read our full announcement.

Follow this Question

Answers Answers and Comments

116 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

Related Questions

Terrain Mesh - Poly Facing... 0 Answers

Paint textures like on terrain but without terrain? 0 Answers

Generate collision mesh from 2d texture? 0 Answers

Can a dynamic mesh be made NOT readable? to save mem 1 Answer

Huge terrain in Unity? 2 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