# Antialiased Step Material Function.

**URL:** <https://forums.unrealengine.com/t/antialiased-step-material-function/1372477>\
**Category:** Rendering\
**Tags:** tutorial, unreal-engine\
**Created:** [November 8, 2023, 3:20am UTC](https://forums.unrealengine.com/t/antialiased-step-material-function/1372477 "2023-11-08T03:20:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BananableOffense](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BananableOffense](https://forums.unrealengine.com/u/BananableOffense)\
**Post date:** [November 8, 2023, 3:20am UTC](https://forums.unrealengine.com/t/antialiased-step-material-function/1372477/1 "2023-11-08T03:20:58Z")

</div>

Hey folks, I came across [blog post](https://drewcassidy.me/2020/06/26/sdf-antialiasing/) recently and thought others may be interested in it as well. Basically, it talks about antialiasing distance fields, or any gradient really. Normally, in the past I’d use Step or Smooth Step to threshold these gradients. But this always resulted in ugly aliasing. The blog post described how to combat this, and I spun up a quick material function to implement it and was happy enough with the results I thought I’d share.

I’ll let the comparison speak for itself:  
[Slider Comparison](https://cdn.knightlab.com/libs/juxtapose/latest/embed/index.html?uid=eb50fb1e-7de1-11ee-9ddd-3f41531135b6)

[Here’s a pastebin with the MF nodes](https://blueprintue.com/render/kbx_d4x1/)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/4/7e49db2ac901a4b99ef6c22e8c4ca5e0ccb15138.png)

The SDF works just like the Y on a step.  
Threshold works like the X on a step.  
Width acts kind of like the range between min and max on a smooth step if you want to soften the edge a little bit.

Anyway, hopefully this is useful to someone.

Edit: In case you have issues with the slider comparison, here are the images:  
Regular Step Function:

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/3/f/a3f2d8de9675efdda70ba84cb88aef97a36a1979.png)  
Screenspace AA Function:  
 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/f/9dff67cc9be8bb9434e1934de3b23c9c0427e010.png)

---

<div class="post-metadata">

**Author:** ![Potion\_5eller1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Potion\_5eller1](https://forums.unrealengine.com/u/Potion_5eller1)\
**Post date:** [October 2, 2025, 1:05pm UTC](https://forums.unrealengine.com/t/antialiased-step-material-function/1372477/2 "2025-10-02T13:05:29Z")

</div>

Two years in the future I need to let you know that this is awesome, it helped me a lot and solved a particularly annoying issue we were having!  
If I could buy you a coffee I would!

---

<div class="post-metadata">

**Author:** ![CerebralFrost\_EH](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CerebralFrost\_EH](https://forums.unrealengine.com/u/CerebralFrost_EH)\
**Post date:** [December 11, 2025, 8:50pm UTC](https://forums.unrealengine.com/t/antialiased-step-material-function/1372477/3 "2025-12-11T20:50:19Z")

</div>

Same - using fresnel with a step to do an ‘inline’ kind of effect, and the aliasing is horrible - this is a great fix, thank you!
