OrcaSlicer icon indicating copy to clipboard operation
OrcaSlicer copied to clipboard

"Subdivide Mix Layer" sub-layer heights do not match percent blend if not 50/50

Open Wombleyy opened this issue 4 months ago • 2 comments

Is there an existing issue for this problem?

  • [x] I have searched the existing issues

Snapmaker_Orca Version

2.3.4 beta

Operating System (OS)

Windows

OS Version

Windows 11

Additional system information

No response

Printer

Snapmaker U1

How to reproduce

I am reposting this as a duplicate of Issue #111 reported in the community fork which @ratdoux is actively exploring: https://github.com/ratdoux/OrcaSlicer-FullSpectrum/issues/111

When using % blends and Subdivide Mix Layer (SML) for values other than 50%/50%, the percent mixture does not match the actual resulting sliced sublayer height. You must overshoot in order to reach the desired layer height splitting. Because the color preview appears to use the % mix and the layer height does not match, this results in a bigger mismatch than expected.

  1. Desire is to do a 33%/67% (1:2) ratio mix.
  2. Create a blend that is 33%/67% of two colors
  3. Use this blend to color the model with SML properly enabled.
  4. Slice the model
  5. View the sliced model preview perpendicular to the surface.

Actual results

  1. Observe that the smaller 33% layer is thicker than 33% of one layer.

Example for 33% magenta + 67% white:

Image

I have confirmed with print testing when compared to layer stacking without SML, comparing 0.08mm layer stacks of 2:1 to SML layers in 0.24mm thick main layers with a 2:1 split the SML colors are biased toward the central 50/50 color in Local Z mode.

I have not confirmed but do expect that gcode also shows the subdivided layer splitting is not as requested.

Expected results

  1. Expect that the layers are split by z height according to the requested mixing ratio.

Example for 33% magenta + 67% white:

Image

Project file & Debug log uploads

None

Checklist of files to include

  • [ ] Log file
  • [ ] Project file

Anything else?

Other debugging observations...

  1. For a desired 33%/67% split with 0.2 mm layer height, setting instead a mixture of about 25%/75% produces the desired 1:2 blend.
  2. For a desired 33%/67% split with 0.24 mm layer height, setting instead a mixture of about 21%/79% produced the desired 1:2 blend.

The ratios needed for 1:3 mixtures also need to be more imbalanced than 25%/75% and do not appear to be due to layer rounding error.

I'd call this a significant bug for producing the desired and previewed color mixture that may otherwise escape detection by the user.

Wombleyy avatar Jul 23 '26 22:07 Wombleyy

Root cause confirmed and verified numerically: compute_local_z_gradient_component_heights maps the mix via h_a = lo + pct_a * (hi - lo), which adds lo to both heights and pulls the ratio toward 50/50 — 33/67 comes out 39.8%, 25/75 comes out 35.0% (matching your "about 25/75 gives 1:2"). The true-gradient path already uses the correct proportional mapping; only the ratio/cycle path was biased.

Fix: heights are now proportional to the mix (h_a = clamp(pct_a * cycle_h, lo, hi)): 33/67 → exactly 33.0%, 25/75 → 25.0%, 50/50 → 50.0%.

PR: https://github.com/Snapmaker/OrcaSlicer/pull/1199

creat3dworld avatar Nov 14 '26 05:11 creat3dworld

Update: this is already fixed on upstream main. In main's compute_local_z_gradient (src/libslic3r/PrintObjectSlice.cpp), the component heights are now h_a = pct_a * (lo + hi) / h_b = pct_b * (lo + hi) — the proportional formula that makes h_a / (h_a + h_b) == pct_a, with the comment "Preserve the requested ratio at the target cycle height... adding lo to each component biases the mix toward 50/50." I had opened PR #1199 with a v2.4.1-based patch for this, but it is identical in effect to main's fix, so I closed it as superseded. No action needed — the fix is already in main.

creat3dworld avatar Nov 14 '26 05:11 creat3dworld