From 32b4c8d672984f44b15d7b477b04a4e4413060c8 Mon Sep 17 00:00:00 2001 From: johannes hanika Date: Fri, 21 Feb 2025 17:45:23 +0100 Subject: [PATCH] spectra: shade better and extend outside by inpainting --- src/pipe/modules/pick/display.comp | 3 +++ src/tools/spec/mkspectra.c | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/pipe/modules/pick/display.comp b/src/pipe/modules/pick/display.comp index e509e949..11d1f95c 100644 --- a/src/pipe/modules/pick/display.comp +++ b/src/pipe/modules/pick/display.comp @@ -78,6 +78,9 @@ main() rgb = max(rgb, picked_rgb * vec3(pow(smoothstep(t, 0.0, d), 3))); // on white: // rgb = mix(rgb, picked_rgb, vec3(pow(smoothstep(t, 0.0, d), 3))); + // shade below: + if(ipos.y / float(imageSize(img_out).y) > 1.0-val) + rgb = mix(rgb, picked_rgb, 0.1); } imageStore(img_out, ipos, vec4(rgb, 1)); } diff --git a/src/tools/spec/mkspectra.c b/src/tools/spec/mkspectra.c index b9ca8362..d79bba24 100644 --- a/src/tools/spec/mkspectra.c +++ b/src/tools/spec/mkspectra.c @@ -88,9 +88,9 @@ void init_coeffs(double coeffs[3]) void clamp_coeffs(double coeffs[3]) { double max = fmax(fmax(fabs(coeffs[0]), fabs(coeffs[1])), fabs(coeffs[2])); - if (max > 1000) { + if (max > 100000.0) { for (int j = 0; j < 3; ++j) - coeffs[j] *= 1000 / max; + coeffs[j] *= 100000.0 / max; } } @@ -342,7 +342,7 @@ void parallel_run(uint32_t item, void *data) int ii = (int)fmin(d->max_w - 1, fmax(0, x * d->max_w + 0.5)); int jj = (int)fmin(d->max_h - 1, fmax(0, y * d->max_h + 0.5)); - double m = fmax(0.05, 0.5*d->max_b[ii + d->max_w * jj]); + double m = fmax(0.01, 0.5*d->max_b[ii + d->max_w * jj]); double rgbm[3] = {rgb[0] * m, rgb[1] * m, rgb[2] * m}; double resid = gauss_newton(rgbm, coeffs); @@ -425,6 +425,15 @@ int main(int argc, char **argv) for(int k=0;k sigmoid coeffs + saturation header_t head = (header_t) {