Toon Shader in Unity Using a Shader Graph with Custom Lighting! ✔️ 2020.3 | Game Dev Tutorial

preview_player
Показать описание
✔️ Works in 2020.1 ➕ 2020.2 ➕ 2020.3 🩹 For 2020.2 and .3:
► When you create a shader graph, set the material setting to "Unlit"
► The gear menu on Custom Function nodes is now in the graph inspector
► Editing properties must be done in the graph inspector instead of the blackboard
► Add a normalize node after view direction to fix a bug in certain Unity versions.

Toon shaders, also called cel shaders, create a cartoon-like style with segmented shading. In this video, I'll show you how to create these shaders in Unity using Shader Graph. Features include: diffuse and specular lighting, color textures, shading ramp textures, shadows, and multiple light sources. The custom lighting techniques can be used in a variety of shaders down the line!

👋 Subscribe for weekly game development videos!

👑 Join my Patreon for extra influence over topics, early access to videos, and downloadable project files!

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

📚 Reference scripts

✨Follow up videos

⏲️ Timestamps:
0:00 Intro
1:00 Project setup
2:10 Simple (diffuse) lighting
5:39 Shading ramp textures
7:54 Color textures
8:57 Shadows
12:10 Specular lighting
14:59 Additional light sources
19:31 Wrap up and credits

🎖️ Credits and references:

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

For anyone getting an error saying "Invalid conditional expression"
instead of:
#if SHADERGRAPH_PREVIEW
It has to be:
#if defined(SHADERGRAPH_PREVIEW)

hamishpaget
Автор

Followed another tutorial that massively overcomplicated everything and didn't get the desired result and then I watch this one and it's so simple. Great job man

gamethingstuff
Автор

Just want to thank you for breaking this down so well. As someone who is learning this stuff, it is really difficult sometimes to understand what people are doing in tutorials and why they might add certain nodes. Your tutorial is incredibly well explained and easy to understand. This level of detail is very much appreciated, keep it up! :)

sam
Автор

I searched through a fair number of toon shader tutorials but this is the only one I found that properly addressed dynamic lighting from point/spot lights in the scene. Hands down the best shader and I'm extremely grateful for the information - you've earned a sub good sir

kilanlarsen
Автор

This is by far the best and cleanest tutorial I've ever seen.

CaveHeroesofficial
Автор

One of the best Toon Shader explanations there are (including the Open Projects one that is a drag).

madifoldstudio
Автор

I'm going through all your tutorials and they are SO GOOD, I've learned so much, THANK YOU

tbdtandres
Автор

Wow, didn't know there are such free cool tutorials with rich info & explanation like this one, well, Subscribed.

durgam_sumerian
Автор

I've spent the past few hours trying to find a tutorial that works and this one does! Tysm

cortlandia
Автор

After completing the tutorial, I added a small bit extra onto the graph. Since I didn't want everything toon shaded to be shiny, I threw in an extra bool ("Matte"), and a Branch. If Matte is true, it cuts out the Add for the shine branch. If Matte is false, it feeds through the full branch.

kayohwai
Автор

Awesome tutorial man, thanks a lot, keep up the good work!

nicolasL
Автор

Thanks for the tutorial! This was really helpful for learning about custom lighting and shaders!

FistFlameful
Автор

Thank you sir I have been trying to get good looking shadows for a long time in URP and cascades never worked for me. Until I found you lovely vids and the shadow keywords fixed my problem. thanks and you get a like and subscribe for life :)

NathanPrince
Автор

Liked and subbed. You saved me where Unity's own tutorial didn't.

jeriswatching
Автор

Phenomenal tutorial. Thank you SO much!

VyvyanTheGreat
Автор

Hi everyone! Thank you for all your comments! Also, if you're using a version after Unity 2020.2, please check the top of the video description for fixes!

NedMakesGames
Автор

This is an amazing tutorial! Thank you for this!

lesarch
Автор

Thank you for sharing your knowledge! Hope you have a great day :)

dennisj
Автор

For everyone who runs into the 'Invalid conditional expression' error, here is the solution:
simply write
#if defined(SHADERGRAPH_PREVIEW)
instead of
#if SHADERGRAPH_PREVIEW


Hope this works for you :D

poisonouspurple
Автор

Since I ran into this issue:

When creating custom shader - Error: wrong file type, must be .hlsl:
Your windows directory may not be showing file extensions, and your text file is Lighting.hlsl.txt. In your windows directory, click "View" up at the top, then check "Show file extensions." now you can rename your file to Lighting.hlsl

bencollom