Commit Graph

73 Commits

Author SHA1 Message Date
jimmy andrews
a645b04994 make convex decomposition negative space default behavior more consistent to the previous version
#rb jimmy.andrews

[CL 31638046 by jimmy andrews in ue5-main branch]
2024-02-19 22:48:36 -05:00
steve robb
f8d47335a4 Replaced RemoveAt(N, 1, EAllowShrinking::*) with RemoveAt(N, EAllowShrinking::*).
[CL 31626444 by steve robb in ue5-main branch]
2024-02-19 16:51:58 -05:00
jimmy andrews
d37cdbd6ae remove older deprecated code from GeometryCore (FTransformSRT3's Inverse and legacy ExactPredicates methods)
#rb jimmy.andrews

[CL 31499495 by jimmy andrews in ue5-main branch]
2024-02-14 18:26:27 -05:00
jimmy andrews
4701412a75 move the convex decomposition algorithm's MergeBest function arguments into a struct, and add:
a callback to report merges,
 a callback to prevent merges, and
 a bool to control whether the error tolerance allows merges below the target number of parts requested.
#rb rinat.abdrashitov

[CL 31487645 by jimmy andrews in ue5-main branch]
2024-02-14 14:34:19 -05:00
jimmy andrews
841991ad26 Add static helper to convex hull class to compute the convex hull volume for an array of points
#rb rinat.abdrashitov

[CL 31487030 by jimmy andrews in ue5-main branch]
2024-02-14 14:22:44 -05:00
jimmy andrews
f255aca291 add more options to the negative space search of convex decomp, including better version of VoxelSearch
+ add function to set usually-better settings than the defaults (but don't change the defaults, to avoid changing the behavior of any existing usage)
#rb rinat.abdrashitov

[CL 31457317 by jimmy andrews in ue5-main branch]
2024-02-13 20:28:50 -05:00
jimmy andrews
6b33d2a738 robustness improvements for convex decomposition: continue splitting other parts after one part fails to split, add a min part size to stop splitting too-small parts, add thickening for degenerate cases where convex hull could not be constructed, add offset on-tri planes by plane tolerance to generate fewer very thin parts
+ support adding custom negative space, and parallelize negative space search
#rb rinat.abdrashitov


#changelist validated
#virtualized

[CL 31245012 by jimmy andrews in ue5-main branch]
2024-02-06 21:30:32 -05:00
jimmy andrews
653c0036aa Fix convex hull vs sphere test for convex decomposition, and track/exclude degenerate planes from the test
#rb rinat.abdrashitov

[CL 31076102 by jimmy andrews in ue5-main branch]
2024-01-31 19:56:33 -05:00
jimmy andrews
ddcc86e070 fix bug in convex decomposition proximity graph updates on split
#rb David.Hill

[CL 31032909 by jimmy andrews in ue5-main branch]
2024-01-30 20:00:30 -05:00
steve robb
f029468598 Fixed up a lot of bool-taking container resize functions to take EAllowShrinking instead.
[CL 30729174 by steve robb in ue5-main branch]
2024-01-19 16:41:35 -05:00
jimmy andrews
1fb821235a make negative space sampling default to 'deterministic' mode, and make that mode sort the vertices after marching cubes has run rather than disabling parallelism during marching cubes.
also always run the point prioritization step, and don't early-stop it if we may take more samples than the minimum requested.
#rb rinat.abdrashitov

[CL 30169822 by jimmy andrews in ue5-main branch]
2023-12-06 17:30:20 -05:00
jimmy andrews
d0ca302cab in convex decomposition helper function, fix mismatch between parameters listed in comment and actual parameters in method
#rb matija.kecman

[CL 29521381 by jimmy andrews in ue5-main branch]
2023-11-07 10:54:19 -05:00
jimmy andrews
f55e6088b8 Add support for negative space protection in the 'splitting' part of the convex decomposition algorithm + associated initialization / support functions
#rb matija.kecman

[CL 29498286 by jimmy andrews in ue5-main branch]
2023-11-06 15:40:07 -05:00
jimmy andrews
78d8ab4884 deprecate convex decomposition's negative space compute's assumption of default-flipped triangle orientations by making the triangle orientation an explicit function parameter (rather than a settings struct member) and deprecating the old function w/out this parameter.
#rb matija.kecman

[CL 29321127 by jimmy andrews in ue5-main branch]
2023-11-01 12:20:40 -04:00
jimmy andrews
609a443699 Fix performance and memory issues when merging a large number of collision shapes:
- More aggressively prune the cache of computed merge shapes after it reaches a threshold size
 - By default compute a proximity graph based on actual proximity, not the full n^2 possible connections
 - After finding the best of a number of possilbe merges, optionally only look for local improvements to the current best rather than doing a full search for the absolute best connection.

#rb david.hill, shaun.kime

[CL 29158488 by jimmy andrews in ue5-main branch]
2023-10-26 20:24:56 -04:00
jimmy andrews
dcdd199f26 expose out convex decomposition negative space's voxel search 'min voxels per dimension' parameter to the setting structs, rather than hardcoding it as 128
#rb tyson.brochu

[CL 28877619 by jimmy andrews in ue5-main branch]
2023-10-18 11:04:33 -04:00
jimmy andrews
f3260123e2 add outer-only negative space sampling via continuation marching cubes
#rb tyson.brochu, rinat.abdrashitov

[CL 28771065 by jimmy andrews in ue5-main branch]
2023-10-13 16:45:04 -04:00
jimmy andrews
2b6859997b Add geometry script collision functions for converting sphere coverings to/from sphere arrays, to support manually creating/adjusting negative space
#rb david.hill

[CL 28680876 by jimmy andrews in ue5-main branch]
2023-10-11 16:27:36 -04:00
jimmy andrews
ced12de0f4 Add negative space protection to the geometry script collision merging algorithm
#rb david.hill

[CL 28234875 by jimmy andrews in ue5-main branch]
2023-09-26 12:59:58 -04:00
jimmy andrews
2d32fa2e5f Add a MergeSimpleCollisionShapes function to Geometry Script, which can reduce the number of simple collision shapes by merging them. Currently works via convex hull merging, so merged shapes will always be convex hulls, but shapes that are not merged will be left with their original type.
Add a 'source ID' concept to the convex part decomposition, to enable tracking of which hulls were not merged to any other hulls when running the convex hull merging algorithm.

#rb rinat.abdrashitov

[CL 28106868 by jimmy andrews in ue5-main branch]
2023-09-21 17:12:08 -04:00
jimmy andrews
f12520cfcf Add a new k-DOP fitting algorithm to GeometryCore and swap it in to GeomFitUtils so it will be used by the Static Mesh Editor.
#rb rinat.abdrashitov
#rb richard.talbotwatkin
#jira UE-194152

[CL 28048380 by jimmy andrews in ue5-main branch]
2023-09-20 14:46:30 -04:00
jimmy andrews
ce33cacf43 Move TConvexHull3 simplification-related settings to a separate struct, to make it easier to manage these settings (inside the convex hull code and also for other classes that call into it, like convex decomposition)
Note: These settings were all introduced post-5.3, so moving them should not require deprecation

#rb rinat.abdrashitov

[CL 27715888 by jimmy andrews in ue5-main branch]
2023-09-08 12:43:50 -04:00
Jimmy Andrews
7065fe745d Add support for direct construction of a simplified convex hull in GeometryCore's ConvexHull3 via:
1. A MaxHullVertices setting. If positive, the convex hull algorithm will greedily add vertices to best expand the hull, generating a simplified hull if the exact hull would exceed the specified budget.
2. SkipAtHullDistanceAbsolute/SkipAtHullDistanceAsFraction settings. If positive, the convex hull algorithm will ignore points that are closer than the threshold value, resulting in a simpler hull.

Also stop relying on the Orient3 exact predicate to find the farthest hull points (regardless of whether PointsBudget is specified) both so that the PointsBudget and SkipAtHullDistance settings can accurately compare distances from different triangles and also to fix an issue where the Orient3 magnitude was discarded when requesting a single-precision Orient3 value.

Update convex hull unit test to also test these new settings.

Also adds a small optimization the reduces the number of duplicate points considered.

#rb rinat.abdrashitov
#jira none

[CL 27604026 by Jimmy Andrews in ue5-main branch]
2023-09-05 13:49:30 -04:00
jimmy andrews
b8887e57ed Add a new polygon-based simplification method to ConvexHull3, and a tolerance for the initial hull build, to support use cases where we do not need an exact hull and can prioritize using fewer plane + avoiding near-degenerate planes in the output. This simplification is especially effective for cases where a large number of near-coplanar faces would exist in the exact-hull output.
#rb rinat.abdrashitov

[CL 26683043 by jimmy andrews in ue5-main branch]
2023-07-28 15:02:49 -04:00
jimmy andrews
874bb70ad5 Add option to drive adding more negative space samples when the current samples don't cover the space identified by Voxel Search (and are farther apart than the target Sample Spacing), to make the negative space coverage algorithm better able to protect space in challenging cases where a smaller fixed number of samples would fail.
#rb rinat.abdrashitov

[CL 26314665 by jimmy andrews in ue5-main branch]
2023-06-29 11:28:58 -04:00