✔️ Tested in 2020.3 ➕ 2021.1
Drawing lines in shaders can be useful for procedural materials, dynamic UI or HUD elements, or interactive visual effects. In this video, I show how to draw them in Unity's URP Shader Graph using 2D signed distance fields, or SDFs. I also derive the SDF formula and explain the math behind it.
👋 Subscribe for weekly game development videos!
► https://www.youtube.com/c/nedmakesgam...
👑 Join my Patreon to watch videos early, download all project files, vote on future topics, and more! Thank you so much!
► / nedmakesgames
🔗 Check out my website for a searchable list of tutorials!
► https://nedmakesgames.github.io
2️⃣ 2nd Channel ► / @nedmakesgames2
🔴 Twitch ► / nedmakesgames
🐦 Twitter ► / nedmakesgames
🎮 Discord ► https://discordapp.com/invite/ubxSVBK
📸 Instagram ► / nedmakesgames
👽 Reddit ► / nedmakesgames
🎶 TikTok ► / nedmakesgames
☕ Ko-fi ► https://ko-fi.com/nedmakesgames
💬 Video transcript
► https://docs.google.com/document/d/17...
⏲️ Timestamps:
0:00 Intro
0:15 The SDF formula
2:47 Drawing a line
3:39 Procedural clock face
4:12 Drawing a polyline
4:50 Rainbow SDF visualization
5:16 Wrap up and credits
🎖️ Credits, references and further reading:
• Inigo Quilez: 2D Line Segment SDF - https://www.shadertoy.com/view/Wlfyzl
• Inigo Quilez: Deriving the SDF of a Line Segment - • The SDF of a Line Segment
• Inigo Quilez: 2D SDFs - https://www.iquilezles.org/www/articl...
Music:
Ouroboros by Kevin MacLeod
Link: https://incompetech.filmmusic.io/song...
License: https://filmmusic.io/standard-license
#GameDev #IndieDev #Unity