mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-05 01:02:08 +00:00
Fix support preview artifacts (missing layers) (#13310)
Fix support preview artifacts caused by incorrect gap subdivision Support generation could sometimes split a gap into too many steps, even when it should fit exactly into a single layer. This was most noticeable when max_suport_layer_height was equal to the print layer height (e.g. 0.2 mm). This resulted in incorrect support layering and visible artifacts in preview. The issue was caused by floating-point precision, where values that should be equal to the configured limit were treated as slightly larger. Fix by biasing the subdivision calculation with EPSILON so near-equal values are not split into extra steps. Applied consistently to: - SupportMaterial (normal supports) - TreeSupportCommon (tree stepping) - TreeSupport (layer creation)
This commit is contained in:
@@ -2882,8 +2882,9 @@ SupportGeneratorLayersPtr PrintObjectSupportMaterial::raft_and_intermediate_supp
|
||||
intermediate_layers.push_back(&layer_new);
|
||||
}
|
||||
} else {
|
||||
// Insert intermediate layers.
|
||||
size_t n_layers_extra = size_t(ceil(dist / m_slicing_params.max_suport_layer_height));
|
||||
// ORCA: Bias by EPSILON so a gap effectively equal to
|
||||
// max_suport_layer_height is not split by floating-point noise.
|
||||
size_t n_layers_extra = size_t(ceil((dist - EPSILON) / m_slicing_params.max_suport_layer_height));
|
||||
assert(n_layers_extra > 0);
|
||||
coordf_t step = dist / coordf_t(n_layers_extra);
|
||||
if (extr1 != nullptr && extr1->layer_type == SupporLayerType::TopContact &&
|
||||
@@ -2898,7 +2899,9 @@ SupportGeneratorLayersPtr PrintObjectSupportMaterial::raft_and_intermediate_supp
|
||||
layer_new.height = extr1->height;
|
||||
intermediate_layers.push_back(&layer_new);
|
||||
dist = extr2z - extr1z;
|
||||
n_layers_extra = size_t(ceil(dist / m_slicing_params.max_suport_layer_height));
|
||||
// ORCA: Recalculate with the same EPSILON bias after re-anchoring at the top
|
||||
// contact layer so near-equal gaps do not gain an extra split here either.
|
||||
n_layers_extra = size_t(ceil((dist - EPSILON) / m_slicing_params.max_suport_layer_height));
|
||||
if (n_layers_extra == 0)
|
||||
continue;
|
||||
// Continue printing the other layers up to extr2z.
|
||||
|
||||
Reference in New Issue
Block a user