Drawing a Line Segment in the URP Shader Graph with 2D SDFs! ✔️ 2021.1 | Unity Game Dev Tutorial

preview_player
Показать описание
✔️ 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!

👑 Join my Patreon to watch videos early, download all project files, vote on future topics, and more! Thank you so much!

🔗 Check out my website for a searchable list of tutorials!

💬 Video transcript

⏲️ 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:

Music:
Ouroboros by Kevin MacLeod

#GameDev #IndieDev #Unity
Рекомендации по теме
Комментарии
Автор

Hi everyone, thanks for watching! I really like playing with SDFs, would you like to see formulas for different shapes? If so, which ones?

NedMakesGames
Автор

This is SO cool! I could watch the psychedelic one forever! Moving the triangle points does look fun! Very useful info!!!

stephapie
Автор

Looks really awesome
I wish you could make a more detailed tutorial that we can follow along
Still rocks :)

krissloo
Автор

I'm sure I'll have an occasion to use this in the future, thanks.

gilleswalther
Автор

Looks and Sounds super Awesome, Can I make Outline of a Sprite using this SDFs technique ???

neozoid
Автор

wow shadergraph makes it look scary compared to hlsl script, anw very good tutorials, all of them!

fd
Автор

what if i want to do draw unknown number of segments (lines). for example i have a box, and a ball bouncing inside it, i want to draw a trail behind the bouncing ball using the shader graph, each time it bounce that's a new line.

mohanedmohsen
join shbcf.ru