Plug-In Request: Make Model BSP Compatible.
-
These are some nice results!
I'm more of a visual person, and I don't quite understand these steps, especially step0. An animation would make things more clear for me, but it seems like it is a recursive concept; repeatedly dividing solids at special locations until they are convex.
In physics engines there is a simple way to calculate whether two convex solids intersect, i.e detect collision. When it comes to concave solids, things get more complex. Concave solids can only be static (tree or scene) collisions or be divided into convex solids and be a dynamic collision formed as compound - an array of convex solids glued together. Developers usually divide their solids into various convex shapes (manually or using VHACD) and then form them as compounds. Your algorithm would be very useful to divide solids into convex hulls automatically, just like VHACD, but with complete accuracy and good results.
I'm glad the models helped you improve your algorithm. I'll be glad to test it in various other cases once you release it.
Also, does it work with non-solids? And it does matter which side the face normal is point at, right?
-
Anton,
Here is a short animation to illustrate the algorithm.
Also, I understand now the relation with Physics engines. The algorithm uses #intersect_with, so it has to create some geometry. However, it is easy to
- create the convex solids on a specific layer, so that you can easily associate each original solid to its convex decomposition
- Transform the convex decomposition in whatever data form suitable to the physics engine to manage collisions and delete the convex solids.
The algorithm should work on 'pseudo-solids' that is solids where all edges are bordered with 1 or 2 faces (but not more than 2)
The orientation of normals is important to detect concavity of edges. Here too, it is possible to give some flexibility based on solid topology.
Fredo
-
Very nice animation, Fredo!
For ziiars purpose, creating geometry is what he needs, but when implementing this to my physics engine, I would avoid creating any geometry and try computing all intersections in a function.
` # Get all convex hulls from mesh.@param [Sketchup::Group] group
@return [Array<ArrayGeom::Point3d>] An array of convex hulls.
Each convex hull represents an array of points.
def get_convex_hulls(group)
#...
end`Then, each of these convex hulls (an array of points) could be passed to a function in physics SDK to create convex collisions from them, as Newton Dynamics Physics SDK only asks for an array of points to create a convex hull.
Although, I'm not asking you to make it the way I requested. What I'll need is the peace of code that subdivides solid into convex hull. Then I could replace the intersect_with function with a custom function to avoid creating any geometry.
Good to know that it works with 'pseudo solids'. Will be useful.
Also, you could add 'max concavity angle' parameter to your algorithm to avoid sub-diving if angle between concave edges is greater than the 'max concavity angle'. I.E control generated 'resolution'.
-
Anton,
I am afraid my implemnetation is fully based on Sketchup, not just for intersection, but for the topological relationships between edges, faces, etc....
I can adapt an API that can deliver the output as a hierachical matrix of points for groups and faces, leaving the model intact (either doing an abort_operation, or deleting all intermediary groups created).But, if you plan to build it in C++, the best is to write a native version from the algorithm. As I said, it is fairly simple, and since you do not care with the esthetics of the decomposition, it can even be simpler. I can send you the details of algorithm, so that based on your C++ environment to describe the toplogy, you see how to adapt it to integrate with the Physics engine.
Fredo
-
By the way, the algorithm happens to work on 'open solids', that is solids where edges are connected to 2 or 1 faces.
However, I am not sure the result is useful, as it gives potentially open solids too.
Fredo
-
Good! You can PM the code and I'll do my best in implementing it to C++.
-
Hi, this all looks fantastic! Fredo, could you send me the plug-in or are you still working on it?
Thanks!
-
@ziiar: I will publish in a few days. Actually, it needed some time to make the algorithm more robust.
Here is the Convexification of a complex model by Pilou. Not a lot of faces (672 faces), but a lot of concave edges (320) and not a true solid (there are some inner faces).
It took 20 seconds to compute, 40 seconds to Commit!
Here is the model
Convexify - Model by Pilou.skpFredo
-
I am looking for that. Make a BSP file sometimes is a pain.
Anton and Fredo, keep doing a excellent work.+1 for this awesome plugin.
-
So, I agree 100%. The implementation in Physics would be a big step. As a plugin to prepare concave models for physics it would be very useful.
-
Sorry for this question but is there some news? Some progress? I am so excited about this plugin.
Advertisement