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
1
Question by magic9cube · Dec 19, 2017 at 11:07 PM · voxelvoxelsmarching cubes

How to remove small & thin triangles from a marching cubes voxel engine?

Is there a method for customizing marching cubes cases or another processing approach to remove small & thin triangles?

See example of problem here; https://youtu.be/DFr6RJQEcpA

Comment
Add comment · Show 2
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 nt314p · Dec 20, 2017 at 12:44 AM 0
Share

Where's the example? Could you post some pictures?

avatar image magic9cube nt314p · Dec 20, 2017 at 01:01 AM 0
Share

sorry, original link didn't work. should be there now; https://youtu.be/DFr6RJQEcpA

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Bunny83 · Dec 20, 2017 at 01:11 AM

This question doesn't make much sense, even with an example. Marching cubes works with exactly 256 predefined triangle configurations (actually only 15 in you remove all symmetrical duplicates) if you "remove" any of the triangles you no longer get a closed mesh.


So either you actually do not talk about marching cubes or you do something really strange.


edit. OK since you now posted the video it seams you don't really talk about thin triangles (triangles are two dimensional shapes) but simply about small voxel clusters.

This "problem" should not be solved by changing the marching cubes algorithm. It's a pure rendering algorithm. You should try solving this when editing your voxel data. However there's not really an easy, straight forward solution. When removing a spherical section of your data you should check the surrounding data for integrity. So you might want to remove such small left over clusters automatically.

Comment
Add comment · Show 1 · 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 magic9cube · Dec 20, 2017 at 01:24 AM 0
Share

It doesn't make sense? I'm talking about a modification to the predefined triangle sets or a post processing of resulting mesh to solve the thin/small triangle cases.

If it takes something strange to make this work, i'd like to hear about it.

avatar image
2

Answer by tomaszfoster · Jan 23, 2018 at 04:36 PM

So marching cubes will have those triangles but you can use an alternative method like Naive Surface Nets.

Mikola Lysenko discusses in detail the different methods on his blog: https://0fps.net/2012/07/12/smooth-voxel-terrain-part-2/

and if you're looking for a C#/Unity solution I have the code available on GitHub with detailed comments. Maybe it'll help: https://github.com/TomaszFoster/NaiveSurfaceNets

Comment
Add comment · Show 5 · 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 magic9cube · Jan 23, 2018 at 09:44 PM 0
Share

Thanks $$anonymous$$asz, I spent much time with $$anonymous$$ikola's brilliant js code for this but could not get it to work correctly in C#. I am very grateful you have made this publicly available.

I will see if i can adapt your code to work with a density array. From what i can see it should be a matter of swapping out your sampling function?

avatar image tomaszfoster · Jan 24, 2018 at 02:49 AM 0
Share

$$anonymous$$y implementation differs in that I pulled out each step into its own function. It’s not as efficient but it should be much easier to understand.

First you create a 3d grid of voxels, then you find the weighted averages for each voxel based on what tolerance you have set and save only voxels which have intersections into a new list, then you create the triangles for the voxels you’ve just made. If you already have a voxel grid and have calculated the weighted averages, you could probably just use the triangulation function.

If you have any questions or if I didn’t explain something let me know and I’ll see if I can help. Best of luck!

avatar image magic9cube tomaszfoster · Jan 24, 2018 at 12:19 PM 0
Share

I like what you've done. It is much easier to understand. Some of the areas i still don't know exactly what's going on, it's a lot for my $$anonymous$$d to unpack.

I had a go at implementing it but still missing a few bits. I may just need to get back to basics to see where i've messed up.

Any feedback or suggestions would be welcome. I've posted screenshots and the modified code of yours i'm testing in my engine. http://www.nuzly.com/

avatar image tomaszfoster magic9cube · Jan 24, 2018 at 02:30 PM 0
Share

I'm glad that helped. It took me days to go through and try to make everything work and I could probably clean up some of the names for more clarity and add some better documentation. Converting from JS to C# was a bit weird since one is dynamic and one is statically typed but it worked!

What bits are you missing? I saw that you switched the order of this operator corner$$anonymous$$ask |= ((sample < threshold) ? (1 << i) : 0); from sample > threshold to sample < threshold.

Also I noticed your images don't load for me on Chrome or Safari, I got a 500 URL rewrite error

Show more comments

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

76 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

Related Questions

Generating scalar field for a sphere 1 Answer

How can I smoothen my cubic mesh using marching cubes? 0 Answers

Rounding edges of cubes (Voxels and Marching Cubes) 1 Answer

Question about slideScrolling Voxels 0 Answers

How to make a smooth voxel world 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