Skip to content
Signed distance field demos and examples
C# ShaderLab
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Assets
Packages
ProjectSettings
.gitignore
README.md
Unity.PackageManagerUI.Editor.csproj
UnityEditor.StandardEvents.csproj
sdf.csproj
sdf.sln
signeddistancefields.csproj
signeddistancefields.sln

README.md

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!

You can’t perform that action at this time.