#distance-field #image #resolution #input #lower #generate #preferably

bin+lib sdfgen

SDFGen generates a (preferably) lower resolution distance field from an input image

5 releases

0.6.3 Jun 13, 2021
0.6.2 Jun 13, 2021
0.6.1 Jun 13, 2021
0.6.0 Jan 26, 2021
0.5.1 Jan 20, 2021

#8 in #lower

Download history 1/week @ 2024-06-26 25/week @ 2024-07-03 31/week @ 2024-07-24

57 downloads per month

MIT license

14KB
200 lines

sdfgen

DO NOT USE IN PRODUCTION IF YOU ARE SANE. This package is not actively maintained and performs suboptimally to say the least.

Alternatives

SDFGen generates a (preferably) lower resolution distance field from an input image. This distance field can be upscaled fast with bilinear filters built into gpus nowadays. Final sharp output of this upscale can be extracted using a threshold filter. With the default parameters in this program, threshold should be set to about 99%.

Building the project

cargo build --release

Without the release flag, the execution time can be up to 10 times slower.

Running the project

  ./target/release/sdfgen [OPTIONS]
Optional arguments:
  -h,--help             Show this help message and exit
  -v,--verbose          Be verbose
  -f,--file FILE        filepath of the input image. Defaults to
                        "images/sdf500.png"
  -s,--scale SCALE      Scale of the distance field. For example resolution
                        500x500 becomes 250x250 with scale 2 and 125x125 with
                        scale 4. Defaults to 32.
  -t,--threads THREADS  Number of assigned threads. Defaults to 8.
  -V,--version          Show version

License: MIT

Dependencies

~6MB
~75K SLoC