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 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
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

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.

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

Very Very Big Terrain, how to show it? 1 Answer

Disable Culling for Terrain 0 Answers

Terrain heightmap isn't smooth 0 Answers

Terrain trees aren't solid,Terrain Trees 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