Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intersection creates artifact #11

Open
brookman opened this issue Jan 16, 2020 · 6 comments
Open

Intersection creates artifact #11

brookman opened this issue Jan 16, 2020 · 6 comments

Comments

@brookman
Copy link

When I intersect a standard cube and a standard sphere there is an artifact in the corner:
image
It doesn't matter if I move the objects. The problem also appears if there are no zero-width situations.

@TomTales
Copy link

TomTales commented Feb 6, 2020

I have the same issue. I tried detecting these and removing them by doing an 'island' detection, but when you're doing loads of intersection sooner or later some fail.

@JaineshPathak
Copy link

JaineshPathak commented Mar 9, 2021

I have the same issue. I tried detecting these and removing them by doing an 'island' detection, but when you're doing loads of intersection sooner or later some fail.

Hi.

I am interested in Island detection you mentioned. Can you help me out?

@TomTales
Copy link

Hi.

I am interested in Island detection you mentioned. Can you help me out?

Well it's been a while, but at the time I did get it partially working. Basically what I did is I selected a vertex and added the 3 vertices that are part of the triangle to a list of discovered vertices. Then for each of those vertices, I searched for another vertex that's in the same position but part of another triangle and add that to the list together with the other two vertices that are part of that triangle. When a vertex is already in the list you do not check its neighboring vertices. Sooner or later there will be no new vertices to check and you've found an island. Then repeat if necessary for a vertex that isn't in the first island or you can just delete all triangles/vertices that aren't in the bigger part, assuming there are at max two islands.
Please note that this algorithm sucks and will never be fast enough to use effectively. It is however good and fun practice.
For me this still left some artifacts so I actually wrote my own boolean operator for meshes, which turned out to work really well with no artifacts I could find, but once again it was very very slow, so not very practical.

Hope this helps!

@JaineshPathak
Copy link

JaineshPathak commented Mar 19, 2021

Hi.
I am interested in Island detection you mentioned. Can you help me out?

Well it's been a while, but at the time I did get it partially working. Basically what I did is I selected a vertex and added the 3 vertices that are part of the triangle to a list of discovered vertices. Then for each of those vertices, I searched for another vertex that's in the same position but part of another triangle and add that to the list together with the other two vertices that are part of that triangle. When a vertex is already in the list you do not check its neighboring vertices. Sooner or later there will be no new vertices to check and you've found an island. Then repeat if necessary for a vertex that isn't in the first island or you can just delete all triangles/vertices that aren't in the bigger part, assuming there are at max two islands.
Please note that this algorithm sucks and will never be fast enough to use effectively. It is however good and fun practice.
For me this still left some artifacts so I actually wrote my own boolean operator for meshes, which turned out to work really well with no artifacts I could find, but once again it was very very slow, so not very practical.

Hope this helps!

Sorry for late reply. I know its weird to ask, but is it possible for you to share your code? I have written a script myself where mesh splitting works, but the game freezes in between while doing splitting operation.

I can share my code as well.

@TomTales
Copy link

Sorry for late reply. I know its weird to ask, but is it possible for you to share your code? I have written a script myself where mesh splitting works, but the game freezes in between while doing splitting operation.

I can share my code as well.

Oh boy. Man, I still have the projects but it's such a mess and it's multiple attempts mixed together. Like honestly, it would probably take you more time to figure out what the code means than to try and implement the crude algorithm I described.
As for the freezing, yes, it's slow. Mine is just as slow. I would advise you to focus on understanding how it works and writing your own implementation before remotely trying to get it to be performant enough to use without freezing or stuttering. If you don't need it to be real-time you could try making it asynchronous, but yeah, sounds like you're almost at the point where I stopped messing with mesh fracturing.

If you really want then here are the scripts I made. Good luck!
Scripts.zip

@JaineshPathak
Copy link

Sorry for late reply. I know its weird to ask, but is it possible for you to share your code? I have written a script myself where mesh splitting works, but the game freezes in between while doing splitting operation.
I can share my code as well.

Oh boy. Man, I still have the projects but it's such a mess and it's multiple attempts mixed together. Like honestly, it would probably take you more time to figure out what the code means than to try and implement the crude algorithm I described.
As for the freezing, yes, it's slow. Mine is just as slow. I would advise you to focus on understanding how it works and writing your own implementation before remotely trying to get it to be performant enough to use without freezing or stuttering. If you don't need it to be real-time you could try making it asynchronous, but yeah, sounds like you're almost at the point where I stopped messing with mesh fracturing.

If you really want then here are the scripts I made. Good luck!
Scripts.zip

Thank you so much for the scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants