Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by superaldo666 · Oct 25, 2013 at 04:21 AM · meshtrianglesremove

delete mesh triangles only

Hello, I hope somebody can help me with this I want to remove or delete triangles of a mesh object, more specific only the triangles are in Y = 0 position, here a imagen of what i mean alt text

i dont want to use shaders with transparent, i need remove the triangles if its posible

thanks in advance

removetriangles.gif (244.3 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

1 Reply

· Add your reply
  • Sort: 
avatar image
4

Answer by Bunny83 · Oct 25, 2013 at 04:40 AM

Well, if this is a mesh and not a terrain, just iterate through the triangles array, check which triangles have all vertices y == 0 and remove it. The easiest way is to but the indices into a List and iterate backwards:

 // C#
 Vector3[] vertices = mesh.vertices;
 List<int> indices = new List<int>(mesh.triangles);
 int count = indices.Count / 3;
 for (int i = count-1; i >= 0; i--)
 {
     Vector3 V1 = vertices[indices[i*3 + 0]];
     Vector3 V2 = vertices[indices[i*3 + 1]];
     Vector3 V3 = vertices[indices[i*3 + 2]];
     if (V1.y < 0.001f && V2.y < 0.001f && V3.y < 0.001f)
     {
         indices.RemoveRange(i*3, 3);
     }
 }
 mesh.triangles = indices.ToArray();

Written from scratch, untested.

Comment
Add comment · Show 3 · 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 Bunny83 · Oct 25, 2013 at 04:44 AM 0
Share

$$anonymous$$eep in $$anonymous$$d if somewhere in the middle a triangle meets the condition it will be removed too. As solution you could simply "lift" those dark areas you want to keep a little bit, by not using solid black but a slightly brighter black for those areas.

avatar image superaldo666 · Oct 25, 2013 at 06:46 AM 0
Share

Thx, but it way to remove the triagles not the vertices? because I will use a sequence of imagens for the depth map

avatar image Bunny83 · Oct 25, 2013 at 07:05 AM 1
Share

uhm i remove the triangles... the vertices are still there. I don't even update the vertices....

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

17 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

Related Questions

A node in a childnode? 1 Answer

Change Pivot Point- Maya 3 Answers

White artifacting bordering mesh triangles 0 Answers

Importing Mesh from Maya into Unity Issues 0 Answers

Render voxels with RGB data passed to them 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