Fabrizio Bergamo

Real-Time FX & Tech Art

2D SDF – Combine Shapes

Material Function Library UE5

This is the Second Part of a 2D Sign Distance Field Material Function Library I created for Unreal Engine.
SDFs can be used in various different ways, in this case, they are very powerful and useful when creating materials. Here you can see different ways shapes can be combined.
Check out the blog post guide about this topic, where I explain everything you can see here as well as some tips for making your own Material Function Library.

Here’s the first part if you need an introduction.


Morphing from one shape to another


SDF of the shapes used in the examples below


Merge, Intersect and Subtract


Rounded versions

Merge Rounded

Intersect Rounded

Subtract Rounded


Champfer versions

Merge Champfer

Intersect Champfer

Subtract Champfer


Groove Border


New coordinates using the SDF of the two shapes


Circular Shapes

Generated using the new coordinates shown above (their location is at 0;0, so where the two example shapes intersect)