• Stars
    star
    104
  • Rank 329,310 (Top 7 %)
  • Language
    C#
  • Created over 6 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Signed distance field demos and examples

Signed Distance Fields

Welcome to the signed distance fields repo. This contains the sample code for the signed distance field series at https://shaderfun.com/.

Whilst the repo is focussed on the blog, it is designed to be a simple toolkit for generating and rendering signed distance fields. Currently it is focussed on 2D fields, and supports:

  • Rendering a field texture on screen using a variety of different demo algorithms
  • Generating a distance field from explicit primitives such as circles, lines, rectangles
  • Generating a distance field from an image, with simple handling for anti aliased images
  • Sweeping a field using either 8PSSDT sweep or a brute force eikonal algorithm
  • Downsampling
  • Softening

Effects in the demo so far:

  • Simple visualisation of the field
  • Creating soft borders to avoid aliasing
  • Edging effects such as gradients or neon glows
  • Drop shadows
  • Morphing between fields

Enjoy!