-
Notifications
You must be signed in to change notification settings - Fork 111
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
Mesh simplification after warp is often undesirable #673
Comments
Yeah, honestly I've been wondering about this myself. This is a good example of the problem, thank you. I've also had this problem when trying to apply properties to a warped mesh - the properties would keep it from being simplified, but I can't get them on in time. It would easy enough to add a public Agreed, input welcome. |
I’d find a public For interactive modeling applications, it would be nice to have an explicit mechanism to keep redundant facets down for runtime speed and stability, while ensuring manifold-ness. |
This is how our library work now, automatically. This ask to not do that in the case of warp. |
This is diverging from the OP, but I f I were to cut an object with a new hull every frame (sweeping the convex tool from the previous frame to the current frame), would it still be able to simplify the facets on the cuts? I was under the impression that hulls have unique Mesh IDs, which prevents the simplification process… Either way, a method of explicitly overriding the Mesh IDs and forcing a simplification to some tolerance would be nice… unless it’s the IDing that allows it to maintain manifoldness? And for the OP, perhaps the current auto-simplification functionality could be tied to ManifoldParams? |
@zalo - instead of speculating, can you make an example and file a new issue with the simplification problem you see? I don't think it has anything to do with Warp (OP) and I also think it's already working as you desire. |
Sorry, I thought you were addressing just this comment:
My bad! Here's what I was getting at with it though; replicating the OP: TEST(Manifold, WarpSimplify) {
Manifold m = Manifold::Extrude(CrossSection::Circle(10.0, 64), 30, 128);
Manifold ConeHorn = m .Warp([](glm::vec3& pos) {
pos.x *= std::clamp(pos.x / 5.0f, 0.0f, 1.0f);
pos.y *= std::clamp(pos.y / 5.0f, 0.0f, 1.0f);
}).Warp([](glm::vec3& pos) {
pos.x *= -pos.x / 20.0f;
pos.y *= -pos.y / 20.0f;
});
Manifold HornCone = m .Warp([](glm::vec3& pos) {
pos.x *= -pos.x / 20.0f;
pos.y *= -pos.y / 20.0f;
}).Warp([](glm::vec3& pos) {
pos.x *= std::clamp(pos.x / 5.0f, 0.0f, 1.0f);
pos.y *= std::clamp(pos.y / 5.0f, 0.0f, 1.0f);
});
EXPECT_EQ(ConeHorn.NumVert(), HornCone.NumVert());
} This test fails... but if I wrap the sequence in The hull use-case IS likely addressed with |
Good point, we did just add |
So I got the impression that lib manifold is marketing itself as more of a backend lib, where the users are primarily people building software on top. If that's the case I would think it's best to offer more granular and non-overlapping APIs (such as |
Are you suggesting I add |
Yes, I agree, I don't love the system as it currently stands. Quick recap of how we got here:
|
Interesting. I can easily imagine it would be useful sometimes to disable simplifying boolean ops too, in cases very similar to my original example here, where you create extra points intentionally so you can chain a bunch of manipulations for complex contours. Perhaps this points to a taking an optional/defaulted argument in the modifier APIs. You could nest it in a struct, so future options don't bloat the function signature.
|
You should give it a try. We never simplify out the actual intersection lines the Boolean creates, so I think it'll already do what you want. |
Sorry, I'm not sure what you mean. |
What I mean is, create an example of "create extra points intentionally so you can chain a bunch of manipulations for complex contours." I think I know what that means, and if I'm right, I believe it will already work the way you expect, with no need for options. If not, then I'll understand the problem better. Writing a |
Ah yes, I see what you mean now, thanks. I think I'd prefer to solve this problem using |
Nice, thanks for the quick warp fix. Also I was thinking RefineToLength would be a sweet feature the other day, as a means to make smoothing more useful in practice. Auto triangulation tends to generate a lot of very-thin triangles that don't smooth well. |
It seems that co-planar triangles get automatically merged after a warp operation. But this is problematic when chaining warp operations for complex shape modeling.
Here for example, I make a detailed cylinder mesh and apply 2 warps. Notice that
cone
leaves most of the vertices unchanged, whilehorn
applies a curve modifying everything.If we apply the curve op first, triangles are not coplanar, so the result is as expected.
But if we apply the linear op first, many triangles get merged and the result is unexpected.
In this trivial example, sure user can just debug it, rearrange warps, or merge them in a single step. But in practice there can be boolean ops in between warps, and no simple workaround. And I've also run into this triggering intermittently when using warp functions like tanh that apply curves locally and asymtotically small deltas elsewhere - and those parts saw "random" merging of triangles as it probably danced around the epsilon threshold.
I'm thinking this behavior should be optional at a minimum, and possibly disabled by default. What do others think?
The text was updated successfully, but these errors were encountered: