Uploaded June 2021 | Updated September 2026, 2 weeks ago
✔️ Tested in 2020.3 ➕ 2021.1
Squares, boxes, and rounded rectangles are all common shapes you might want to draw in a shader. In this video, I show you how to do that using 2D signed distance fields, or SDFs. We'll derive the formula, recreate it in the shader graph, and then make some cool shaders to see it in action: including a mouse-controlled rectangle drawer, rainbow SDF visualizer, and procedural brick wall.
👋 Subscribe for weekly game development videos!
► youtube.com/c/nedmakesgames?sub_confirmation=1
👑 Join my Patreon to watch videos early, download all project files, vote on future topics, and more! Thank you so much!
► patreon.com/nedmakesgames
🔗 Check out my website for a searchable list of tutorials!
► nedmakesgames.github.io
2️⃣ 2nd Channel ► youtube.com/nedmakesgames2
🔴 Twitch ► twitch.tv/nedmakesgames
🐦 Twitter ► twitter.com/nedmakesgames
🎮 Discord ► discordapp.com/invite/ubxSVBK
📸 Instagram ► instagram.com/nedmakesgames
👽 Reddit ► reddit.com/u/nedmakesgames
🎶 TikTok ► tiktok.com/@nedmakesgames
☕ Ko-fi ► ko-fi.com/nedmakesgames
🎬 Previous videos
► Line segment: youtu.be/D_Zq6q1gnvw
💬 Video transcript
► docs.google.com/document/d/1ZTV7D4ZL2DkgrMd-s4ZG4VA0LJNHgaCwpR4y7DCnMzs/edit?usp=sharing
⏲️ Timestamps:
0:00 Intro
0:19 Deriving the SDF
4:09 SDFs in Shader Graph
5:11 Mouse driven rectangle drawing
6:15 Rainbow SDF visualizer
6:46 Procedural brick wall
7:26 Wrap up and credits
🎖️ Credits, references and further reading:
• Inigo Quilez: 2D SDF formulas - iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
• Alan Zucconi: A Gentle Primer on 2D Rotations - alanzucconi.com/2016/02/03/2d-rotations
• Academo: 2D Rotation about a point - academo.org/demos/rotation-about-point
Music:
Ouroboros by Kevin MacLeod
Link: incompetech.filmmusic.io/song/4996-ouroboros
License: filmmusic.io/standard-license
#GameDev #IndieDev #Unity
✔️ Tested in 2020.3 ➕ 2021.1
Squares, boxes, and rounded rectangles are all common shapes you might want to draw in a shader. In this video, I show you how to do that using 2D signed distance fields, or SDFs. We'll derive the formula, recreate it in the shader graph, and then make some cool shaders to see it in action: including a mouse-controlled rectangle drawer, rainbow SDF visualizer, and procedural brick wall.
👋 Subscribe for weekly game development videos!
► youtube.com/c/nedmakesgames?sub_confirmation=1
👑 Join my Patreon to watch videos early, download all project files, vote on future topics, and more! Thank you so much!
► patreon.com/nedmakesgames
🔗 Check out my website for a searchable list of tutorials!
► nedmakesgames.github.io
2️⃣ 2nd Channel ► youtube.com/nedmakesgames2
🔴 Twitch ► twitch.tv/nedmakesgames
🐦 Twitter ► twitter.com/nedmakesgames
🎮 Discord ► discordapp.com/invite/ubxSVBK
📸 Instagram ► instagram.com/nedmakesgames
👽 Reddit ► reddit.com/u/nedmakesgames
🎶 TikTok ► tiktok.com/@nedmakesgames
☕ Ko-fi ► ko-fi.com/nedmakesgames
🎬 Previous videos
► Line segment: youtu.be/D_Zq6q1gnvw
💬 Video transcript
► docs.google.com/document/d/1ZTV7D4ZL2DkgrMd-s4ZG4VA0LJNHgaCwpR4y7DCnMzs/edit?usp=sharing
⏲️ Timestamps:
0:00 Intro
0:19 Deriving the SDF
4:09 SDFs in Shader Graph
5:11 Mouse driven rectangle drawing
6:15 Rainbow SDF visualizer
6:46 Procedural brick wall
7:26 Wrap up and credits
🎖️ Credits, references and further reading:
• Inigo Quilez: 2D SDF formulas - iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
• Alan Zucconi: A Gentle Primer on 2D Rotations - alanzucconi.com/2016/02/03/2d-rotations
• Academo: 2D Rotation about a point - academo.org/demos/rotation-about-point
Music:
Ouroboros by Kevin MacLeod
Link: incompetech.filmmusic.io/song/4996-ouroboros
License: filmmusic.io/standard-license
#GameDev #IndieDev #Unity
![Emulating Chat! Twitch Concentration, Unity Game Dev Log [Part 4]
Im making games in Unity! Please subscribe so you wont miss a video. I Stream every weekday!
This project is a Twitch-integrated pair-matching, Concentration like game. Viewers guess pairs in chat, and the pairs are viewer logos!
Twitch ► https://www.twitch.tv/nedmakesgames
Twitter ► https://twitter.com/nedmakesgames
Discord ► https://discordapp.com/invite/ubxSVBK
Instagram ► https://instagram.com/nedmakesgames
Tutorial Tuesday Submission ► https://forms.gle/vdEWUj49dVA5aTud9
Projects GitHub ► https://github.com/NedMakesGames?tab=repositories Emulating Chat! Twitch Concentration, Unity Game Dev Log [Part 4]](https://i.ytimg.com/vi/X4yXMygsbLA/mqdefault.jpg)
![Chat Enters the Game! Twitch Concentration, Unity Entities Game Dev Log [Part 12]
Im making games in Unity! Please subscribe so you wont miss a video. I Stream every weekday!
This project is a Twitch-integrated pair-matching, Concentration like game. Viewers guess pairs in chat, and the pairs are viewer logos!
Twitch ► https://www.twitch.tv/nedmakesgames
Twitter ► https://twitter.com/nedmakesgames
Discord ► https://discordapp.com/invite/ubxSVBK
Instagram ► https://instagram.com/nedmakesgames
Topic Request Submission ► https://forms.gle/vdEWUj49dVA5aTud9
Projects GitHub ► https://github.com/NedMakesGames?tab=repositories Chat Enters the Game! Twitch Concentration, Unity Entities Game Dev Log [Part 12]](https://i.ytimg.com/vi/XWFuYlgPXOA/mqdefault.jpg)

![Textures on the Map! Tactical Lizard Tamer, Unity Game Dev Log [Part 145]
Im making a game in Unity! It will be a mixture of Pokemon teambuilding on a Fire Emblem / Final Fantasy Tactics style-map. Players will be able to mod in their own monsters and battle online!
Twitch ► https://www.twitch.tv/nedmakesgames
Twitter ► https://twitter.com/nedmakesgames
Blog ► https://nedmakesgames.tumblr.com
Discord ► https://discordapp.com/invite/ubxSVBK Textures on the Map! Tactical Lizard Tamer, Unity Game Dev Log [Part 145]](https://i.ytimg.com/vi/XnUtDCgnymk/mqdefault.jpg)
![Audio Mixers Connected! Tactical Lizard Tamer, Unity Game Dev Log [Part 119]
Im making a game in Unity! It will be a mixture of Pokemon teambuilding on a Fire Emblem / Final Fantasy Tactics style-map. Players will be able to mod in their own monsters and battle online!
Twitch ► https://www.twitch.tv/nedmakesgames
Twitter ► https://twitter.com/nedmakesgames
Blog ► https://nedmakesgames.tumblr.com
Discord ► https://discordapp.com/invite/ubxSVBK Audio Mixers Connected! Tactical Lizard Tamer, Unity Game Dev Log [Part 119]](https://i.ytimg.com/vi/Y1P8DIZk75U/mqdefault.jpg)
![New Unity Version! Cannoneer, Unity Game Dev Log [Part 7]
Im making a game in Unity! Please subscribe so you wont miss a video!
Twitch ► https://www.twitch.tv/nedmakesgames
Twitter ► https://twitter.com/nedmakesgames
Blog ► https://nedmakesgames.tumblr.com
Discord ► https://discordapp.com/invite/ubxSVBK
Instagram ► https://instagram.com/nedmakesgames New Unity Version! Cannoneer, Unity Game Dev Log [Part 7]](https://i.ytimg.com/vi/YK4cGwpr8Ss/mqdefault.jpg)
![Egg Shell Touch-Ups and Bones! Tactical Lizard Tamer, Unity Game Dev Log [Part 103B]
Im making a game in Unity! It will be a mixture of Pokemon teambuilding on a Fire Emblem / Final Fantasy Tactics style-map. Players will be able to mod in their own monsters and battle online!
Twitch ► https://www.twitch.tv/nedmakesgames
Twitter ► https://twitter.com/nedmakesgames
Blog ► https://nedmakesgames.tumblr.com
Discord ► https://discordapp.com/invite/ubxSVBK Egg Shell Touch-Ups and Bones! Tactical Lizard Tamer, Unity Game Dev Log [Part 103B]](https://i.ytimg.com/vi/YKVduNSfwoM/mqdefault.jpg)

![Rotating Monsters! Tactical Lizard Tamer, Unity Game Dev Log [Part 111]
Im making a game in Unity! It will be a mixture of Pokemon teambuilding on a Fire Emblem / Final Fantasy Tactics style-map. Players will be able to mod in their own monsters and battle online!
Twitch ► https://www.twitch.tv/nedmakesgames
Twitter ► https://twitter.com/nedmakesgames
Blog ► https://nedmakesgames.tumblr.com
Discord ► https://discordapp.com/invite/ubxSVBK Rotating Monsters! Tactical Lizard Tamer, Unity Game Dev Log [Part 111]](https://i.ytimg.com/vi/YlXnTkQrB60/mqdefault.jpg)
![Introducing Egg Dino! Tactical Lizard Tamer, Unity Game Dev Log [Part 98]
Im making a game in Unity! It will be a mixture of Pokemon teambuilding on a Fire Emblem / Final Fantasy Tactics style-map. Players will be able to mod in their own monsters and battle online!
Twitch ► https://www.twitch.tv/nedmakesgames
Twitter ► https://twitter.com/nedmakesgames
Blog ► https://nedmakesgames.tumblr.com
Discord ► https://discordapp.com/invite/ubxSVBK Introducing Egg Dino! Tactical Lizard Tamer, Unity Game Dev Log [Part 98]](https://i.ytimg.com/vi/ZMdl_1xwxBI/mqdefault.jpg)
