mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-15 11:51:33 +00:00
Treat an image with no colour spread as flat, not as a ramp
The axis-coverage signal defaulted to 1, meaning "spans its range", which is what a ramp measures. An image of a single colour has no axis to measure, so it kept that default and stopped counting as flat - the most flat image there is. It broke the slic3rutils test that feeds mix_targets() a uniform 8x8. Zero is the right default: an unmeasurable axis leaves the flat-share test deciding on its own, exactly as before this signal existed. That also covers an image with too few pixels to fit an axis through.
This commit is contained in:
@@ -754,7 +754,9 @@ TextureDetail analyze_texture_detail(const TextureDisplacementLayer &layer)
|
||||
|
||||
// Both signals, because either alone misreads a common case: the histogram calls a
|
||||
// two-colour gradient flat (measured 0.90 on a green-to-red ramp, and 0.96 on a painted
|
||||
// model texture), while coverage alone would call a noisy two-colour logo a gradient.
|
||||
// model texture), while coverage alone would call a noisy two-colour logo a gradient. An
|
||||
// image whose axis could not be measured keeps coverage at 0, so the flat-share test decides
|
||||
// alone - which is what an image of a single colour needs.
|
||||
out.flat_colors = out.flat_share >= 0.85f && out.axis_coverage < 0.25f;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(g_texture_detail_cache.mutex);
|
||||
|
||||
@@ -508,7 +508,11 @@ struct TextureDetail
|
||||
// covers it end to end; a few flat colours sit in spikes with gaps between them. The histogram
|
||||
// above cannot tell those apart - a two-colour gradient occupies as few bins as the two colours
|
||||
// on their own - so both are needed before an image counts as flat.
|
||||
float axis_coverage = 1.f;
|
||||
//
|
||||
// Zero when there was nothing to measure: an image of one colour, or too few pixels to fit an
|
||||
// axis through. That is the right default, because it leaves the flat-share test deciding on its
|
||||
// own, exactly as it did before this signal existed.
|
||||
float axis_coverage = 0.f;
|
||||
bool flat_colors = false;
|
||||
};
|
||||
TextureDetail analyze_texture_detail(const TextureDisplacementLayer &layer);
|
||||
|
||||
Reference in New Issue
Block a user