Toon Outlines in Unity URP, Shader Graph Using Sobel Edge Detection! ✔️ 2020.3 | Game Dev Tutorial

  Рет қаралды 68,736

Ned Makes Games

Ned Makes Games

Күн бұрын

Пікірлер: 300
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi everyone, thanks for your comments! 🩹 Fixes ► I made an editing mistake around 1:30. Please note, you need to place the outline material into the material field of the BlitMaterialFeature. It should not be empty after this step. Sorry about that! For 2020.2: ► 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 ✨ I've released a follow up video to this, adding normal edge detection and a bunch of other improvements. Check it out here: kzbin.info/www/bejne/nIiQZqaoiK13g8U
@theflamingturtle4084
@theflamingturtle4084 3 жыл бұрын
It wont allow me to add a blit material feature at 1:26.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@theflamingturtle4084 Hi! Do you get any error? Does it not show up in the list? I would make sure that the file name and class name in the cs file match up.
@Nadeloehr1990
@Nadeloehr1990 3 жыл бұрын
@@theflamingturtle4084 Had the same problem, you need to add the code from the description link into the BlitMaterialFeature.cs
@vanshisha
@vanshisha Жыл бұрын
Thanks Ned :) For people using URP 14+ this won't work, as BlitMaterialFeature.cs is using the old API. If you are new to URP and, like me, can't upgrade the file to make it work, I found an alternative solution: - discard the BlitMaterialFeature.cs file - at 01:22, click Select Renderer Feature and select "Full Screen Pass Renderer Feature" (Only available from URP 14) - In the renderer feature set the Material and, IMPORTANT, set requirements to "color" - Ultimately, apply two changes to the shader: 1) 06:58 instead of using a Sample Texture 2D with _MainTex for the blend, use a "URP Sample Buffer" node, and set the source to "Blit Source" (which simply passes the color of the pixels, like the main texture would) 2) In the Graph settings, change the material type from "Unlit" to "Fullscreen" - NOTE: you can skip the last step at 07:16 Also, I'm not sure if there's a difference in performance or if it's considered best practice or not...
@AEvans853
@AEvans853 2 жыл бұрын
For anyone trying this in newer Unity Versions: You have to replace the "UV" Node in the shader graph with the "Screen Position" Node.
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Thanks for the heads up!
@lpenn
@lpenn Жыл бұрын
Thanks you!!! I was entering another universe for a short while there
@briancraig4326
@briancraig4326 2 жыл бұрын
Hey! For those who are using 2020.3, use a "screen position" node instead of a "UV" node for the input on the Custom Function! The reason is that unity is feeding a render of the UV output of the scene (don't ask me why), instead of what is expected, an UV that goes from (0, 0) to (1, 1) for the screen.
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Oh that's interesting, I haven't encountered that before! I wonder if it still behaves strangely in builds? Either way, using screen position should be safe. Glad it's working!
@insertusername7342
@insertusername7342 3 жыл бұрын
Thank you so much for these tutorials! I am completely new to shaders, and was expecting that everything would go over my head. But you explain it really well, looking forward for more content! :)
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Thank you for watching! I'm really glad to hear that, since I'm often worried I race over stuff for the sake of brevity. I hope I hit a good middle ground.
@sentinel9933
@sentinel9933 3 жыл бұрын
Amazing tutorial, explained from top to bottom as you'd expect! Keep it up :)
@adamodimattia
@adamodimattia 3 жыл бұрын
I'm writing a comment just to help the algorithm because every your video is awesome, I've recommended it at work :)
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Thank you! I really appreciate it. Thanks for watching!
@adamodimattia
@adamodimattia 3 жыл бұрын
@@NedMakesGames I love that you put links in description to the previous and following videos. It’s organized better than most curses on Udemy ;)
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@adamodimattia 😅 Well I try my best! I wasn’t sure if people would prefer links like that or playlists!
@adamodimattia
@adamodimattia 3 жыл бұрын
@@NedMakesGames I think that you could use both :) Sometimes one opens a random video and would like to know the previous and the following. And sometimes one already knows what he/she wants and then the playlist is better.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@adamodimattia I came to that conclusion too, and thankfully playlists are pretty easy to set up!
@danixadem
@danixadem 3 жыл бұрын
I'ld like to see more of advanced tutorials such like that. Great job !
@alberto-martino
@alberto-martino 3 жыл бұрын
Thanks for this! Custom render passes allow me to make the graphics look more unique and focused on the details I care about the most without changing all the shaders currently used for the premade models in the scenes... So, this was VEEERY helpful! Thanks again 🙏🏼
@zenarion
@zenarion 3 жыл бұрын
I plan to use this feature to create a visual style heavily inspired by Jean "Moebius" Giraud's colorful comic art, and use that for a mecha crew simulator game me and my bff work on. Thank you for this great and deep tutorial!
@NedMakesGames
@NedMakesGames 3 жыл бұрын
That sounds really cool! I’m glad to help!
@DRE_WW
@DRE_WW Жыл бұрын
Jean Giraud’s art is breathtaking
@yotcho
@yotcho 3 жыл бұрын
Really good and useful tutorial, thanks for sharing ! Can't wait for the custom render feature for the sobel depth normal texture :)
@swannschilling474
@swannschilling474 3 жыл бұрын
You just made my day!! :) Btw, I had a bit of a bad start, so if anyone has trouble with the render pass not showing...just deleting my old camera and adding a fresh one to the scene made everything work for me!! :)
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Thank you! Glad it was a simple fix!
@swannschilling474
@swannschilling474 3 жыл бұрын
@@NedMakesGames Hey, I got stuck again and came back...now I realized, the effect does need the camera clipping planes to be kinda default to make it work!!
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@swannschilling474 Is it depth outlines? They are kind of picky. If you can, I would work through the follow up video here, kzbin.info/www/bejne/nIiQZqaoiK13g8U . I add a lot of little tweaks that make outlines more stable. If you don't want depth normal outlines, I would at least try creating a scene depth node, set in raw mode. Multiply it with the threshold for depth outlines before feeding it into the fine tuning node. That will help things, I think.
@swannschilling474
@swannschilling474 3 жыл бұрын
@@NedMakesGamesThx, I will check it out!! Great channel, liked and subscribed!! :)
@sealsharp
@sealsharp 3 жыл бұрын
Another good shader video by you. Nice work!
@sooiv3572
@sooiv3572 Жыл бұрын
This tutorial helped me a lot in my game development.
@magpiegd9374
@magpiegd9374 Жыл бұрын
Thanks so much for this video! Can't quite get it to work though, was hoping you could help. I've gone back over the video contents a dozen times to make sure I got everything right, made the "Fixes" in the description, scrolled through all the comments, still nothing. Basically the shader seems to have no effect EXCEPT when I set DepthTightening (is it tightening or thickness?) to a negative value, then the whole screen gets set to the outline color, with just a few object shadows showing through. I went through a few of the earlier videos in this series first and the desaturation shader works fine. Only thing I can find that isn't exactly like the video: My version of Unity (2021.3.2f1) in the debug options for the shader the single Keywords text field seems to have been replaced with two arrays, Valid Keywords and Invalid Keywords. They're behaving really wierd and buggy but I was able to add the REQUIRE_DEPTH_TEXTURE keyword to the Valid Keywords array (I've only gotten so far as depth not color) Here's the shader and hlsl script as I've put them together: drive.google.com/file/d/1nYbqcnY2WSnANoIZquMOtZ-GWBZq30RQ/view?usp=sharing drive.google.com/file/d/1VDkabtqxF1Rw9apCcPaKme3Xi7OrbJqE/view?usp=sharing This is like the last difficult thing to solve on my current project so I really hope you can help me out :) Thank you again for making these videos!
@spaget_
@spaget_ 3 ай бұрын
don't bother the author of video doesn't care to share a fix for outdated video
@paulorodriguez6288
@paulorodriguez6288 3 жыл бұрын
subscribed! best method i've seen on making outlines! ty for the corrections in the description btw.
@davidgil1171
@davidgil1171 Жыл бұрын
Hi there! First of all i wanted to thank you for this amazing tutorial, I know its a bit late but I have a question! How can I exclude certain gameObjects so they dont have this render feature? I really want to use this method but i keep getting some weirds outlines on certain objects! Thanks again :)
@NedMakesGames
@NedMakesGames Жыл бұрын
Hi! It's not super simple to do with this exact implementation. You might have better luck with the outlines in these video: kzbin.info/www/bejne/Z4KzcmapZbhmhdE kzbin.info/www/bejne/bWWkhGh6orGYbtk
@TheFerruccio
@TheFerruccio 8 ай бұрын
One question: how do I get this shader to work consistently between “scene” view and “game” view? I am getting good edges for both, but only if I have different material settings for each. Very little information exists out there when it comes to explaining when shaders are rendering for a scene editor view and when they are rendering through the scene’s main camera.
@TOPPREDATORable
@TOPPREDATORable 3 жыл бұрын
Cool video! URP 10 has a DepthNormals texture built in because they used it for their AO implementation, so no more custom feature needed. Although, it seems that unlit materials don't write to the texture, which is useless to me so I'll still be using my own pass.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Thank you! I did see that about URP 10, but I've been burned by using beta packages so I decided to hold off on it for now. It seems I made the right decision. Thanks for the heads up about unlit materials - that's really strange.
@TOPPREDATORable
@TOPPREDATORable 3 жыл бұрын
@@NedMakesGames My guess is that they were implementing AO, needed the scene normals for that but they don't want unlit objects to receive AO since that doesn't make sense, but their solution was just to make unlit objects not write to the texture? Idk, hope they change it
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@TOPPREDATORable That makes sense. I hope so too, or at least have an option for it
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@cleandust530 it does in URP version 10. I think you have to have Unity 2020.2 to use it
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@cleandust530 I’m not sure, I haven’t tested it. My understanding is that Unity has decided to implement deferred rendering so the URP supports everything the built-in renderer does.
@MassimoRough
@MassimoRough 11 ай бұрын
Awesome! Could you tell if it would be possible to remove the colors from the output thys leaving only outlines on a white background?
@saminreysb
@saminreysb 3 жыл бұрын
This might be what sable game used for the looks, thanks a lot!
@NedMakesGames
@NedMakesGames 3 жыл бұрын
No problem! I think they might use something like this. That game is so beautiful!
@NPCsz
@NPCsz 2 жыл бұрын
Works in 2021.3.11f1 Thank you so much ! It works very well with any low poly models.
@NedMakesGames
@NedMakesGames 2 жыл бұрын
I'm glad to hear it! Thanks for watching!
@thefrenchdev965
@thefrenchdev965 2 ай бұрын
How did you make it work? I don't have the Blit material render feature option in the URP.
@shadestylediabouros2757
@shadestylediabouros2757 Жыл бұрын
I've been fighting with this shader for a while now, and I have an issue I just can't seem to figure out a solution to. Specifically, this sobel implementation has a minimum outline thickness of two pixels, which is annoying when you're attempting to use it in pixel art applications. Is there a way to make the sobel filter not generate an outline when the depth texture at a given pixel is higher than its neighbors (Such that outlines only generate "behind" objects).
@ilianostapovich4378
@ilianostapovich4378 11 ай бұрын
It doesn't work form me :/ it does nothing when i set the values on 1, I tried with the screen position node, but it also doesn't work
@TobiDerCoole
@TobiDerCoole 3 ай бұрын
hey i work on unity 2022.3.20f1 and i couldnt even create a blitmaterial-renderfeature i think it doesnt work anymore
@autismbros.official7582
@autismbros.official7582 Жыл бұрын
Any to make it so that it doesn't place the outline on where the model gets shaded? Thanks! Okay, it's probably due to the low poly count, but please answer my question still. Thank you! P.S. Let me clarify: I don't want the outline separating colors of different brightness values if they have the same hue and saturation values. Let me know if that's possible!
@rohanpatel2608
@rohanpatel2608 Жыл бұрын
Hi, Do you know If I can somehow get shadow information into the shader graph as well? I want to add outlines to all the shadows as well, if you know of any resources please let me know. Also Thank you for making this tutorial it still works in the 2022.2 version with some changes:)
@erinbower745
@erinbower745 3 жыл бұрын
Hi Ned, wonderful tutorials! You explain things really well for code dummies like me. I have been getting an error with the BlitMaterialFeature script for this outline tutorial. I'm in Unity 2020.1.12 and whenever I input the Edge Detection Outlines Include script into the custom function node I'm getting the dreaded error exclamation mark and the node won't work. It's saying syntax error: unexpected token 'using" and then it lists the shader. I've checked typos and I swear I've done everything the same as your tutorial so I'm just really not sure. Any tips?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi, thank you, I'm glad it's helping you! Is the error with the BlitMaterialFeature or in your graph? Either way, there's a "using" keyword that the compiler doesn't understand 😅 If it's in EdgeDetectionOutlinesInclude, did you create the script as a C# file initially? Unity probably put some lines at the top that you can delete. If it's in BlitMaterialFeature, maybe you forgot a semicolon? You can check the files in the video description to see how the scripts should look!
@erinbower745
@erinbower745 3 жыл бұрын
@@NedMakesGames Hi Ned! I was feeling like the issue was in the BlitMaterialFeature, I finished the graph until the end of the video and I was pretty positive that I copied exactly. But I will double check and check out these things you've listed to make sure. Thank you I really appreciate the reply!
@gilleswalther5964
@gilleswalther5964 3 жыл бұрын
Awesome, I really like the approach
@tylerdelange5959
@tylerdelange5959 3 жыл бұрын
Aye there, fantastic tutorial, really helpful for my present project. Had a question though, how can I get the shader to work for both my base camera and overlay camera? Its an FPS with the overlay camera rendering the held weapon while the base camera renders everything else.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi, thank you! That’s an interesting use case I haven’t really tried out. Do outlines not display on objects rendered from one of the cameras? Do both cameras use the renderer with the outlines feature? Theoretically this shouldn’t be a problem, but URP may handle depth textures differently for overlay cameras.
@tylerdelange5959
@tylerdelange5959 3 жыл бұрын
@@NedMakesGames Thanks for the quick response and apologies for the lack of info. The main camera is rendering fine, with the outlines and such, but the overlay camera, that views the view model (weapon) is rendered normally, with no outlines. I imagine I somehow need to put the overlay depth texture over the main one before the custom function in the shader graph, though I’m not sure how I’d go about doing that, or even if overlay cameras have a depth texture. I’d appreciate any assistance on the topic, Thanks. Edit: Both cameras do use the same forward renderer.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@tylerdelange5959 Yeah, I think this problem could get complex. I have not worked much with overlay cameras, but my intuition says you should be able to run the outlines pass separately over each camera's depth texture. However, according to this: docs.unity3d.com/Packages/com.unity.render-pipelines.universal@7.2/manual/cameras-advanced.html overlay cameras receive the depth texture from their parent, which complicates things. What happens if you change the clear depth settings on your overlay camera? What happens if you detach the overlay camera and make it the main camera? Do you see outlines on your view models then?
@tylerdelange5959
@tylerdelange5959 3 жыл бұрын
@@NedMakesGames yeah I’ve been reading up on a bunch of documentation. Fiddling with the clear depth hasn’t resulted in any change. Setting the overlay camera to base makes it all bug a little bit, as URP can only have 1 base camera at a time. Setting the view model camera to base and the other one to overlay results in the outlines only showing up on the view model, not on the world. I’m not 100% what the best way to proceed is, I’ve looked through a ton of documentation already. If I could access the overlay cameras depth first, and additively combine it with the main one before running the function and such, I’d be set. I’ll put a solution here if I come up with one
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@tylerdelange5959 That would be really nice of you! Hopefully the solution’s not too complex. I’m curious now, so I may look into it a bit too, if I get a chance.
@EdgedPixie
@EdgedPixie 3 жыл бұрын
in the .HLSL file, shouldn't the sixth float2 of sobelSamplePoints[9] be (1,0) instead of (1,1)? As it stands the cell that should be the middle-right is sampling the top-right instead.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Yes that's right! I didn't catch it before editing the video, but the reference scripts in the video description have the correct values.
@80sVectorz
@80sVectorz Жыл бұрын
I made the sobel function a bit more general so that I could feed it my own textures. But I was struggeling a while to get it working and I thought if the docs tell me UVs need to be normalized why are we using whole integers to offset it... So turns out I needed to use a screen node and use those values to normalize the offsets by dividing them. Maybe this will help someone who stumbled on to the same problem
@larsmaasanimaties4594
@larsmaasanimaties4594 2 жыл бұрын
it doesnt work for me. it just shows big black vertical lines across the screen
@NedMakesGames
@NedMakesGames 2 жыл бұрын
This sometimes happens to me if I accidentally write "float" instead of "float2" in one of the custom functions. I would double check that. You can also check the references in the video description, or take a screenshot and either email me or post on Discord. You can also post a link here, but KZbin will hide it and not give me a notification, so I won't see it right away 😅
@dimitrishow_D
@dimitrishow_D 2 жыл бұрын
finally !! ty ive beeen looking for something like this 4 ever
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Thanks for watching, I hope it's what you've been looking for! Be sure to check out the follow up videos for some extra features and refinements.
@dimitrishow_D
@dimitrishow_D 2 жыл бұрын
@@NedMakesGames ive beem searching for a way 2 make my 2d cartoon in 3d and make it look like 2d..and especially the outlines have been the biggest hurdle with your vids i might be ablte to get close to what i want..ty i will be watching and liking all ur vids in the near future
@ilkke
@ilkke 3 жыл бұрын
Thanks for the lovely tutorial! I got the depth edges working correctly, but the colour ones are constantly 'flowing outwards' as if there is some form of feedback. I have been fiddling with the params for ages in order to stabilize them but to no avail. I can't figure out if I did something wrong or if it's just the numbers as your colour outlines imemdiately look comparable to the depth ones.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! Thank you! There could be a couple of reasons for this. Make sure that the scene color (or opaque) texture is enabled in your URP settings asset and camera. It could also be that your blit material feature is running before the color texture is ready. Move the render event in your renderer feature's settings later and see if that helps!
@ilkke
@ilkke 3 жыл бұрын
@@NedMakesGames thanks!
@pfarnach
@pfarnach 3 жыл бұрын
Did you ever figure this out? I'm seeing the same issue. I double checked my graph, copy and pasted all code, used the same material values as in the video, and made sure I enabled the depth and opaque textures + shader keywords, but after adding the opaque part of the graph, there's a trippy "flowing" effect that ends up creating a weird static pattern in the scene.
@Bombenleger11
@Bombenleger11 10 ай бұрын
In newer versions the 'SHADERGRAPH_SAMPLE_SCENE_DEPTH' makes an error, but I dont know how to fix it, do you have a suggestion ?
@低能u粉死全家
@低能u粉死全家 7 ай бұрын
Same issue for me :(
@shaunswanson897
@shaunswanson897 7 ай бұрын
If anyone has trouble with Unity 2021.3.20f1 I had to make my keywords in the graph set to exposed. Also, in the debug section the keywords are not separated by a space. There is now an array for them
@NaviYT
@NaviYT Жыл бұрын
I'm using an overlay camera for my weapon which is added to my main camera's stack and for some reason it is rendering the lines through my weapon. Making it feel transparent. Any idea why this would be happening?
@NaviYT
@NaviYT Жыл бұрын
Came back to say I fixed it. I just had to find a different solution to the weapon camera. I now render the weapons layer on the main camera and have a render feature that prevents weapon clipping using the main camera.
@michaelhayterphotography
@michaelhayterphotography 3 жыл бұрын
Hey Ned. Great tutorial. Been trying to do an outline shader for single objects for a week now and keep stumbling over things. Could you use the sobel matrix for individual objects with their own shader?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! That's possible. You could use hull outlines, which I detail in this video: kzbin.info/www/bejne/Z4KzcmapZbhmhdE. If you want to use edge detection outlines, it's still possible! You would need to modify the graph quite a bit so it runs on a mesh. I think you could still use the same custom function nodes, but you would need to get the screen space UV to feed into it. Then, blend the outlines with the mesh's albedo color. Could also delete the renderer feature at that point.
@TOPPREDATORable
@TOPPREDATORable 3 жыл бұрын
You could also give this a try. alexanderameye.github.io/jfaoutline.html it uses jump flood algorithm for outlines. It definitely has advantages but also disadvantages.
@datnade2299
@datnade2299 2 жыл бұрын
Hey there! I am new to the renderer side of Unity, so I probably did something wrong in the setup - I can't even get the effect to show up in the frame debugger (which I believe it should?). I tried your blit feature as well as the cyanilux one you recommended somewhere. There are no errors, only in your renderpass, there is a warning about the RenderTargetHandle being obsolete. How would I go about debugging this further? The project is in Unity 2022.1
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Hi! I have not tried this in Unity 2022, so I'm not sure if there are any major changes to renderer features. But, if your new pass does not show up in the frame debugger, that would suggest it's not running at all. I would start by setting your renderer feature to use a very simple material - create a shader graph to just output red for example. Then it will be very obvious if it's working or not. Then, I would try inserting Debug logs in various functions in the feature and pass classes to see which ones run and in what order. Hopefully, these steps will at least give you a better idea which parts of the system are running.
@datnade2299
@datnade2299 2 жыл бұрын
@@NedMakesGames Well, the good news is, I figured out a "solution". But I am so mad with how long it took :D In my Unity 2022.1, the project settings don't use any Universal Renderer Data asset other than the default one. Even if I switched them out (and it would show the new asset in the corresponding setting field!). I only noticed after a Library rebuild that the shown asset had reverted to the default asset. If I attach features to the default asset, the render passes do what they're supposed to. I tried reproducing the issue on a laptop but it appears to be specific to my PC. It's not Window's ransome ware protection. Not sure what else might interfere with writing to a settings file...
@NedMakesGames
@NedMakesGames 2 жыл бұрын
@@datnade2299 Now that is a strange one! Every once in a while, I do have problems with Unity's library becoming corrupted. It's always annoying to debug!
@StudioKuketo
@StudioKuketo 2 жыл бұрын
Hello, I am in Unity 2021.3 and I don't have any outline. :/ Also, I can't put any kewords on the materials but the DepthTexture checkbox shows up on the inspector. Thx in advance for help!
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Hi! I haven't gotten to test this in 2021 heavily, but you may be able to get it to work by adding the keyword to your Shader Graph. Doesn't seem like you have to do the material debug inspector step any longer.
@hibiscusbear
@hibiscusbear 3 жыл бұрын
amazing job as always!!!!
@ShenDoodles
@ShenDoodles 3 жыл бұрын
What settings do you use on your setup? I can't get the outlines to stay when I'm away from an object even when they do look decent.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! It didn't make it into this video, but the follow up ( kzbin.info/www/bejne/nIiQZqaoiK13g8U ) has a lot of little tweaks which should help with outline stability at different zoom levels. Specifically, jump to 10:25
@ShenDoodles
@ShenDoodles 3 жыл бұрын
@@NedMakesGames Thank you, I'll try this out tomorrow. You're a legend!
@yesir349
@yesir349 3 жыл бұрын
Great Tutorial Ned!
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Thank you! Thanks for watching!
@shadestylediabouros2757
@shadestylediabouros2757 2 жыл бұрын
Hello, sir! I'm using a different version of Unity (2022.2) and was wondering if this could be used for unity's Fullscreen Material on Custom Passes? I can't seem to get it working for it.
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Hi! I have not had time to try out that feature, but theoretically it should work. By that I mean the sobel algorithm will definitely give you outlines, but I'm not sure how to hook up depth and blend back to the screen using that method.
@shadestylediabouros2757
@shadestylediabouros2757 2 жыл бұрын
@@NedMakesGames Thank you for the response! I eventually figured out the problem through trial and error, and it didn't have anything to do with the Fullscreen Custom Pass, and, in fact, with unity's new features in 2022, it was easier than ever, as Shadergraph can now output the Scene Colors and Scene Depth using nodes instead of needing to render to a Render Texture first. Instead, it turned out to be a problem with the orthographic camera, which renders Depth Buffers differently from a Perspective Camera. I had to reduce the far clipping plane of my Orthographic camera to 500, and increase the sensitivity of my outline threshold much higher to compensate for that. Likewise, I discovered that to get pixel perfect outlines, (Ones that do not look blocky/have corners on a 1 pixel scale), you need to go into the Sobel Script and change the corner values of the number checking grid from 1 and -1 to 0's, as this will make the script ignore corner pixels in its calculations, making for a much crisper look. I hope this helps anyone who had the same issues that I did!
@NedMakesGames
@NedMakesGames 2 жыл бұрын
@@shadestylediabouros2757 I'm glad to hear it works so well in 2022! I hope I can check it out myself soon. Thank you for the detailed write up too, I'm sure it will help future viewers.
@jacobhuppertz5625
@jacobhuppertz5625 2 жыл бұрын
Hey man All I have is a black screen when my thickness is zero or less and no outlines with anything above 0. I also did not have the Feature definition option for the DepthTexture Boolean
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Hi! What version of Unity are you using? If you route the depth sobel custom function directly into base color, what do you see?
@viva-la-baz1458
@viva-la-baz1458 Жыл бұрын
This doesn't work with 2021.3? Followed the tutorial to the T, but no outlines show up.
@NedMakesGames
@NedMakesGames Жыл бұрын
Hi! Yes, it should work in 2021.3. Are you getting any errors? If you put a plain white material in your renderer feature, does your screen turn white? That would let you know that the renderer feature is running. From there you can start debugging the outlines graph.
@sealsharp
@sealsharp 3 жыл бұрын
Hey Ned! I wonder if there's a particular reason why the HLSL code is MIT license and the BlitMaterialFeature is GPL.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! Only because I switched licenses after my first few tutorials. Since I wrote BlitMaterialFeature.cs for one of my first tutorials, it's under GPL. I should get around to formally changing that, but for now, I give you permission to use BlitMaterialFeature.cs under the guidlines of the MIT license.
@sealsharp
@sealsharp 3 жыл бұрын
@@NedMakesGames Thanks!
@Smash_ter
@Smash_ter 3 жыл бұрын
Is this possible to replicate for the built in render pipeline and for unity 2019.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! Yes something like this is definitely possible. You would have to make a lot of changes (no renderer features or shader graph, depth texture is sampled differently, etc.), but the sobel algorithm would be the same!
@Smash_ter
@Smash_ter 3 жыл бұрын
@@NedMakesGames what about using ASE as an alt for shader graph?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@Smash_ter I’ve never used ASE, but I think it’s at least as powerful as the shader graph, so you should be good.
@H2GKursusOnline
@H2GKursusOnline 2 жыл бұрын
Using Unity 2021.3.11f1, the shader keywords text box cant be found in the debug window :(
@H2GKursusOnline
@H2GKursusOnline 2 жыл бұрын
nvm, found a solution. you need to create a "Boolean Keyword" instead of just a "Boolean"
@stefanvidev1255
@stefanvidev1255 Жыл бұрын
i dont get it.... exactly how are you actually getting the unity depth texture? I understand you made a boolean, and i did that too but its not working i just get pure black color everywhere, please advise, thanks in advance.
@stefanvidev1255
@stefanvidev1255 Жыл бұрын
Think i realized why, the hlsl script basiaclly has no idea what this is: "SHADERGRAPH_SAMPLE_SCENE_DEPTH"
@NedMakesGames
@NedMakesGames Жыл бұрын
@@stefanvidev1255 SHADERGRAPH_SAMPLE_SCENE_DEPTH should be defined for URP Shader Graphs. Do you have the depth texture enabled on your URP settings object? What version of Unity are you using? You could try routing a scene depth node into the output node just to see what that looks like.
@stefanvidev1255
@stefanvidev1255 Жыл бұрын
@@NedMakesGames Oh thanks for your reply man, i actually realized i had made a boolean instead of keyword boolean, my bad man.
@bensmith5373
@bensmith5373 3 жыл бұрын
I get the outlines showing up in the material preview, however not in the scene itself, any idea what the reason for this is? I'm using 2020.3
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! I wonder if your renderer feature is set up correctly? Try having your outlines shader graph just output red (route a color node into the base color field) and see if your game screen turns red. If not, then double check your renderer feature. Feel free to post a screenshot if you'd like and I'll take a look at it.
@bensmith5373
@bensmith5373 3 жыл бұрын
I fixed that problem, but it doesn't look quite right. I get these weird fuzzy visual effects, here is a screenshot. ibb.co/cDRJTZb. The area under the lines. Some of the lines themselves are a bit fuzzy. Thanks for your help.
@Devels.
@Devels. Жыл бұрын
Hi, I'm using Unity 2022.2.21, I followed the tutorial, and the outlines are showing, but now there is no color except white and black outlines. Any idea on why this is happening? Great tutorial btw :D
@NedMakesGames
@NedMakesGames Жыл бұрын
Hi thank you! This is usually an issue with the final blend node, which blends outlines with the main screen texture. Try routing each input into the blend node into Base Color and see what it looks like. That should help you see what's going on.
@Devels.
@Devels. Жыл бұрын
@@NedMakesGames I got it working by using scene color instead of using sample texture 2d :D Thank you!!
@TheBooguninator
@TheBooguninator 2 жыл бұрын
If you have black vertical lines going across your screen like i did make sure the input UV in the custom function is a vector2 not a float or vector1
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Oh yes, I think everyone makes this mistake at least once when using Shader Graph. Thanks for the heads up!
@barbarareichart267
@barbarareichart267 2 жыл бұрын
Thanks a lot, this really helped me soo much
@matthieusommervogel1248
@matthieusommervogel1248 3 жыл бұрын
Hi ty for the video ! I can't understand why it's not working. I can see the outline but the other part of the screen is blank (color of the parameter in the node of the main texture) Any idea ? thank you !
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi, thank you! Probably just a small error in your graph. Do you mind to take a screenshot of your graph and I can take a look?
@matthieusommervogel1248
@matthieusommervogel1248 3 жыл бұрын
​@@NedMakesGames thank you for your quick answer! I don't know how to post my image so here is the link to download my shadergraph screen. we.tl/t-wCr91GeXFa Thanks a lot anyway! :)
@pedropc5824
@pedropc5824 2 жыл бұрын
This method works with models with rigidbody component? Others outline shaders that i have tested don't work on models with rigidbody component
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Hi! Yes, it doesn't care what kind of physics you apply to models.
@pedropc5824
@pedropc5824 2 жыл бұрын
@@NedMakesGames Thanks!!! Your videos are always very useful to my projects!
@leemiller2243
@leemiller2243 3 жыл бұрын
would love to see other lighting techniques such as blinn phong as well as water shaders or shaders that deal with vertex displacements
@NedMakesGames
@NedMakesGames 3 жыл бұрын
All good suggestions! I will add them to my to do list!
@leemiller2243
@leemiller2243 3 жыл бұрын
@@NedMakesGames how long have you been doing this cause your knowledge is crazyyy
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Haha thanks! I've been doing Unity stuff for about eight years!
@leemiller2243
@leemiller2243 3 жыл бұрын
@@NedMakesGames lol this makes sense
@jordan_marcus
@jordan_marcus 3 жыл бұрын
Would it be possible for color edge detection to exclude black edges, and if so how would I implement that?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hmm, do you mean edges with black on one side? I'm not sure how well it would work, but you could modify the sobel color function to check if any of the samples are black, and if so, set the sobel value to zero.
@NishanGhoshgameshamelame
@NishanGhoshgameshamelame 3 жыл бұрын
Hello! Thank you for this amazing tutorial. I have noticed, significant framerate drop while running this shader on a mobile device with decent specs. (snapdragon 855 cpu and adreno 640 gpu), processing depth and color edge calculation for each frame must be taxing and presumably a game with multiple objects in a scene with lower specs device would perform much slower. I understand this wont be a problem for other platforms such as pc or console but could you please explain certain work arounds or optimization on this shader (for a mobile device.)
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi, thanks for the kind words! One good thing is these outlines take the same amount of rendering power no matter how many objects are on the screen, since it runs as a post-processing effect. You could save some power in a couple of ways. If you don't use one, turn off either the depth or opaque textures. That will help a lot. Secondly, you can remove the non-diagonal kernel positions in the HLSL file. This will half the number of texture lookups. Quality will go down but that should help with performance.
@NishanGhoshgameshamelame
@NishanGhoshgameshamelame 3 жыл бұрын
Good to know, will experiment further and many Thanks for sharing.
@leemiller2243
@leemiller2243 3 жыл бұрын
Is there anyway i can combine this with the toon shader because I blended this with the sample 2d node and turns the mesh dark. The other method didn't work so I tried this . I am at the point where i am thinking my mesh is to complicated lol
@NedMakesGames
@NedMakesGames 3 жыл бұрын
It's a lot like the hull outlines. You put the outline material in the blit material feature, and it will draw on top of everything else. No need to blend the graphs together!
@trainsfemme
@trainsfemme 3 жыл бұрын
I created a new URP project, but there is no BlitMaterial when I click "add render feature" in the URP renderer inspector. How do I fix this?
@trainsfemme
@trainsfemme 3 жыл бұрын
Am using Unity 2020.2.7f1
@trainsfemme
@trainsfemme 3 жыл бұрын
So sorry, I figured it out. Mea culpa
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@trainsfemme No problem!
@trainsfemme
@trainsfemme 3 жыл бұрын
@@NedMakesGames Though, I do have an issue - mainly that color attenuation isn't working. The actual outlines work fine, but not color. I tried copy-and-pasting your finished version of the HLSL into the text file, and that didn't fix anything.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@trainsfemme Do you mean the shading on your mesh? That's actually a toon shader - separate from this outlines shader. I have a series on toon shaders here if you're interested: kzbin.info/aero/PLAUha41PUKAasDP7TOMBRramS5mkQ0hIG
@swannschilling474
@swannschilling474 3 жыл бұрын
I am having the problem that everything works fine in the editor...also when I hit play, it all works! But when compiling the Game it does not show at all...any ideas?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! I would start by looking at the build’s log files. docs.unity3d.com/Manual/LogFiles.html Are there any errors in there to give a clue?
@swannschilling474
@swannschilling474 3 жыл бұрын
@@NedMakesGames Hey, I watched you tutorial again and realized that I forgot to turn on Depth Texture in the URP settings...thanks for making these, they are a great help!! :) I am having another issue which is not related to you tutorial, but also to post processing...bloom also only works in the editor and not at runtime, could there be a related fix?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@swannschilling474 Oh good! I'm glad they're helping! Are you using the bloom included with URP post processing? You could try making sure the opaque texture is enabled in the settings asset, as well as post processing on your camera.
@swannschilling474
@swannschilling474 3 жыл бұрын
@@NedMakesGames Yes, I am using the bloom inluded in the URP post processing...its the one that came within the URP template! I got post processing enable in my camera and opaque texture is enabled! I am pretty new to the scriptable render pipeline, maybe I messed something up along the way?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@swannschilling474 Hmm I’m not sure why that’s happening. Are you building for Android by chance? I read some post processing doesn’t work on it: forum.unity.com/threads/bloom-doesnt-work-on-android-build-with-urp.950416/
@lucyboydwilson
@lucyboydwilson 2 жыл бұрын
Great tutorial! Thanks so much!
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Glad to hear that! Thanks for watching!
@armagedonthe1gamer
@armagedonthe1gamer Жыл бұрын
Nice video, really informative. I'm currently stuck in 2021.2.10f1 with trying to apply it to the entire scene. The outlines are working fine, as they are present as a lighter color of the base color when placing the material on a object, but outlines aren't visible in screen view. I have no errors on the project so I'm imagining I'm missing something somewhere, the material is in the blit material for the render pipeline and post processing is checked on my main game camera. I'm writing this as I'm about to go to bed so sorry if this question isn't written well. Also thanks for answering a lot of these questions in the comments! it's helped troubleshooting a lot here. if you or anyone else could help me here I would greatly appreciate it!
@armagedonthe1gamer
@armagedonthe1gamer Жыл бұрын
Still have the problem of it applying through the renderer, but I found a work around with applying it to the object, I was able to get the outlines to appear when changing the material to a transparent mode then multiplying it. So now I have an object in front of the camera view always following around the player character to give the outlines, gonna have a friend look over it tomorrow and give some help to see if there's any other way of doing this as currently there's light changes that happen when moving the mouse that can be annoying.
@NedMakesGames
@NedMakesGames Жыл бұрын
@@armagedonthe1gamer Hi! Well I'm glad it's sort of working now! There seems to be issues with this outline system and stacked cameras, do you happen to use that system?
@armagedonthe1gamer
@armagedonthe1gamer Жыл бұрын
@@NedMakesGames I am not currently using stacked cameras, but I believe we will be integrating them for use of hud and ui systems later on.
@OfflineOffie
@OfflineOffie 3 жыл бұрын
Hai, Love the tutorial videos! Have you ever tried creating a pixel perfect line in 3D? Something like the Line renderer, but pixel perfect. Drawing single pixel thick lines in the scene.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi, thanks! I have done something like that using a pixel perfect camera in a low res, pixel art game. It would be an interesting challenge to get working in other settings!
@dominiauk
@dominiauk 3 жыл бұрын
Hi, first thanks for this video really informative. However I think I have set it up wrong as if I say set this for one of my prefabs so say trees use this material I thought only those would be outlined but it seems it just renders the enter texture on the screen over what should be displayed. So say I pick a texture of a sword, set that on the blit material, run my project then instead of seeing all the trees for example in the view I just see the sword texture. Any ideas? Thanks
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! Thank you, I'm glad it helped you! Yes, this particular implementation draws outlines over the entire screen. The outline material should only go inside the renderer feature, your objects should just have materials with "normal" shaders. If you only want outlines on specific objects, try this tutorial: kzbin.info/www/bejne/bWWkhGh6orGYbtk
@dominiauk
@dominiauk 3 жыл бұрын
@@NedMakesGames Thanks for the reply, actually I do want one that does an outline to everything but when I try adding it to the renderer I just get a white screen. The white screen is because of the Empty (white) Texture. If I drag a texture into it then I get that as the whole screen, nothing else is drawn just the entire texture. Is there something I need to do to tell it to use what is being rendered as the texture? Sorry if I'm being dumb but can't see how the screen image is being used as it just uses the texture in the shader. Thanks again, for any help or pointers!
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@dominiauk Oh sorry for the confusion! It's no problem. Do you mean the main texture in the outlines post process material? You can leave that blank and the system will fill it with the screen's texture. If you don't see any outlines, try changing some of the material settings or moving the camera around. Feel free to take a screenshot of your graph too and I can take a look at it!
@dominiauk
@dominiauk 3 жыл бұрын
@@NedMakesGames Hi Ned thanks for the help, I've got it now rooky mistake! I'd named the Texture _MainTex but not the Reference. So I guess it wasn't being picked up by Unity. Seems to be working fine now. Thanks again for the help, very much appreciated !
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@dominiauk I'm glad it's working! No problem! That's an easy mistake to make
@davidchaikovsky3625
@davidchaikovsky3625 2 жыл бұрын
OMG, so cool! Going to try this
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Thank you! I hope you like it in game!
@fangoerbayun2587
@fangoerbayun2587 3 жыл бұрын
Hi Ned, I copied the process 1 to 1 on 2019.4.13f1 and my outline is messed up, is it possible for you to upload the shadergraph and ball texture as well to compare those?
@fangoerbayun2587
@fangoerbayun2587 3 жыл бұрын
or the demo proj? I don't know what I did wrong
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@fangoerbayun2587 Hi! Sorry, I don't have those available, at the moment. The ball texture is nothing special though, it's just vertical rainbow stripes. Can you take a screenshot of your scene and/or graph? I might be able to help out.
@fangoerbayun2587
@fangoerbayun2587 3 жыл бұрын
@@NedMakesGames Thanks for the reply! I found out that I was missing to set the material in the renderer features, the vid covers it briefly at 1:35 but the material is never set in. I actually thought that this is a material shader applied to each ball. So it's not that useful for my case because I don't want the outline applied to all objects.
@fangoerbayun2587
@fangoerbayun2587 3 жыл бұрын
Sidenote, do you know how I can make an outline for a 2d texture on a quad? Simple outline, only external, not internal by colors like yours. I followed this (kzbin.info/www/bejne/fKe0d5uhiJ5jpKs&ab_channel=CodeMonkey) tutorial and it works great for a 2d sprite, but I also have a quad mesh that I put a 2d texture (with transparency). I switched the graph node from Sprite Lit Master to PBR Master, and it's broken and shows just a line.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@fangoerbayun2587 Oops! Looks like I made an editing error there. Sorry about that! If you want outlines per object, you could check out my hull outlines: kzbin.info/www/bejne/Z4KzcmapZbhmhdE (Although looking at your sidenote, I don't think these would work, either) I'm planning a video to apply edge detection outlines from this video per object, too! Should be out in a few weeks. As for your sidenote, I haven't played around much with sprites in shader graph, so I can't give much insight. At first glance, I would check the UVs on your quad to make sure they're set up how that graph expects.
@ThomasChen-ur2gt
@ThomasChen-ur2gt 3 жыл бұрын
My depth texture is always black. I'm trying to figure out why.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
That is strange! What Unity version are you using? Is depth texture turned on in your URP settings asset? Also make sure the sample depth keyword is enabled on the blit material.
@ThomasChen-ur2gt
@ThomasChen-ur2gt 3 жыл бұрын
I fixed it but I'm not sure how. Thanks for the reply.
@downstream0114
@downstream0114 2 жыл бұрын
So how would I avoid the color effect on the skybox?
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Hi! You would have to get the skybox not to render to the scene's opaque texture. You might be able to do this by changing the skybox's render queue value to "Transparent."
@Robin-br6ju
@Robin-br6ju 2 жыл бұрын
Hi, I work in Unity 2020.3.30 urp, and followed everything from beginning to end (with the changes in the comments). But the thickness doesn't seem to change no matter how much I change any settings. I checked debug mode and all multiple times, but don't see any difference in thickness. I'm not certain if have to make any changes for Unity 2020.3.30. Does anyone know what could be wrong? Would be a great help.
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Hi Robin! It's easy to make little mistakes in you graph, so if you'd like, I can take a look at it. Feel free to take a screenshot and either email me or message me on Discord (you can find links in the video description). You can post here as well, though KZbin tends to hide posts with links (so I won't get a notification).
@Robin-br6ju
@Robin-br6ju 2 жыл бұрын
@@NedMakesGames Thanks, asked my teacher and he helped me solve it. Love your videos, they are really helpful. 👍 👍
@NedMakesGames
@NedMakesGames 2 жыл бұрын
@@Robin-br6ju Thank you, I'm happy to hear that! Glad it's fixed!
@Nadeloehr1990
@Nadeloehr1990 3 жыл бұрын
I finished every step of the tutorial, sadly it's not working and nothing changed. There is an error in the .hlsl file and Rider tells me: Cannot resolve symbol 'SHADERGRAPH_SAMPLE_SCENE_DEPTH'. Could that be a problem - how can I make it work?
@Nadeloehr1990
@Nadeloehr1990 3 жыл бұрын
Found my mistake: Wrote "REQUIRED_DEPTH_TEXTURE" instead of "REQUIRE_DEPTH_TEXTURE". Thanks for the video! I hope many more will watch your content.
@Nadeloehr1990
@Nadeloehr1990 3 жыл бұрын
I'm really happy with the result so far.
@Nadeloehr1990
@Nadeloehr1990 3 жыл бұрын
Wierd thing is, that the outlines are nice if the camera is close, as soon as the camera zooms out the shaders blur out.
@Nadeloehr1990
@Nadeloehr1990 3 жыл бұрын
After doing the last step it works fine. Only problem left is that if I zoom out the Thickness of the outline stays the same and doesn't get smaller with the mesh. Is that fixable?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@Nadeloehr1990 Hi, I'm glad everything works now! Usually that is a feature of these outlines - that they don't change with perspective! I hate to tell you to do this since you just got these working, but your best bet would be to use hull outlines. I have a video about them here: kzbin.info/www/bejne/Z4KzcmapZbhmhdE Alternatively, you could change your graph a bit to shrink thickness for far away objects. Add a scene depth node. Then multiply that with your thickness property before feeding it into your sobel custom function nodes. You could even use a smoothstep to set minimum and maximum depths, or a lerp node to set minimum and maximum thicknesses. I haven't tried this myself, so it might have a few weird artifacts, but it might be worth a try!
@bananazzplit
@bananazzplit 2 жыл бұрын
hi i did everything you said to do and the outlines are there but the color of my whole map is gone. Where is the problem ?
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Hi! It seems like either the scene color node isn't working or isn't blending with your outlines. What displays if you route the scene color node directly into base color?
@bananazzplit
@bananazzplit 2 жыл бұрын
@@NedMakesGames what you mean "scene color node" ? the UV node ? the "color" node ? sorry i'm not used to shader graph 😅
@NedMakesGames
@NedMakesGames 2 жыл бұрын
@@bananazzplit Oh I'm sorry, I mispoke. I meant the main texture sample. What happens if you route it directly into base color? I think something wrong might be happening with it.
@bananazzplit
@bananazzplit 2 жыл бұрын
@@NedMakesGames everything turns white and loses the outline
@bananazzplit
@bananazzplit 2 жыл бұрын
@@NedMakesGames OH i found the problem ! xD I left the Main texture reference in _MainTexture and not _MainTex I didn't think the reference was so important. Thank you 😁
@shaunvandermey4305
@shaunvandermey4305 3 жыл бұрын
Heya, awesome tutorial but I'm having an issue with the hlsl code. Visual Studio tells me "Function 'SHADERGRAPH_SAMPLE_SCENE_DEPTH(float2)' is not declared." , and I have everything written out the same way as the tutorial. I'm also pretty certain I've set up my Renderer the same way. Does anyone know a solution for this problem?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! Visual Studio gives you that error? Does Unity as well? Visual Studio might just be confused because it doesn't know shader graph automatically includes some files, but the code will still work in Unity. To get rid of the error, you could try manually #including the URP ShaderGraphFunctions.hlsl file, which contains the definition for that macro. If it's a problem in Unity too, you might need to update your URP or shader graph package.
@shaunvandermey4305
@shaunvandermey4305 3 жыл бұрын
​@@NedMakesGames I've made sure that ShaderGraph and the URP are using the latest versions, and the error only shows up in Visual Studio, not Unity. Using #include to add the ShaderGraphFunctions.hlsl file doesn't seem to work, and if I add the code from that file by copy-pasting the shadergraph_LWSampleSceneDepth function and associated #define, it compiles fine but then Shader Graph throws an error on the custom node telling me I've made a "redefinition of _Time". I can still get some weird results out of the shader so it's not entirely non-functional but nothing like what's in the video. Thankyou for your time!
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@shaunvandermey4305 That's really strange. Do you have the Visual Studio Editor package in the package manager? If Unity doesn't throw any errors, you could just ignore Visual Studio in this case. Unity does the compiling of your game code, so everything should work OK.
@greggalloway6410
@greggalloway6410 2 жыл бұрын
Half the reason I liked was because there were 665 likes. I've been using shader graph for 2d, so most of this tutorial didn't apply to me, but I skimmed it anyway.
@NedMakesGames
@NedMakesGames 2 жыл бұрын
😄 Well thank you for watching!
@ThomasChen-ur2gt
@ThomasChen-ur2gt 3 жыл бұрын
I missed the part where you changed the blend mode and spent two days trying to figure out what went wrong...
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Oh no 😧 I wish Unity made that dropdown a little more noticeable!
@Capybarrrraaaa
@Capybarrrraaaa 3 жыл бұрын
Mine just comes out solid white...
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! There may be something wrong with your graph. Make sure the "reference" of your main texture property is set to "_MainTex" . Also, feel free to upload a screenshot of your graph and I can take a look at it!
@Capybarrrraaaa
@Capybarrrraaaa 3 жыл бұрын
@@NedMakesGames That solved it, thanks!
@VyvyanTheGreat
@VyvyanTheGreat 3 жыл бұрын
Your outlines are so crisp and dark, mine are blown out and transparent. Not sure what I did wrong! (I run into this issue with other sobol tutorials too)
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Outlines are really tricky! It may just take a lot of tweaking the material properties, especially the thresholds. I found depth outlines are especially difficult to get right. I make a few improvements to them in the video releasing tomorrow, so hopefully that will help!
@quantum_leap786
@quantum_leap786 Жыл бұрын
unfortunatly doesnt work now :/
@meganweber5057
@meganweber5057 3 жыл бұрын
Is _MainTex the depth texture?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
No, _MainTex is the screen texture. You can access the depth texture with a Scene Depth node (or the SHADERGRAPH_SAMPLE_SCENE_DEPTH macro in HLSL code).
@tinytea3323
@tinytea3323 3 жыл бұрын
really cool tutorial
@ministryofhumor
@ministryofhumor 3 жыл бұрын
Love you!
@unclerandy398
@unclerandy398 3 жыл бұрын
Can I do this with standard unity?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
You mean the built in render pipeline? Outlines are possible, but you can’t use the shader graph or renderer features, so the implementation would be very different. You could use the same sobel algorithm though.
@downstream0114
@downstream0114 2 жыл бұрын
Note: Blend node needs to be in overwrite
@Atulkumar-sz6tg
@Atulkumar-sz6tg 3 жыл бұрын
Supper awesome !!!!! Great
@josemartin3474
@josemartin3474 Жыл бұрын
Subscribed!!! These tutorials are simply AMAZING! I have a road blocker though, in case someone could help me. I'm using Unity 2021.3.26f1 and when I get into Debug mode to change the Shader Keyword to REQUIRE_DEPTH_TEXTURE (7:43) I can't find that field :( Instead I see Valid Keywords Size and Invalid Keywords Size. Does anyone know how to pass this issue? TY!
@NaviYT
@NaviYT Жыл бұрын
It should either already be in valid keywords or if not add the keywords to the list. There should be one item for each keyword
@pivinis
@pivinis 4 ай бұрын
Is this optimized???
@pivinis
@pivinis 4 ай бұрын
Pls Reply
@pivinis
@pivinis 4 ай бұрын
Beacuse i am having a bad pc
@naeyoo42
@naeyoo42 2 жыл бұрын
Great tutorial and explanation! But has anyone had any luck with Unity 2021.2.13? I should say I get no errors and I've triple checked my keywords.
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Hi! If you look in the frame debugger, (window -> analysis), do you see your outlines pass show up? It should be near the bottom of the window. If not, something is wrong with your renderer feature. If yes, something is wrong with your shader or material.
@naeyoo42
@naeyoo42 2 жыл бұрын
@@NedMakesGames Thank you so much for replying. Unfortunately I've still had no luck. The outlines pass shows up in my frame debugger so I'm going to try re-creating the material from scratch again. I have this feeling it's going to be the smallest and simplest issue when I find it.
@naeyoo42
@naeyoo42 2 жыл бұрын
@@NedMakesGames I've actually just found out I can see the effect of the individual outlines pass by selecting it in the fame debugger. Perhaps there's something wrong with the way I'm applying the effect to the frame. The Outlines pass has no render target as opposed to the other passes in the frame debugger.
@NedMakesGames
@NedMakesGames 2 жыл бұрын
@@naeyoo42 Hmm, that would indicate a problem with the renderer feature, I guess. Try using this blit material feature instead of the one in the video: github.com/Cyanilux/URP_BlitRenderFeature Cyanilux's has a few updates which could fix this problem.
@naeyoo42
@naeyoo42 2 жыл бұрын
@@NedMakesGames Thank you so much, you've just saved my project. The Blit Material Feature from the git project works perfectly!
@uguur
@uguur 3 жыл бұрын
is it optimized for mobile?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
There are probably some optimizations to be made - I usually focus more on clarity for the tutorial's sake. That said, some old mobile devices have problems with the extra memory taken by the depth/opaque textures. I think current hardware can handle it though.
@uguur
@uguur 3 жыл бұрын
@@NedMakesGames thank you sir.
@ahmadmarhaba
@ahmadmarhaba 3 жыл бұрын
pls make a video showing only on specific objects not the entire screen and changing its color to maybe red idk, since alot of games have enemy ai that have red shader border on them but in Rinder Pipline its legit hard.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
You can change the color of these outlines already. But I am writing a video about applying these to individual objects right now! Should be out in a few weeks
@ahmadmarhaba
@ahmadmarhaba 3 жыл бұрын
@@NedMakesGames wow! thank man I appreciate it
@Nadeloehr1990
@Nadeloehr1990 3 жыл бұрын
Nice video. But what annoys me is that you click too fast, that makes me rewind the video all the time in order to see what you just clicked...
@Nadeloehr1990
@Nadeloehr1990 3 жыл бұрын
It's too fast. I cannot follow up.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi, thanks for the feedback. It's a difficult balancing act for me between going too fast and being too long winded. I will try to do better! Feel free to change the playback speed by clicking the gear in the borrom right corner of the video. I hope that helps a bit.
@Nadeloehr1990
@Nadeloehr1990 3 жыл бұрын
@@NedMakesGames nice 👍
@getemratan6516
@getemratan6516 3 жыл бұрын
I have black screen can anyone help??
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! Does your screen go black after you turn on the renderer feature? I would guess something is wrong with your shader. Feel free to post a screenshot of your graph and check you script against the references in the video description.
@getemratan6516
@getemratan6516 3 жыл бұрын
@@NedMakesGames thanks for your reply I had depth texture off in the URP asset :P
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@getemratan6516 Oh that would do it! I’m glad it was a simple fix.
@BlazertronGames
@BlazertronGames 2 жыл бұрын
It's a shame they've overcomplicated image effect shaders so much. All you used to have to do was pass an image effect shader material to Graphics.Blit().
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Yeah, I especially miss the camera rendering callbacks
@spaget_
@spaget_ 3 ай бұрын
Bad tutorial. It no longer works with newer unity, and the original creator doesn't care or bother to clear up a fix. The beginning part is also confusing to what to do Wasted time.
@Julesv13
@Julesv13 2 жыл бұрын
Hey, in the urpasset_renderer inspector there is no option to add the render feature blit material feature. Am I using the wrong version or doing something wrong? On a URP template for 2020.3.2.
@NedMakesGames
@NedMakesGames 2 жыл бұрын
Hi! The Blit renderer feature is a custom renderer feature. You can download it from the video description. Add it to your project and it should show in that list.
@ecthoart3815
@ecthoart3815 3 жыл бұрын
I'm using this in a game, and I've noticed that my reflection probs stopped working when using the Blit material in the Forward Renderer. The baked ones are fine, but the realtime ones are all black. Is there a fix or a way around this?
@NedMakesGames
@NedMakesGames 3 жыл бұрын
Hi! It's strange that a screen space blit messes up reflection probes! I'll have to look into this more, but you might try this blit renderer feature: github.com/Cyanilux/URP_BlitRenderFeature It fixes a few edge cases, and may work better for you. What version of Unity are you using?
@ecthoart3815
@ecthoart3815 3 жыл бұрын
​@@NedMakesGames ​ Thank you! I probably should have mentioned I'm using unity 2019.4.16. If that helps.
@NedMakesGames
@NedMakesGames 3 жыл бұрын
@@ecthoart3815 Thank you! I haven’t tried this in 2019, so it could be a Unity issue. I’ll see if I can find something about it.
The Strange Graphics Of LETHAL COMPANY
15:59
Acerola
Рет қаралды 891 М.
pumpkins #shorts
00:39
Mr DegrEE
Рет қаралды 120 МЛН
SISTER EXPOSED MY MAGIC @Whoispelagheya
00:45
MasomkaMagic
Рет қаралды 12 МЛН
Outlines - Devlog 2
13:47
Robin Seibold
Рет қаралды 73 М.
Moebius-style 3D Rendering | Useless Game Dev
8:12
Useless Game Dev
Рет қаралды 841 М.
Finding the Edges (Sobel Operator) - Computerphile
7:46
Computerphile
Рет қаралды 502 М.
When Your Game Is Bad But Your Optimisation Is Genius
8:52
Vercidium
Рет қаралды 1,5 МЛН
pumpkins #shorts
00:39
Mr DegrEE
Рет қаралды 120 МЛН