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
0
Question by Benjames · Nov 30, 2013 at 02:29 AM · mesh verticesmesh manipulationmarching cubessimplify

Mesh simplification for Marching Cubes algorithm?

alt text

In the picture you can see the blue wireframe of marching cubes, I drew in the red lines, they represent what I want to accomplish.

Essentially I want to reduce the number of triangles used to accomplish the flat surfaces of the marching cubes algorithm.

Here is another picture to show the shear mad number of triangle that make up a couple flat surface's.

alt text

simplification.png (388.5 kB)
simplification.png (251.6 kB)
Comment
Add comment · Show 11
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 Benjames · Dec 15, 2013 at 11:36 PM 1
Share

I'm slowly but surely working on this. It's see$$anonymous$$gly simple so I should have an answer eventually so check back if your interested.

avatar image Benjames · Dec 24, 2013 at 10:13 PM 0
Share

I've simplified only the surfaces that are parallel with the x y and z axis. Here is a screeny...

alt text

I stored the faces in an array that can be accessed through position.. like array[x,y,z]. Then I checked the face's normals against neighboring faces.

It is all pretty specific to my marching cubes code. I wouldn't be able to simplify models that are loaded in.

screeny.png (156.4 kB)
avatar image cristivp Benjames · Oct 23, 2015 at 11:16 AM 0
Share

Any chance you could post the code for simplifying the mesh faces?

avatar image Benjames cristivp · Oct 23, 2015 at 05:24 PM 0
Share

It is pretty messy and inefficient code but if you can learn something I'm happy to share. Just put the marchsect script on an object and run. The code that handles simplifying is named Gensect.

Let me know if you have any questions. $$anonymous$$aybe one day when I have more time I'll go back and make it efficient.

also please let me know what you think.. even though its older I do appreciate criticism!

Omg stupid linky ..link text

did it work Ill post scripts seperatley if not link text

marching.zip (10.3 kB)
Show more comments
avatar image HappyMoo · Jan 03, 2014 at 10:47 PM 0
Share

Any Updates?

avatar image S0rn0 · Jan 07, 2014 at 04:28 AM 0
Share

Would it be possible to see your source? Just for the marching cubes implementation.

avatar image Benjames · Jan 07, 2014 at 01:12 PM 0
Share

I gave up on the decimating the diaganal faces I'll come back to it.. umm I sappose I could post the source, later though. perhaps tonight.

I'm posting a file of the c# code I'm currently using for a marching cubes level generator. I plan to make a castle full of rooms generated by this code.

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by HappyMoo · Jan 02, 2014 at 02:39 AM

That's interesting... makes me wanna implement marching cubes...

The problem with unity meshes is that they are not easily traversable as they are built for speed and don't have stuff like references to neighboring tris etc. which would help, but maybe you can build some helper classes that allow you to do this and also mark tris etc.

Now... what you would do is start at a triangle and recursively(doesn't have to be implemented that way of course) visit all neighbors with the same (float precision!) normal and gather them all in a group - also mark them, so they wont get visited on the next iteration when you start from an yet unused triangle.


So.. we're having a group of triangles, all connected and complanar. Start with a triangle somewhere and create a bigger and bigger polygon(pink line) by removing the edge to the next neighbor. Here you may need to watch out that you don't break into triangles you already used.

You won't have holes very often like in the example, but if you do, the internal edge connecting the outside with the holes can look very ugly, but some simple rules like always traversing open neighboring triangles ordered by x,y,z will prevent the worst.

After that, traverse all the edges of the new polygon and remove all collinear verts we don't need (blue line). And retriangulate (orange)

http://i.imgur.com/9DammSc.gif

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 Benjames · Jan 06, 2014 at 01:10 PM 0
Share

You'll hear a lot that marching cubes is composed of 14 edge combination but there are more triangle combinations I didn't realize that and I was stuck for while.

Some of the opposite edge combinations require a unique triangle combination.

Oh yah I also didn't realize you are sapposed to check for opposite edge cases, for example the triangle set used for the bottom front left is also used when every edge, except for the bottom front left, is marked or on or checked or whatever. The triangle sets normals are just flipped.

/ the pictures wont post >:(( /

One picture is of the 13-14 origial triangle combinations you can find anywhere.. The other is the 7-8 alt cases that took me a while to find. Ill reupload that one..

alt text

8 alternative cases.gif (66.8 kB)
avatar image HappyMoo · Jan 06, 2014 at 01:35 PM 0
Share

Thanks for the warning. I was also planing to do my list from scratch if I was to implement vanilla $$anonymous$$arching Cubes, however, I found some other interesting algorithms so I'm not sure yet which one to do.

http://swiftcoder.wordpress.com/planets/isosurface-extraction/

It's also not that I actually need it for something currently - I'd do it just for fun, so maybe I'll delay that decision some more.

Can you link to these pictures once more? Seems the server didn't actually upload them. $$anonymous$$aybe because of the spaces and () in the name

avatar image Benjames · Mar 05, 2015 at 06:17 PM 0
Share

I just now relized you had that cool gif image in your post, seems like a good way to do it.

avatar image
0

Answer by Cherno · Mar 05, 2015 at 09:58 PM

Take a look at "greedy mesh" algorithms, and especially take a look (heh, 52 pages and counting!) at this thread:

After playing Minecraft...

Comment
Add comment · 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

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

21 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

Related Questions

Flawed Mesh Manipulation Question! 1 Answer

Ideas/Solutions for finding the outside corner points of a mesh 1 Answer

make one mesh follow the deformations of the other,adjust mesh to follow deformations of another(cloth, hair) 0 Answers

Modular/Procedural Visibility of Meshes 1 Answer

Line of Sight using Mesh ,Line of Sight Mesh 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