sagarpatel2570 / signeddistancefields

Signed distance field demos and examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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!

About

Signed distance field demos and examples


Languages

Language:C# 64.5%Language:ShaderLab 35.5%