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 /
  • Help Room /
avatar image
0
Question by 295cade1 · Sep 08, 2017 at 01:03 AM · meshmeshrenderervoxelmeshfiltersubmesh

Failed Getting triangles & Failed setting Triangles - Using Quixel Voxel Terrain

I am trying to use the Quixel Voxel terrain engine found here: https://forum.unity3d.com/threads/open-source-quixel-terrain-engine-smooth-voxel-terrain.240645/

It was made for unity 4.6 but I am trying to update it to unity 5; however, some things have changed with how submeshes work and it is giving me the error:

Failed getting triangles. Submesh topology is lines or points.

&

Failed setting triangles. Some indices are referencing out of bounds vertices. IndexCount: 3, VertexCount: 0

When using

    if (mesh.GetTriangles(i).Length < 3)
                  {
                      mesh.SetTriangles(new int[3] { 0, 0, 0 }, i);
                  }

Without using this code snippet it gives me the error:

Failed getting triangles. Submesh 1 has no indices. Mesh asset path "Assets/Testing.unity" Mesh name ""

         public void setMesh(MeshData meshData)
         {
             densityData.setChangeData(densityChangeData);
 
             regenReq = false;
             if (regenFlag)
             {
                 regenFlag = false;
                 regenReq = true;
                 MeshFactory.requestMesh(this);
             }
 
             hasMesh = true;
             if (meshData.indexArray.Length == 0)
                 return;
 
             if (chunk == null)
             {
                 chunk = ChunkPool.getChunk();
                 if (LOD > 2)
                     chunk.transform.position = position - new Vector3(0f, (NodeManager.LODSize[LOD] / 2f), 0f);
                 else
                     chunk.transform.position = position;
 
                 chunk.GetComponent<MeshFilter>().mesh.subMeshCount = QuixelEngine.materials.Length;
                 chunk.GetComponent<MeshRenderer>().materials = QuixelEngine.materials;
             }
 
             empty = false;
             Mesh mesh = new Mesh();
             mesh.subMeshCount = QuixelEngine.materials.Length;
             mesh.vertices = meshData.triangleArray;
 
             for (int i = 0; i < QuixelEngine.materials.Length; i++)
             {
                 if (meshData.indexArray[i].Length > 0)
                 {
                     mesh.SetTriangles(meshData.indexArray[i], i);
                 }
 
                if (mesh.GetTriangles(i).Length < 3)
                 {
                     mesh.SetTriangles(new int[3] { 0, 0, 0 }, i);
                 }
 
             }
             //mesh.triangles = meshData.indexArray;
             mesh.uv = meshData.uvArray;
 
             mesh.normals = meshData.normalArray;
             mesh.RecalculateBounds();
             mesh.RecalculateNormals();
             mesh.Optimize();
 
             chunk.GetComponent<MeshFilter>().mesh = mesh;
 
             if (LOD == 0 && collides)
                 chunk.GetComponent<MeshCollider>().sharedMesh = null;
                 chunk.GetComponent<MeshCollider>().sharedMesh = mesh;
             meshData.dispose();
             mesh.Clear();
             
 
             renderCheck();
             switch (renderType)
             {
                 case RenderType.BACK:
                     if (chunk != null)
                         chunk.layer = 9;
                     break;
 
                 case RenderType.FRONT:
                     if (chunk != null)
                         chunk.layer = 8;
                     break;
             }
             if (parent != null)
                 parent.renderCheck();
         }











Any Help would be very much appriciated

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

123 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

Related Questions

I can see the outline of my objects but there invisible? 2 Answers

Best way to display a 2D shape from x,y positions 0 Answers

2d Mesh with texture 0 Answers

Why is my mesh not showing outside of an area? 0 Answers

Code generated mesh not visible 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