Inside the Shader Graph, on the Graph Inspector > Graph Settings, you could just set the Render Face to Back, instead of doing all of those Render Pipeline stuff. Then the outline will render only on the perimeter of the object. And outlines from closer objects will be rendered on top of further objects.
This is true, but it also wouldn't work for some models, like my Eevee model, where it's two separate meshes, there would be an outline around eevee's mouth, which isn't what I would want personally
Any suggestions for how to outline objects with sharp edges like a cube or rounded cube? My characters look good but then I have a bunch of walls/cubes in the environment that are not outlined well 😅 Thanks for the tutorial
@@CGSmoothie Ya shading smooth doesn’t quite work for a sharp cube. Hm I’ll have to do more research or maybe switch to using rounded cubes as you suggested. Thanks 😄
If not, there is a different shader method which I don't personally like as much that uses fresnel that I think might work, but I don't think it looks as good.
@@CGSmoothiehm I’ll look into a fresnel method thanks. I’m reading some articles that suggest baking spherical (smooth) normals into vertex colors and use those for a cube mesh. 😅
I managed to get this working 99% with HDRP, using two custom render volume instead of doing a custom renderer like you did, thank you very much. It seems that this method renders the outlines behind the fog in the scene however. It's fine if you don't know the answer to fix this as I recreated your steps in HDRP instead of URP, but do you know of any possible solutions?
Sorry, I am barely familiar enough with URP to mess around until I got these results... I would assume it would have to do with the render order in the pipeline asset? That would be where I would start
Great video, really appreciate you making this tutorial. I just wish you could have mentioned that it doesn't work well on flat objects like cubes at the start of the video, and not the end.
Thanks you!. I want to use this to mark targets. What will be the best (efficient ) way to show and hide the outlines? (change thickness \ hide material \ change layer?)
Dude do you have to constantly put others down when doing your tutorial? "Now what most people would do, which is bad, is blah blah blah. But what I would do, which is good, is blah blah blah!" You also constantly do this thing where you say "here's how to fix it", but the actual solution to fix it is like ten steps later.
I just wanted to let people know some other ways people do it and why I personally think that it this tutorial is a better solution. Not trying to actively dunk on any other tutorials, just found them very annoying when trying to make a similar effect in one of my projects, so I thought I would let people know my method! :)
@@CGSmoothie That is what development is. There are many solutions to problems, and some solutions only work for some people and their setup or project, some people have good reason not to make a custom renderer, all sorts. You said "what normal people would do" That is complete arrogance, and i've come across it a lot in my professional software engineering career. Sure, improve and build upon, but don't mock the foundations or other solutions, if it works it works.
The normalize node isn't working in mine and I don't know why... The thickness of the outline is all messed up and I tracked the problem to it. I even tested it by removing the node and saving. Nothing changed. Can you help me please?
Trying to wrap my head around how I could make a radial progress outline... Using all of the directional vectors would produce a full outline, but possibly adding each vector over time would produce the radial outline? Any thoughts on this :D
Nice tutorial I only have 1 problem. The outline doesnt stick to my model but flies a bit around it. Every face from my model has its outline but its with an ofset so its floating around the object.
why why WHY is it so incredibly difficult to find HDRP NPR tutorials. I want realistic materials, cool lighting but just a cool outline. There are virtually no shader tutorials for HDRP
do you have any suggestions for adding an outline to an objects Texture rather than it's mesh? I have many billboarded objects in my scene, each uses a Quad mesh and has a material that uses alpha clipping to create a 2d cutout visual style. I'd like to add a white border to all of these objects to make them look like they are cut out of poster board. When I apply the process from your video the entire quad is colored white as opposed to just having a white border around the texture's opaque areas. Would love any suggestions that I could try!
i followed exactly that tuto in unity 2022 and get "Shader error in 'Universal Render Pipeline/Lit': maximum ps_5_0 sampler register index" my google researches don't help at all, idk what to do. I'm so confused seeing the "Lit" thing as we use an unlit shadergraph too
Hey, the effect works exactly like i wanted thanks! The only problem i have now is that these objects dont work with soft particles, i believe it has something to do with depth texture? Is it a limitation of this technique? Is there a way to solve it?
When I add and assing the material to the object, it only outlines the last submesh of the mesh. And from what I can tell, I did everything exatcly like in the video. The outline works, but for some reason it only out lines a single submesh of the object and not all of the object. I can't seem to find a solution so far. Do you have an idea why this is happening ?
Do you have multiple materials on your object? I've seen that being a problem for some... I would recommend baking your materials into a single texture in your modeling software
alright so overall a good tutorial BUT HOW DO I ADD THE VERTEX LIST you didn't explain that nor did you show yourself doing it so I'm stuck here with no instruction just trying to find it myself
Yeah I don't know what else the problem could be... Unless you have a texture node but even then it should just default to a pure white texture if you have one
Does this double or increases the faces, like it did with the blender solidify? Wondering whether it has potential as a style in games, but if it makes all objects too intense it will be pointless.
No offense, the tutorial is great, but please name the drawbacks, like for example how your shader doesn't work with flat shaded objects first before you start the tutorial.
Great tutorial, thanks! I have one question! I want to do an outline on a flat shaded (unlit) object, with no texture like your Eevee. So I want the object to have its own color, and then an outline color. If I use your tutorial for this, the entire object is just the color of the outline and increasing the outline or decreasing it just makes the object bigger, or smaller. How can I differentiate between the outline color and the base color of the object?
@@CGSmoothie I didn't, sorry. But then I went and added it but it still doesn't work. I think the problem is that outline shaders only work for more complex meshes - In my case it is a literal planar mesh facing the camera, so the "outline" gets projected outward (towards the camera) when I change the thickness - I will have to find some other way
Is it possible to change the outline thickness after this is all done? My outline still ended up kinda big and I can't figure out how to shrink it down
I'm new to unity, I'm only using it to add an outline so my question is probably silly, but when creating the shader in the main preview window a purple circle appears, and when i do what you do it doesn't change color, Also, the border around my 3d model does not appear, do you know why it could be? On the project I have added the 3d model with its respective texture
Interesting idea to use layers for fixing other problems. But... have you considered that there might be good reasons for other tutorials to do it differently as you desperately stated repeatedly? The problem I see is the following: In order to use your solution you are entirely forced to use that one specific layer. But the layering system in Unity is a pretty crucial thing. Almost every asset or package in unity has some integration using layers. It starts with rendering and collision detection and ends somewhere at layers influencing volumetric fog in some payed assets. By being forced to use a specific layer for your outlined objects you will not be able to use any of these features entirely. And this makes it unusable in my opinion. It's almost like making a tutorial about a first person controller but limiting it's movement to only one direction and no camera movement at all and then calling it the BEST tutorial. bold statement
The reason why I keep saying why other tutorials do it differently is to give natural stopping points if you wanted to leave it there, so I could show a wide range of what the solutions for an outline shader can be in unity. I consider it the best tutorial because it has the most uses and explains why things work the way they do and provides variations if you like it a certain way
Are you sure you are using the right render pipeline? if you have a material using a shader for the wrong pipeline it will show as a bright pink/magenta color
Is it possible to have a drop shadow effect on a model, like a "black glow" around a character? I've looked into glow stuff but I think that since black is 0,0,0 it can't be done.
Hello, This shader works great on unity but it is not visible in an android build. Is this compatible for android or do I have to change some settings in unity or urp. I have my depth textures and opaque textures enabled in Urp settings. Please help....! Any help would be appreciated. Thank you
did you solve it? If you just can't see the outline, suspect if it's hidden by the UI. I'm using Screen Space - Camera in Canvas mode, but I haven't seen the outline so far, so I looked for it and turned off the UI to see it.
Now that's a difficult situation! Personally I would outline the texture itself but that might not look good from all angles. This method would not work with that unfortunately
I found a temporary soltuion: 1.go to your shader graph and change your surface type into transparent 2.go to your custom render pipeline,and find your new add two rendering rule,change your filter->queue into transparent. After that your transparent object will stop drawing outline but opaque will.Hope someone will find a solution in the future
Do you know how to effect the color of the outline based on your light source? Like if the sun is coming from the top left, the outline is yellow/white and the outline on the shadow side isa darker color say purple/navy?
I'm trying to be informative as to why and how this solution works, you can skip around if you just want to know the solution, but I'm trying to help people learn what the nodes actually do in the shader graph.
personally, i didn't want my line to be perfect. i was satisfied at 4:37, once i manipulated the lines. thanks a lot
You should focus on your tutorial and stop criticizing or caring about other tutorials
now i know what most tutorials do...
Inside the Shader Graph, on the Graph Inspector > Graph Settings, you could just set the Render Face to Back, instead of doing all of those Render Pipeline stuff.
Then the outline will render only on the perimeter of the object. And outlines from closer objects will be rendered on top of further objects.
This is true, but it also wouldn't work for some models, like my Eevee model, where it's two separate meshes, there would be an outline around eevee's mouth, which isn't what I would want personally
@@CGSmoothie You could do a thickness mask, many outline shaders let you input a texture where black = no outline, white = outline
This was very very helpful, thank you!
You should leverage the screen position or use a post processing shader. They work with non smooth shaded objects
Yeah, but from what I've seen they also tend to be less uniform?
How about you start the tutorial with the fact that it only works with smooth shaded objects?
Great tipo, exactly what I was looking for
Well explained video thanks :D
Any suggestions for how to outline objects with sharp edges like a cube or rounded cube? My characters look good but then I have a bunch of walls/cubes in the environment that are not outlined well 😅 Thanks for the tutorial
A rounded cube works if you use shaded smooth
You could try shading smooth with your sharp cube but I do not think it will work
@@CGSmoothie Ya shading smooth doesn’t quite work for a sharp cube. Hm I’ll have to do more research or maybe switch to using rounded cubes as you suggested. Thanks 😄
If not, there is a different shader method which I don't personally like as much that uses fresnel that I think might work, but I don't think it looks as good.
@@CGSmoothiehm I’ll look into a fresnel method thanks. I’m reading some articles that suggest baking spherical (smooth) normals into vertex colors and use those for a cube mesh. 😅
I managed to get this working 99% with HDRP, using two custom render volume instead of doing a custom renderer like you did, thank you very much. It seems that this method renders the outlines behind the fog in the scene however. It's fine if you don't know the answer to fix this as I recreated your steps in HDRP instead of URP, but do you know of any possible solutions?
Sorry, I am barely familiar enough with URP to mess around until I got these results... I would assume it would have to do with the render order in the pipeline asset? That would be where I would start
Great video, really appreciate you making this tutorial. I just wish you could have mentioned that it doesn't work well on flat objects like cubes at the start of the video, and not the end.
Sorry about that, the tutorials are unscripted so I kinda didn't remember til the end 😅
Thank you for your hard work.
Thanks you!. I want to use this to mark targets. What will be the best (efficient ) way to show and hide the outlines? (change thickness \ hide material \ change layer?)
You can actually change materials on the fly through code, so I might just do that.
Very nice, Thank you!
Dude do you have to constantly put others down when doing your tutorial? "Now what most people would do, which is bad, is blah blah blah. But what I would do, which is good, is blah blah blah!" You also constantly do this thing where you say "here's how to fix it", but the actual solution to fix it is like ten steps later.
I just wanted to let people know some other ways people do it and why I personally think that it this tutorial is a better solution. Not trying to actively dunk on any other tutorials, just found them very annoying when trying to make a similar effect in one of my projects, so I thought I would let people know my method! :)
excatly
@@CGSmoothie That is what development is. There are many solutions to problems, and some solutions only work for some people and their setup or project, some people have good reason not to make a custom renderer, all sorts. You said "what normal people would do" That is complete arrogance, and i've come across it a lot in my professional software engineering career. Sure, improve and build upon, but don't mock the foundations or other solutions, if it works it works.
The *best* outline shader (works only with smooth shaded objects) lol
The normalize node isn't working in mine and I don't know why... The thickness of the outline is all messed up and I tracked the problem to it. I even tested it by removing the node and saving. Nothing changed. Can you help me please?
Same thing for me. You got it working?
@@feedelstick4670 I eventually did, but I dont remember how 😂😂
thanks, this really helped
Glad it did!
Trying to wrap my head around how I could make a radial progress outline... Using all of the directional vectors would produce a full outline, but possibly adding each vector over time would produce the radial outline? Any thoughts on this :D
You can do it easily with the ui slider
Nice tutorial I only have 1 problem. The outline doesnt stick to my model but flies a bit around it. Every face from my model has its outline but its with an ofset so its floating around the object.
Did you ever get a fix for this?
U need to smooth ur model
I like your style bro
kepp going man
why why WHY is it so incredibly difficult to find HDRP NPR tutorials. I want realistic materials, cool lighting but just a cool outline. There are virtually no shader tutorials for HDRP
If you search for HDRP tutorials I can highly reccomend Ben Cloward
@@ab-uo6rd I switched to unreal and did it in 15 minutes.
your fragment node suddenly has 2 extra fields at 5:06, not sure if you ever mention how/why
I'm having a problem, in my main preview the sphere doesn't come out of pink, How do I resolve this?
I'm not sure what you mean, make sure you save your assets and the material is using the right shader
Good tutorial. But seriously though, how do stylized games like Genshin Impact render outlines so perfectly in Unity?
They probably use a post-processing pass that does it all in one go, rather than this shader if I had to guess
bro is telling me it doesnt work for this and this after letting me watch another now useless ten minutes of tutorial.
do you have any suggestions for adding an outline to an objects Texture rather than it's mesh? I have many billboarded objects in my scene, each uses a Quad mesh and has a material that uses alpha clipping to create a 2d cutout visual style. I'd like to add a white border to all of these objects to make them look like they are cut out of poster board. When I apply the process from your video the entire quad is colored white as opposed to just having a white border around the texture's opaque areas. Would love any suggestions that I could try!
thank you for your work and the great explanation but i could read anything on the screen, i was only able to rely on the audio. very frustrating
5:42 i have NO clue why or how you can have a list like that, to add materials in HDRP??
Any Ideas on giving such Outlines to Transparent Materials
Hmm, unfortunately this one would not work for transparent materials... I think you could do something with raycasts? I'd have to look into it
i followed exactly that tuto in unity 2022 and get "Shader error in 'Universal Render Pipeline/Lit': maximum ps_5_0 sampler register index" my google researches don't help at all, idk what to do. I'm so confused seeing the "Lit" thing as we use an unlit shadergraph too
Yeah, the later versions of unity have been very frustrating to me... I prefer builds from 2020 or earlier
Hey, the effect works exactly like i wanted thanks!
The only problem i have now is that these objects dont work with soft particles, i believe it has something to do with depth texture? Is it a limitation of this technique? Is there a way to solve it?
You could always just not do the depth texture part but I believe it sacrifices looks
When I add and assing the material to the object, it only outlines the last submesh of the mesh. And from what I can tell, I did everything exatcly like in the video. The outline works, but for some reason it only out lines a single submesh of the object and not all of the object. I can't seem to find a solution so far. Do you have an idea why this is happening ?
Do you have multiple materials on your object? I've seen that being a problem for some...
I would recommend baking your materials into a single texture in your modeling software
alright so overall a good tutorial BUT HOW DO I ADD THE VERTEX LIST you didn't explain that nor did you show yourself doing it so I'm stuck here with no instruction just trying to find it myself
I believe the vertex list adds to the shader graph by default... I'm gonna rewatch the video to make sure but I think that's the answer I can give you
Why does the fragment node expand with 2 more inputs after 4:57?
how can i make it work on hdrp ?
I really do owe you a beer
Curious I see how the renderer moves the lines further away the more I increase the thickness - how can this mitigated?
I don't really know what you mean... Could you send a recording on the discord possibly?
Thank you
How do you apply the opaque layer mask in HDRP?
It shows dark weird line on selected outlined mesh, when I push play button while rotating the object
I don't really know what you mean by this, if you go to the discord and send a screenshot I might be able to know more?
@@CGSmoothie I don't turn on depth, my bad
This video was very helpful. Thank you. I have a question. Is there a way to apply the inside of the outer shell line in different colors?
You mean like 2 shells?
If that's what you mean, not with this method except if you just apply a second material with the shader on your mesh
@@CGSmoothie I see. Thank you for your answer.
For some reason my Shader Graphs are pink, do you know what i can do to solve this problem?
That would usually mean they're textureless? So maybe your color node isn't connected?
@@CGSmoothie mine is pink as well. By colour node, do you mean the outline colour? If so, mine is connected
Yeah I don't know what else the problem could be... Unless you have a texture node but even then it should just default to a pure white texture if you have one
@@CGSmoothie finally figured out what happened and forgot to subscribe to programmable rendering pipeline settings lol
Does this double or increases the faces, like it did with the blender solidify?
Wondering whether it has potential as a style in games, but if it makes all objects too intense it will be pointless.
I don't think so, I think it just renders the objects twice
That being said I have not looked into the effect it has on memory or anything
7:34 how can i get the same think working from this part in HDRP as i see in HDRP the settings are totally different
I am not familiar with HDRP yet, sorry 😔
No offense, the tutorial is great, but please name the drawbacks, like for example how your shader doesn't work with flat shaded objects first before you start the tutorial.
I have learned from these comments 😅
My next tutorial might be *too* cautious explaining everything
Great tutorial, thanks!
I have one question! I want to do an outline on a flat shaded (unlit) object, with no texture like your Eevee. So I want the object to have its own color, and then an outline color.
If I use your tutorial for this, the entire object is just the color of the outline and increasing the outline or decreasing it just makes the object bigger, or smaller. How can I differentiate between the outline color and the base color of the object?
To be clear, is your outline material on a new material layer of the mesh? It should be.
@@CGSmoothie I didn't, sorry. But then I went and added it but it still doesn't work. I think the problem is that outline shaders only work for more complex meshes - In my case it is a literal planar mesh facing the camera, so the "outline" gets projected outward (towards the camera) when I change the thickness - I will have to find some other way
Yeah, as I said in the video, unfortunately this shader only works for smoother objects, my bad!
It was a good content, but the screen is small, so it's frustrating...
Thx
Is it possible to change the outline thickness after this is all done? My outline still ended up kinda big and I can't figure out how to shrink it down
I got it to work, I had to change quite a bit due to the way my assets were made, but we good now
I wish you could find a way to do the outline without switching to the URP renderer
Unfortunately most shaders require use of the universal render pipeline, but I see the inconvenience
@@CGSmoothie Thank you 👍
How can i do this for HDRP?
I'm new to unity, I'm only using it to add an outline so my question is probably silly, but when creating the shader in the main preview window a purple circle appears, and when i do what you do it doesn't change color, Also, the border around my 3d model does not appear, do you know why it could be?
On the project I have added the 3d model with its respective texture
nevermind, im dumb, i erased the render object at the start, I managed to do the tutorial, thank you so much!
Interesting idea to use layers for fixing other problems. But... have you considered that there might be good reasons for other tutorials to do it differently as you desperately stated repeatedly? The problem I see is the following: In order to use your solution you are entirely forced to use that one specific layer. But the layering system in Unity is a pretty crucial thing. Almost every asset or package in unity has some integration using layers. It starts with rendering and collision detection and ends somewhere at layers influencing volumetric fog in some payed assets. By being forced to use a specific layer for your outlined objects you will not be able to use any of these features entirely. And this makes it unusable in my opinion.
It's almost like making a tutorial about a first person controller but limiting it's movement to only one direction and no camera movement at all and then calling it the BEST tutorial.
bold statement
The reason why I keep saying why other tutorials do it differently is to give natural stopping points if you wanted to leave it there, so I could show a wide range of what the solutions for an outline shader can be in unity.
I consider it the best tutorial because it has the most uses and explains why things work the way they do and provides variations if you like it a certain way
Hi, help me please. Why material color in shader can be pink?
Are you sure you are using the right render pipeline? if you have a material using a shader for the wrong pipeline it will show as a bright pink/magenta color
@@CGSmoothie thank you! I fixed this problem with URP
Glad I could help!
Is it possible to have a drop shadow effect on a model, like a "black glow" around a character? I've looked into glow stuff but I think that since black is 0,0,0 it can't be done.
If 0,0,0 doesn't work, do 0,0,1 or similar. It will be hardly noticable, and you'll get the same result.
Game dev is all about trains on heads 😅
Hello! What is the name of the font you used in the text "the best unity outline shader", in the video image?
Komika Axis
How could I do this without using layers? Because I need my layers for something else!
You could just quit before I do the layer thing, but it ends up with the messier version that I personally don't like as much, up to you
@@CGSmoothie Yeah I figured I'd have to do that. Thank you so much for the response!
Wish it worked with non shade smoothed models :/
Hello, This shader works great on unity but it is not visible in an android build.
Is this compatible for android or do I have to change some settings in unity or urp.
I have my depth textures and opaque textures enabled in Urp settings.
Please help....!
Any help would be appreciated. Thank you
did you solve it?
If you just can't see the outline, suspect if it's hidden by the UI.
I'm using Screen Space - Camera in Canvas mode, but I haven't seen the outline so far, so I looked for it and turned off the UI to see it.
@@yoonkim3198 yes i did, switching the shader type to spriteunlit solved it for me , it was a lit shader previously.
Unfortunate to only mention the downsides at the end of the video after following your otherwise mostly ok-ish presented advice. Thumbs up anyway,
I am a forgetful guy what can I say
Thank you!But how to do it in alpha texture object?like tent,leaves
Now that's a difficult situation! Personally I would outline the texture itself but that might not look good from all angles. This method would not work with that unfortunately
@@CGSmoothie sad to hear about this:(
Anyway,your method still fantastic!I really appreciate you.
I found a temporary soltuion:
1.go to your shader graph and change your surface type into transparent
2.go to your custom render pipeline,and find your new add two rendering rule,change your filter->queue into transparent.
After that your transparent object will stop drawing outline but opaque will.Hope someone will find a solution in the future
Thanks for leaving this solution in the comments!!
what's with the voice affectation?
What is going on at 5:00? You've had cut the video and started from a different part.
I think I just had a LONG silence while I was thinking
Is this part 2 of some video? Following along in a brand new project with this is almost impossible.
Do you know how to effect the color of the outline based on your light source? Like if the sun is coming from the top left, the outline is yellow/white and the outline on the shadow side isa darker color say purple/navy?
You could do that if you mixed this shader with a toon shader, or if you just want basic lighting you can use a Lit URP shader instead of an Unlit one
GREAT question though
i love you
Any idea how to do this in HDRP?
Hdrp is not really good to use shader graph on, unfortunately
Nice! but to heavy for performance.
How do I outline UI elements?
That can be done with just the outline component for text, or just outline images in your image editing software
@@CGSmoothie I got it.
Can it work on 2D
I don't believe this method can since it uses 3d mesh normals... Plenty of other 2d outline tutorials out there though!
@@CGSmoothie thanks for ur reply
ok but most 3D objects have some hard edges.
so u couldnt like make the screen you are working on for 14minutes straight a little bit bigger/tidier huh? xd nice tutorial tho
gj ^^
At least maximize your your work windows...
Can't see clearly all things.
Honestly it's not bad but it's not good tutorial.
wasted 10 minutes just waiting for the solution. i don't care what others do, i just want to see a quick solution)) sorry for the bad comment.
I'm trying to be informative as to why and how this solution works, you can skip around if you just want to know the solution, but I'm trying to help people learn what the nodes actually do in the shader graph.