In addition to the regular edge collapse, we now allow the simplifier to
remove small isolated components. Components that are removed are below
the error threshold in size and as such should not noticeably contribute
to the overall rendering of the object.
This helps simplify topologically complex but small parts of larger
meshes and more comfortably reach the LOD targets.
In some cases, pruning can cause the last LOD to shrink to 0 triangles
which may prevent a slightly larger LOD from being used at the maximum
distance; in this case we retry simplification without pruning once.
Instead of simplifying every LOD from the original down to an
increasing number of triangles, we simplify each LOD from the previous
LOD and stop when the simplification can't proceed further.
This has a few benefits:
- It's significantly faster; using sparse flag helps ensure that
subsequent simplifications after the first one are increasingly
cheaper.
- It results in higher quality attributes on generated LODs; attribute
quadrics reduce the quality of attribute preservation the more they
are accumulated, so recomputing them from intermediate geometry helps.
- It results in monotonic appearance: if a feature is reduced in a
higher LOD, it will stay reduced or get reduced more significantly in
lower LODs. This is not a significant problem right now, but can be
helpful to ensure if the number of LODs increases or some newer
features get enabled.
- Makes `is_layout_rtl()` translation domain aware
- Makes various text-drawing controls translation domain aware
- Makes translation preview use the project's fallback locale when disabled
This significantly improves LOD quality for skinned objects, especially
if the skinned object geometry is very simple (e.g. planar or
cylindrical) in bind pose.
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
- Revert meshoptimizer patch; the metric used for LOD selection now
incorporates attribute error
- Since LOD selection is now aware of attribute deviation, we don't
need to use a higher normal weight
- To prevent normal creases from creating input triangles with very
large normal deviation, reduce default normal merge threshold
- Since we now use combined metric to select LODs, we never need LODs
with error>1 as these should not be selected if the mesh is visible.
When importing meshes with vertex colors, we will now supply them to the
simplifier as attributes with weight=1 (in addition to normals). This will
guide the simplification to preserve regions where vertex colors change.
For this change to take full effect, it is also necessary to respect the
full error when selecting LODs; this change does not do that yet, so there
are going to still be cases where vertex colors change abruptly during LOD
switch in a visible manner.
GLOBAL_GET is an expensive operation which should not be used each frame / tick.
This PR adds macros which do a cheaper revision check, and only call the expensive GLOBAL_GET when project settings have changed.
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
Adds a few checks to ensure a debug collision mesh contains mesh data before
attempting to add it to the gizmo draw list. This prevents errors when using
SeparationRayShape3D, which is only intended to draw a single line, and
contains no mesh data.
Closes#100665