@@RobinSeibold Can you pls tell how to do this effect in hdrp
2 ปีที่แล้ว +33
The outline solution itself is very nicely done and smart but i think it's your video editing that blew my mind the most, it's insanely good. I can't wait for more
I'm new to development in unity and I had tried both full screen pass methods and the back face method, but ran into similar problems. Thank you so much for sharing what you've made, it made my aesthetic dream possible as well!
After researching outlines for cel shading this video blew me away! I understand almost -none- of it, but I'm going to study every second and hopefully try recreating the effect myself.
Wonderful devlogs! Please keep up the good work! I really appreciate it 🙂 In order to make the outlines work I needed a few hours: After switching the filter mode in the settings of the active URP renderer from "Point" to "Bilinear" and switching the "Render Pass Event" to at least "After Rendering Opaques" (or later) it worked :-) Thank you!!
Hey there, I'm wondering if you had any advice for getting this to render. I can only get the outline to render IF I use an overlay camera with camera stacking, the overlay camera will render it but no matter what I do. The base camera NEVER renders the feature. Terribly frustrating! Haha.
@@smallflyDE I've tried one camera with the exact same settings to no avail, haha. Do you have discord, maybe I can send you a really quick video. I'll even pay a little for a moment of your time as I can understand you might be busy. :)
Amazing showcase! Love the in-depth explanations! I managed to obtain an almost identical effect with the new 'Full Screen Pass Renderer Feature' by just applying Roberts Cross to the depth texture... but the major issue we face is the anti-aliasing. The objects are quite close to the camera and the outlines are extremely jagged with no control over any sort of smoothing. I tried your solution, but unfortunately the result is identical. I saw you mentioned anti-aliasing on your Git-Hub, any idea on how to approach it? I'm no expert, but MSAA does not seem achievable in a screen space effect, and not sure an extra pass for blur would have the same quality result as actual MSAA... either way, if you get around to addressing this, I am sure everyone here would love it! PS. We also use the zbuffer to mask out the outline that is over the object, to have 'outside-only' outline ;)
Thank you! Yeah, the aliasing is definitely a problem, and right now I'm relying on the camera SMAA anti-aliasing algorithm instead of MSAA, which works for the outlines. However, since this isn't really a solution I've been looking into ways of generating the outlines already 'anti-aliased' so to speak. Haven't implemented anything yet, but will share when I do!
Hey, loving the outline. Is this meant to only work with the URP renderer set to Deferred? I have one camera and it will only render the outline if set to deferred. If not, I can use forward ONLY if I use an overlay stacked camera. The base camera never renders the outline, no matter what settings are used. Hopefully I'm not missing something obvious! :)
Hey! Replied to your tweet, but if you haven't seen it check out the issues and corresponding pull requests in the GitHub repo, this feature works with forward rendering.
Nice work! One question though, why is the scene depth used as an input to the step function (goes to the `edge` param) during thresholding at around 11:12? Couldn't this be a constant like (0.5, 0.5, 0.5)?
I love this code - it works exactly as I need it to. I hit a snag due to my lack of Unity knowledge though - How do I change the outline colour at runtime in a script? Any tips? Thanks in advance.
at 11:16 and 12:08 how are you getting the SceneViewSpaceNormals texture node? i'm guessing this comes from the other shader graph but i don't understand exactly how that node is being brought in to the outline shadergraph ** ah ok looks like you've answered this below. thanks!
Okay, so I'm on 2021.3.16f1 Copied the repo into my project, did al the things to get it working, no errors or anything. The screenspaceoutlines seem to work, but for some reason I'm not getting the correct viewspacenormals-lines (I think) I even made the same 3D-double-cross thing like in the video, but I'm not getting the correct inner lines on the mesh.. Anyone know why that might be? Edit: goddangit, outlines layermask was set to 'nothing' in stead of everything. Everythings fixed now. I'm dumb :')
Very informative video, thank you! The last part confuse me and would you be so kind to show the drawsetting and filtering setting for outline occlusion render? Cheers!
Hey, great tutorial. The Reanderer Feature works really well, but I cant get it to work in VR. In VR only one eye renderes the outline texture and the camera perspective is wrong. Maybe you know a quick fix for this?
@@RobinSeibold Sounds good! I've read some of the other commments and you mention storing the outline color in the texture normal. I've tried a few different ways but could you point me in the right direction? I've created a script with an outlineColor field. I've added this script to each object I want to have an outline. 'ViewSpaceNormals.shadergraph' : I think this is where I need to pack the outline color into the normal texture. 'Outlines.shadergraph' : I think this is where I need to unpack the outline color from the normal texture. This contains an 'OutlineColor' property conected to a split that will no longer be used. I guess the extracted outline color will need to be connected to the split instead. do I need to modify ScreenSpaceOutlines.cs? Thanks so much for your help
I have heard Jump Flood is one of the best ways to make outlines "fast". How well does your work on the performance? I also love the look. It does exactly what I think an outline should do.
Interesting! Haven’t tried jump flood, but this makes me want to, just to compare! Thanks for the tip! I haven’t really done any performance tests yet! Currently working on some outline improvements and will do a second video about those, might do some performance analyzing then as well!
Thank you! It works on transparent object with minimal setup/changes. It does not work on transparent objects AND through them at the same time though.
It's still suffering from a lot of shimmer aliasing in motion. Perhaps an FXAA (or something else?) pass is warranted? Or better yet, incorporate surface ID based outlines. That was the direction I ended up going in.
Yes, there's no native anti-aliasing in the outline algorithm at this point, all though SMAA is applied after. Do you have any links or write-ups about "surface ID based outlines"? Sounds Interesting.
sorry, i am a newbie in shaders, i want to make a outline like this and this is the video show the codes and graphs clearly i saw i liked how you explain them step by step, but stopped in a middle in a line & collapse the code, then jump to code something else is easy to mis-follow to me but still a most cleary video and best outline effect i saw
What values should i use for all parameters in the outline shader? And how would i convert this to use RTHandles, since rendertargetidentifier is now obsolete?
Hey Man, You are killing it with the devlogs. The Quality on these is insane! I had a question about the RobertsCrossMultipler node you used at 11:04? Is that a custom node or a subgraph that you made? I have been doing some research on the Roberts cross operator and I think I understand the basic principle of the formula, but I am not sure how to start the process of implementing it. Thanks again!
Thank you! :) The RobertsCrossMultiplier node at 11:04 is actually just a property with a value of 100 if I remember correctly. All the nodes seen in 11:04 together forms the Roberts Cross implementation for scene depth edge detection.
Hello, I'm a real beginner at unity and I came across your video. It's really very complex and I must admit I didn't understand all the explanations haha. But it's exactly what I was looking for, thank you very much! First of all, it seems to me that the layer mask only works for the Edge detection aspect of your post-process, because despite a chosen layermask, the outline is still drawn on my other objects. then I'd have liked to be able to set the ScreenSpace Outline render feature several times to be able to set different edge colors for different objects depending on their layer, but as soon as I set it twice, the two render features stop working, as if they were canceling themselves. If you continue to improve this renderer feature, I think my two questions might be worth looking at
If the outlines are drawn on other objects, it means that something is wrong with the setup, not the implementation, since it works for me and others. As for the second question, this post processing solution wasn't built to be stacked, hence why it probably breaks. If one wants different colors for separate outlines a much better approach would be to pack data in the normals texture, and utilize that in the outline shader.
@@RobinSeibold Thank you very much for this reply, despite the age of the video. I'm going to try again to put everything back in place. Also, I'm not skilled enough to be able to realize your proposal but it's very kind of you to explain to me what would have been a good solution for what I want to do. And finally, after a certain distance, it seems that the effect is reversed. the color of the edge detection we've chosen spreads over the surfaces. it also seems to change according to the size of the screen. I suppose there's plenty of explanation in the video, but as my English isn't very good, I couldn't understand it all. If ever there's a place, forum or other, where we can talk about your shader, I'd love haha to potentially get some help. I'm already going to look at the links you shared in the description. Edit: i retried but i have the same issue. When I set the ScreenSpaceOutline with "Nothing" in the layermask and occlude layer, it sets the outline but not the edge detection. So I have a bright red outline on all my cubes. When I put a layer called "Visible" in the layer mask and keep "Nothing" in the occluder layer, I get the internal edges added for my cube in the "Visible" layer. But in addition to the artifacts when our "Visible" layer object is behind another object, the outline ( just the contour) is always present on the other cubes.
@@Tyliart I think the best option is to post your error and questions as an issue over at github.com/Robinseibold/Unity-URP-Outlines, include a lot of images as it makes it easier to help!
Fantastic outlines, but I have a little question. Is there anti-Aliasing for these type of outlines? I've been using them but they look really crunchy and wierd for my game. I think that smoothing them out would help. Is there a solution for this? Also Fantastic video.
Thank you! To be honest, I don't know. I've not tried it in VR, nor am I experienced with VR and its constraints. The source code is available at github.com/Robinseibold/Unity-URP-Outlines so if you would like to give it a try I would love to hear the results!
hi thank you such a amazing tut.. have really follow each and every step. i would like some information to what you have populated in 4.15 "class ViewScapeNormalsTextureSettings "
Hey gamer, seeing as you know much more about this stuff than I do, how do you think light aware outlines would work? Like outlines that get brighter in the light and darker in the dark for better highlights. Anyways enough of the questions, but I wanna say this production quality is 10/10.
That's a pretty cool idea! I've never worked with lights in unity at this stage of the render pipeline (~post processing), but I'm currently working on custom lighting for my cel shading, and I don't see why it would be that different, which basically means a lot of calls to the URP RealtimeLighting.hlsl library functions and some maths. Are you thinking about doing it? Thank you!
I attempted it but I believe that the way I'm handling outlines makes it impossible. I saw that your way was pretty different from mine so I figured it could possibly work.
@@flippykat9215 Yeah I definitely think it’s possible, it’s just a question of how complicated it would be and what/if additional data is needed. How did you implement the outlines if you don’t mind me asking?
Hi, first of all, your video is crazy, I loved the content, keep doing quality stuff like this. Secondly, if you don't mind, I could use a little help with the object selection with outline. I feel like the layer mask doesn't do anything because it renders the outlines on every object even if the object doesn't have the specified layer and is in the occluderLayer. I hope you'll answer. edit : I found a solution by my self which seems horrible in comparaison of what @Robin Seibold could have find but don't blame me this my first interaction with custom render features any way I change the checking of the alpha in the outline shader by a verification of the color if its black(0,0,0,1) it act the same as if the alpha was 0 and by doing this the occlusion of the outline work well. Hope it'll help some one but I'm sure this can be done way better.
The shader looks great but for some reason most of the screen is black except a certain layer, my camera set up is one normal base camera that culls everything except a "weapons layer," and another "fps camera" that culls nothing but the weapons layer. And for some reason when I use the overlay camera and it's culling nothing but the weapons layer the whole screen is black except things on the "weapons layer." If you have any idea's to fix this that would be great!
It's hard getting the full picture of your specific problem from a TH-cam comment. I'd recommend checking out the Issues: github.com/Robinseibold/Unity-URP-Outlines/issues and see if you can find if someone is having a similar problem, otherwise create a new issue where you describe the problem in depth with images. Good luck!
Amazing job, learning a lot through your devlogs ! I'm working on an outline demo like yours, and it seems I have the same issue as you have with displacement in shaders not followed by the outline (like grass or plants in wind for example). Do you know a workaround or plan to fix this issue for your game ? I found someone online that said doing another pass of the renderer would be a good idea, but I don't quite understand how.. Keep up the good work !
Great video series, exactly what I was looking for 😁 I'm really new / no experience whatsoever with SRP, I was wondering what was in your ViewSpaceNormalTextureSettings Class? I didn't see a breakdown of that one.
Thank you for the great explanation and information. I looked at it on github, but I didn't understand the meaning of the process of remapping the position(view) node to 1 and -1. Could you please explain this?
Love this devlog! Any update on uploading this code to Github? I followed along this video a bunch of times but have been running into many problems along the way, I'm assuming I'm setting something up incorrectly.
Hey I love the video! You're a really talented editor and developer. Just wondering how you got your edges so crisp, I have tweaked with the settings for a bit and have got them pretty close but you can still tell there's a bit of pixelation especially when compared to yours in the video. Thanks for sharing :)
First of all, this is an incredible devlog. The format of your demonstrations are really neat, you've clearly put a lot of effort into them and I look forward to seeing future devlogs. However, I have a question for you. I'm making a Moebius-style outline shader for a school project. I've managed to follow along just fine until about 9:27 where you introduce the temporary render texture. How exactly do you get that working with the temporary buffer property ID? I've tried adding a non-exposed property of the same name in the outline shader graph, but to no avail.
@@RobinSeibold Oh okay. Pardon my mistake, I assumed the Shader.PropertyToID call was referencing the shader graph because of the underscore prefix. I've only started learning shader development recently so a lot of this stuff is very new to me. Thank you very much for your swift reply.
Bro this is cool, but I get lost constantly in Visual Studio, i don't even know if compressing the stuff is a thing or you are editing it out xD. I wish you just updated it tbh. But still thanks for the video, it does seem polished, but again I would love it made more easy xD.
Thank you sir for your amazing work. It looks beautyful. I followed the tutorial but couldnt make it work for unity 6. I get this warning in the console: "The render pass ScreenSpaceOutlines+ScreenSpaceOutlinePass does not have an implementation of the RecordRenderGraph method." I´ll keep trying! thank you!
Quick question, what does the colors mean when coding? I get that green is adding, but you sometimes highlight something with yellow or red and I don't know what that means
Looks great! I'm having trouble replicating your view space normals texture. No matter what I do, the texture created by the view space normals texture pass ends up being completely white (darkening slightly at the corners of the screen). It's almost like the view space normals shader graph you showed is reading the normal vectors of the view itself, rather than objects in the scene. If you have any ideas on how to resolve that, I would appreciate it!
I really love the production quality and chill vibes of the video. Do you think you'd be willing to share the finished code for the outlines? Also, do your outlines work with an orthographic camera?
@@dominic_sanchez Hi! Yes I've had a long christmas break and working on my next devlog. Will probably clean up the outline post processing effect and get it up on GitHub right after the release of the next devlog, should be late january or early february.
This was a stunning video to watch. Just simply amazing. I was just wondering how you created the custom node file. I've wanted to try and follow along but I can't quite figure out how to make that file.
Thank you! ❤ Here's the documentation for custom nodes in Unity shader graph docs.unity3d.com/Packages/com.unity.shadergraph@5.16/manual/Custom-Function-Node.html and the following article helped me a while back when I first started creating custom nodes blog.unity.com/technology/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019 Hope that helps! The full code is now also available on GitHub github.com/Robinseibold/Unity-URP-Outlines
Thanks for the tutorial and resource! What are the settings on your renderer feature that gets the result at the end there? I followed along and even copied the code exactly from github, and it doesn't look anywhere nearly as good as it does in the video, even after playing with the settings for a while. For example, mine doesn't create those nice lines on the edges inside the object, like shown on the pyramid and plus-shaped thing. Any thoughts?
yea interesting method for sure. made something familier in my coming asset. but as a single subgraph and let the depth control by distance instead probally an idea for u safes u a bit code and u can combine all into an single custom function that way
Hey for some reason the outlines work great on the viewport, but in the Game tab the outlines in the back that are hidden behind the mesh render anyway, any idea why? thanks.
does this allow you to set line thickness? ive been looking for outlines that work on hard edges for years. unfortunately im not a coder and all of this is far beyond my own abilities and understanding so its no wonder most of the stuff on the asset store use the inverted hull method. i can only hope that someday there will be a standard feature in unity that does this.
in unity 2022 there's a new fullscreen shader graph and a new urp buffer node that allows access to normal map easily. do you think it is possible to replicate this effect in the shadergraph now? (i don't think layermask is replicable, but maybe other features would work?)
This is an awesome and really clever effect, but I've been trying to get this to work on WebGL but am hitting a wall. Are the shaders not compatible with WebGL? I keep getting "Error: Shader Error: Hidden/Universal Render Pipeline/Edge Adaptive Spatial Upsampling shader is not supported on this GPU (none of subshaders/fallbacks are suitable)" In the (Google Chrome's) console every time I run my game in the browser and the outlines aren't there, while the other shaders I wrote do work. I can't find an Edge Adaptuve Spacial Upsampling shader in my project files though.
Solution: That error was completely unrelated. WebGL's quality setting is medium by default, which makes the depth texture not work. Set default quality setting to Ultra.
Hello, I'm a novice developer of Unity. It's my first time encountering shader, so I tried hard to imitate it even though I was clumsy. Is it possible to create an outline like a screen only for objects I want based on layers? And I wonder if it can be applied to the 2D spine model. If there is a solution, please reply. I'll be waiting!!
Hi! I don't know if you have seen that the source is available at github.com/Robinseibold/Unity-URP-Outlines As for your first question, this implementation does exactly this. For instance in my game only foreground objects will have outlines, and not the environment. As for the second question I have no idea, but everything (almost) is possible with some tweaking! Good luck!
thanks,but how can i get the effect of the video at 7:30, only use ViewSpaceNormalsTexturePass? i am confused the difference between context.DrawRenderers and cmd.Blit.
Hi! I know you are busy with devving and I do not know whether youtube will notify you of this since you must be gettings loads of comments already, I just wanted to know how you make the live changes with code.. Your interface looks so much cooler and cleaner than the normal unity. Did you record the coding and game screens separately and joined during video editing?
Very clean outlines, really like them. Is there a way to hide them globally and only show them on a specific layer? I thought creating a new layer and set it in "Outlines Layer Mask" would have been enough, even excluded all other layers in "Outlines Occluder Layer Mask", but it still shows surrounding all gameobjects in the scene. Did I miss something?
Yeah, this effect was specifically developed for that use case, so there’s probably something wrong with the setup. Experiment, and if you’re still having problems I recommend creating an issue over at GitHub, make sure to provide screenshots.
@@RobinSeibold sort of, i have layer ground set in the outlines layer mask, and the player set in the occlusions, but the outlines go over the player when the p[layer crosses an outline
Is there a way to not have the skybox be black as well? Like keep it unaffected? I've tried playing around but I'm not finding it? Thanks for sharing this btw.
Hey there, just wondering if theres a git repo for this shader. I tried following along and got lost somewhere and can't figure out why it isn't working properly.
question; playing around with the git file you provided (thank you!) but my outlines are giving me choppy lines instead of the smooth ones you''re getting. are there certain settings to get the lines to be smooth and fluid like the ones you hve in the video?
Sounds like an aliasing problem, have you tried enabling FXAA or SMAA? The current implementation does not support MSAA, see text from repository README: ”Does not work with MSAA, the current work around is to use FXAA or SMAA on the camera instead.”
I followed the video exactly but I think there's a mistake in my code somewhere, my outlines appear in strange places across objects and in the wrong shapes, is there any way you could put your code on github so myself or anyone with a similar problem can find their mistake without having to completely restart? I've been working on this for 3 hours now and am starting to get rather frustrated.
I'm having a little bit of trouble with the custom node source file, I don't know how to create it. Don't know how, don't know which format (if it is HLSL or .cging format). Can someone please help? Edit1: Where did you get OutlineScale from in 10:40?
Hey! I forgot to tell you that i managed to get it working. Everything looks awesome, but there are some parts that does not work correctly if I go far away (For example, a cube inside a wall with all normals facing the same way). I tried adjusting the parameters but if I increase the Roberts Cross Multiplier, this black "shadow" appears and paints like a diagonal in my scene. I do not know if I explained me correctly but that is my problem right now xd
@eibold Thanks ! Would you mind pointing me to where this setting is ? I can't find anything that removes all the interiors lines (and only keeps the outline)...
It's one of the better, if not the best, outlines I've seen. And that fact that you share it amazing. Great work
You clearly put lot of effort in editing the video, really well done and a joy to follow.
Also the outline shader itself is really great 👍🏻 10/10
Thank you and yes, sometimes I wonder if I take the editing too far haha :D
@@RobinSeibold Can you pls tell how to do this effect in hdrp
The outline solution itself is very nicely done and smart but i think it's your video editing that blew my mind the most, it's insanely good.
I can't wait for more
Thank you! Yeah I might be spending a little bit too much time on editing, compared to gamedeving, but I do love it :D
This is majestic, works beautiful in unity. Thanks for allowing everyone to use it.
I'm new to development in unity and I had tried both full screen pass methods and the back face method, but ran into similar problems. Thank you so much for sharing what you've made, it made my aesthetic dream possible as well!
Absolutely brilliant quality outlines !!
Looking forward to your next videos.
Thanks! ❤️ Already working on some improvements to make them even better, but that’s for a future devlog!
Bro thinks hes a coder but HES AN ARTIST !!!
Hahah, one of my favorite comments, thanks! 💖✨
coders are peak artists without knowing
Love the way you edited the video, and the implementation approach. Keep up the good work. Cheers!
Thank you! 💖
your videos are so incredibly high quality and detailed, your work is very appreciated :)
Thank you! 💖
Love the vibe of these, Also they are so informative. Thanks for great content :)
Thank you! ☺️
After researching outlines for cel shading this video blew me away! I understand almost -none- of it, but I'm going to study every second and hopefully try recreating the effect myself.
Thank you! The source code is available on my GitHub.
This was amassing! Thank you so much for sharing this. Your explanations and video editing are on spot! Great work!
This is visually the best outline I've seen in a game to this day, I wish I could fully understand it to experiment
Instantly in love with your style of videos. Clean editing, very informative. Thanks! Subbed!
Thank you for putting out this video, I can tell how much effort was put into making the video!
I didn’t understand anithyng but still liked and enjoyed that video you’re truly a legend
Hahah, thank you!
Looks beautiful! Amazing work.
the way you showed me how to made this shader graph is blow my mind
💖
Damn, I love your animations! So clean and smooth!
Thank you! ❤
These outlines are incredible. Nicely done.
Crazy effort and really good results. Great job.
You, sir, just gained a follower! Thanks for this!
Wow this a really well put together and polished video, great work! It was satisfying just to watch, not even trying to recreate the effect :)
Thank you! :D
Very informative and well edited, thanks so much.
Wonderful devlogs! Please keep up the good work! I really appreciate it 🙂 In order to make the outlines work I needed a few hours: After switching the filter mode in the settings of the active URP renderer from "Point" to "Bilinear" and switching the "Render Pass Event" to at least "After Rendering Opaques" (or later) it worked :-) Thank you!!
Hey there, I'm wondering if you had any advice for getting this to render. I can only get the outline to render IF I use an overlay camera with camera stacking, the overlay camera will render it but no matter what I do. The base camera NEVER renders the feature. Terribly frustrating! Haha.
@@SpeedTutor I only have one camera. Overlay camera? Sounds like a separate camera for the UI. Did you try it having only one camera in total?
@@smallflyDE I've tried one camera with the exact same settings to no avail, haha. Do you have discord, maybe I can send you a really quick video. I'll even pay a little for a moment of your time as I can understand you might be busy. :)
@@SpeedTutor I'm having the same problem
Amazing showcase! Love the in-depth explanations! I managed to obtain an almost identical effect with the new 'Full Screen Pass Renderer Feature' by just applying Roberts Cross to the depth texture... but the major issue we face is the anti-aliasing. The objects are quite close to the camera and the outlines are extremely jagged with no control over any sort of smoothing. I tried your solution, but unfortunately the result is identical.
I saw you mentioned anti-aliasing on your Git-Hub, any idea on how to approach it? I'm no expert, but MSAA does not seem achievable in a screen space effect, and not sure an extra pass for blur would have the same quality result as actual MSAA... either way, if you get around to addressing this, I am sure everyone here would love it!
PS. We also use the zbuffer to mask out the outline that is over the object, to have 'outside-only' outline ;)
Thank you!
Yeah, the aliasing is definitely a problem, and right now I'm relying on the camera SMAA anti-aliasing algorithm instead of MSAA, which works for the outlines.
However, since this isn't really a solution I've been looking into ways of generating the outlines already 'anti-aliased' so to speak. Haven't implemented anything yet, but will share when I do!
Omg, i love your devlog-design
Thank you! 😃
Insane editing.
Thank you for sharing your knowledge.
This outline works great! Thank you for sharing!
Hey, loving the outline. Is this meant to only work with the URP renderer set to Deferred? I have one camera and it will only render the outline if set to deferred. If not, I can use forward ONLY if I use an overlay stacked camera. The base camera never renders the outline, no matter what settings are used. Hopefully I'm not missing something obvious! :)
Hey! Replied to your tweet, but if you haven't seen it check out the issues and corresponding pull requests in the GitHub repo, this feature works with forward rendering.
Nice work! One question though, why is the scene depth used as an input to the step function (goes to the `edge` param) during thresholding at around 11:12? Couldn't this be a constant like (0.5, 0.5, 0.5)?
It could, but we want the threshold value to depend on depth in this case!
I love this code - it works exactly as I need it to.
I hit a snag due to my lack of Unity knowledge though - How do I change the outline colour at runtime in a script?
Any tips?
Thanks in advance.
at 11:16 and 12:08 how are you getting the SceneViewSpaceNormals texture node? i'm guessing this comes from the other shader graph but i don't understand exactly how that node is being brought in to the outline shadergraph
**
ah ok looks like you've answered this below. thanks!
Okay, so I'm on 2021.3.16f1
Copied the repo into my project, did al the things to get it working, no errors or anything.
The screenspaceoutlines seem to work, but for some reason I'm not getting the correct viewspacenormals-lines (I think)
I even made the same 3D-double-cross thing like in the video, but I'm not getting the correct inner lines on the mesh..
Anyone know why that might be?
Edit: goddangit, outlines layermask was set to 'nothing' in stead of everything.
Everythings fixed now.
I'm dumb :')
Very informative video, thank you! The last part confuse me and would you be so kind to show the drawsetting and filtering setting for outline occlusion render? Cheers!
The source code and all default settings (I think) can be found here: github.com/Robinseibold/Unity-URP-Outlines
Hey, great tutorial. The Reanderer Feature works really well, but I cant get it to work in VR. In VR only one eye renderes the outline texture and the camera perspective is wrong. Maybe you know a quick fix for this?
Haven't worked with VR. Try creating an issue over at github.com/Robinseibold/Unity-URP-Outlines and see if someone else has a fix.
this is the best outlines i ever seen :!!
Awesome Video! Is there a way have different colored outlines for different objects?
My implementation doesn't support that out of the box, but could be extended to do so!
@@RobinSeibold Sounds good! I've read some of the other commments and you mention storing the outline color in the texture normal. I've tried a few different ways but could you point me in the right direction?
I've created a script with an outlineColor field. I've added this script to each object I want to have an outline.
'ViewSpaceNormals.shadergraph' : I think this is where I need to pack the outline color into the normal texture.
'Outlines.shadergraph' : I think this is where I need to unpack the outline color from the normal texture. This contains an 'OutlineColor' property conected to a split that will no longer be used. I guess the extracted outline color will need to be connected to the split instead.
do I need to modify ScreenSpaceOutlines.cs?
Thanks so much for your help
Great devlog as always!
🙌🙌
I have heard Jump Flood is one of the best ways to make outlines "fast". How well does your work on the performance? I also love the look. It does exactly what I think an outline should do.
Interesting! Haven’t tried jump flood, but this makes me want to, just to compare! Thanks for the tip!
I haven’t really done any performance tests yet! Currently working on some outline improvements and will do a second video about those, might do some performance analyzing then as well!
Love the video! Love the editing!
One thing I am curious about would that work with transparent objects?
Thank you!
It works on transparent object with minimal setup/changes. It does not work on transparent objects AND through them at the same time though.
It's still suffering from a lot of shimmer aliasing in motion. Perhaps an FXAA (or something else?) pass is warranted? Or better yet, incorporate surface ID based outlines. That was the direction I ended up going in.
Yes, there's no native anti-aliasing in the outline algorithm at this point, all though SMAA is applied after.
Do you have any links or write-ups about "surface ID based outlines"? Sounds Interesting.
sorry, i am a newbie in shaders, i want to make a outline like this
and this is the video show the codes and graphs clearly i saw
i liked how you explain them step by step,
but stopped in a middle in a line & collapse the code,
then jump to code something else is easy to mis-follow to me
but still a most cleary video and best outline effect i saw
Thank you! The code is available @ github.com/Robinseibold/Unity-URP-Outlines
What values should i use for all parameters in the outline shader? And how would i convert this to use RTHandles, since rendertargetidentifier is now obsolete?
beautiful animations
Hey Man, You are killing it with the devlogs. The Quality on these is insane! I had a question about the RobertsCrossMultipler node you used at 11:04? Is that a custom node or a subgraph that you made? I have been doing some research on the Roberts cross operator and I think I understand the basic principle of the formula, but I am not sure how to start the process of implementing it. Thanks again!
Thank you! :)
The RobertsCrossMultiplier node at 11:04 is actually just a property with a value of 100 if I remember correctly.
All the nodes seen in 11:04 together forms the Roberts Cross implementation for scene depth edge detection.
Hello, I'm a real beginner at unity and I came across your video. It's really very complex and I must admit I didn't understand all the explanations haha. But it's exactly what I was looking for, thank you very much!
First of all, it seems to me that the layer mask only works for the Edge detection aspect of your post-process, because despite a chosen layermask, the outline is still drawn on my other objects.
then I'd have liked to be able to set the ScreenSpace Outline render feature several times to be able to set different edge colors for different objects depending on their layer, but as soon as I set it twice, the two render features stop working, as if they were canceling themselves.
If you continue to improve this renderer feature, I think my two questions might be worth looking at
If the outlines are drawn on other objects, it means that something is wrong with the setup, not the implementation, since it works for me and others.
As for the second question, this post processing solution wasn't built to be stacked, hence why it probably breaks. If one wants different colors for separate outlines a much better approach would be to pack data in the normals texture, and utilize that in the outline shader.
@@RobinSeibold Thank you very much for this reply, despite the age of the video. I'm going to try again to put everything back in place.
Also, I'm not skilled enough to be able to realize your proposal but it's very kind of you to explain to me what would have been a good solution for what I want to do.
And finally, after a certain distance, it seems that the effect is reversed. the color of the edge detection we've chosen spreads over the surfaces. it also seems to change according to the size of the screen. I suppose there's plenty of explanation in the video, but as my English isn't very good, I couldn't understand it all. If ever there's a place, forum or other, where we can talk about your shader, I'd love haha to potentially get some help. I'm already going to look at the links you shared in the description.
Edit: i retried but i have the same issue. When I set the ScreenSpaceOutline with "Nothing" in the layermask and occlude layer, it sets the outline but not the edge detection. So I have a bright red outline on all my cubes. When I put a layer called "Visible" in the layer mask and keep "Nothing" in the occluder layer, I get the internal edges added for my cube in the "Visible" layer. But in addition to the artifacts when our "Visible" layer object is behind another object, the outline ( just the contour) is always present on the other cubes.
@@Tyliart I think the best option is to post your error and questions as an issue over at github.com/Robinseibold/Unity-URP-Outlines, include a lot of images as it makes it easier to help!
Fantastic outlines, but I have a little question. Is there anti-Aliasing for these type of outlines? I've been using them but they look really crunchy and wierd for my game. I think that smoothing them out would help. Is there a solution for this? Also Fantastic video.
I'm currently running with SMAA or FXAA on the camera to smooth them out. Might implement a 'native' AA for the outlines in the future.
Wow, great video and outlines! Is this also shader suitable for VR? I'm looking for a Oculus-friendly outline shader for quite some time...
Thank you!
To be honest, I don't know. I've not tried it in VR, nor am I experienced with VR and its constraints.
The source code is available at github.com/Robinseibold/Unity-URP-Outlines so if you would like to give it a try I would love to hear the results!
hi thank you such a amazing tut.. have really follow each and every step. i would like some information to what you have populated in 4.15 "class ViewScapeNormalsTextureSettings "
github.com/Robinseibold/Unity-URP-Outlines
11:19 how are you passing in the SceneViewSpaceNormals texture to shadergraph?
It's set up as a global shader variable.
Wait where do you learn all of these things 😭😭😭
Hahah mostly from the internet and a lot of creating & experimenting!
Hey gamer, seeing as you know much more about this stuff than I do, how do you think light aware outlines would work? Like outlines that get brighter in the light and darker in the dark for better highlights. Anyways enough of the questions, but I wanna say this production quality is 10/10.
That's a pretty cool idea! I've never worked with lights in unity at this stage of the render pipeline (~post processing), but I'm currently working on custom lighting for my cel shading, and I don't see why it would be that different, which basically means a lot of calls to the URP RealtimeLighting.hlsl library functions and some maths. Are you thinking about doing it?
Thank you!
I attempted it but I believe that the way I'm handling outlines makes it impossible. I saw that your way was pretty different from mine so I figured it could possibly work.
@@flippykat9215 Yeah I definitely think it’s possible, it’s just a question of how complicated it would be and what/if additional data is needed.
How did you implement the outlines if you don’t mind me asking?
I followed this tutorial th-cam.com/video/RMt6DcaMxcE/w-d-xo.html
Hi, first of all, your video is crazy, I loved the content, keep doing quality stuff like this. Secondly, if you don't mind, I could use a little help with the object selection with outline. I feel like the layer mask doesn't do anything because it renders the outlines on every object even if the object doesn't have the specified layer and is in the occluderLayer. I hope you'll answer.
edit :
I found a solution by my self which seems horrible in comparaison of what @Robin Seibold could have find but don't blame me this my first interaction with custom render features any way I change the checking of the alpha in the outline shader by a verification of the color if its black(0,0,0,1) it act the same as if the alpha was 0 and by doing this the occlusion of the outline work well. Hope it'll help some one but I'm sure this can be done way better.
If some want the function I use : (don't pay attention to my poor programming skill pls )
float CalculateNeedOfRender_float(float3 ColorBottomLeft, float3 ColorTopLeft, float3 ColorBottomRight, float3 ColorTopRight,out float _out)
{
float3 totalV = ColorBottomLeft + ColorTopLeft + ColorBottomRight + ColorTopRight;
float total = totalV.x + totalV.y + totalV.z;
if (total > 0)
{
_out = 1;
}
else
{
_out = 0;
}
return _out;
}
The shader looks great but for some reason most of the screen is black except a certain layer, my camera set up is one normal base camera that culls everything except a "weapons layer," and another "fps camera" that culls nothing but the weapons layer. And for some reason when I use the overlay camera and it's culling nothing but the weapons layer the whole screen is black except things on the "weapons layer." If you have any idea's to fix this that would be great!
It's hard getting the full picture of your specific problem from a TH-cam comment. I'd recommend checking out the Issues:
github.com/Robinseibold/Unity-URP-Outlines/issues
and see if you can find if someone is having a similar problem, otherwise create a new issue where you describe the problem in depth with images.
Good luck!
Amazing job, learning a lot through your devlogs ! I'm working on an outline demo like yours, and it seems I have the same issue as you have with displacement in shaders not followed by the outline (like grass or plants in wind for example). Do you know a workaround or plan to fix this issue for your game ? I found someone online that said doing another pass of the renderer would be a good idea, but I don't quite understand how..
Keep up the good work !
Thank you, and happy to hear!
Yes, that's still true, and the idea is to figure out a solution for it, when I get there, which will hopefully be soon!
@@RobinSeibold I will follow closely your advance then ! Good luck
@@zakku_ Thank you!
can someone explain how to make outlines thickness scale down when camera moves away?
multiply it by the scene depth
Great video series, exactly what I was looking for 😁 I'm really new / no experience whatsoever with SRP, I was wondering what was in your ViewSpaceNormalTextureSettings Class? I didn't see a breakdown of that one.
Thank you! It's on Github since a couple of minutes ago; github.com/Robinseibold/Unity-URP-Outlines
@@RobinSeibold Ah that's amazing, thank you that will be a massive help!
Thank you for the great explanation and information. I looked at it on github, but I didn't understand the meaning of the process of remapping the position(view) node to 1 and -1. Could you please explain this?
At what point in the video, or at what file/line on GitHub?
Not video, file name "Outlines" shadergraph in Github!
12:15 you can actually use "Fresnel Effect Node" for calculating direction from the camera to surface
No? The Fresnel node takes view direction as input?
Love this devlog! Any update on uploading this code to Github? I followed along this video a bunch of times but have been running into many problems along the way, I'm assuming I'm setting something up incorrectly.
Thank you! :)
I'm currently in the phase of cleaning up the shader for Gihub as well as the Unity Asset Store, it should be out next week!
@@RobinSeibold exciting!
@@RobinSeibold Is this still happening?
@@_.-.Life came in the way, but it's up now github.com/Robinseibold/Unity-URP-Outlines
@@RobinSeiboldI already had a better time following along and understanding the code as a whole compared to pausing the video. Extremely appreciate it
Hey I love the video! You're a really talented editor and developer. Just wondering how you got your edges so crisp, I have tweaked with the settings for a bit and have got them pretty close but you can still tell there's a bit of pixelation especially when compared to yours in the video. Thanks for sharing :)
Thank you! That's an aliasing problem, the outlines does not currently work with MSAA, one could instead use FXAA or SMAA on the camera instead.
First of all, this is an incredible devlog. The format of your demonstrations are really neat, you've clearly put a lot of effort into them and I look forward to seeing future devlogs. However, I have a question for you.
I'm making a Moebius-style outline shader for a school project. I've managed to follow along just fine until about 9:27 where you introduce the temporary render texture. How exactly do you get that working with the temporary buffer property ID? I've tried adding a non-exposed property of the same name in the outline shader graph, but to no avail.
Thank you!
@@RobinSeibold Oh okay. Pardon my mistake, I assumed the Shader.PropertyToID call was referencing the shader graph because of the underscore prefix. I've only started learning shader development recently so a lot of this stuff is very new to me. Thank you very much for your swift reply.
@@syngleton no problem! Feel free to email me if you have any more questions or thoughts! :))
This is so awesome!
Bro this is cool, but I get lost constantly in Visual Studio, i don't even know if compressing the stuff is a thing or you are editing it out xD.
I wish you just updated it tbh.
But still thanks for the video, it does seem polished, but again I would love it made more easy xD.
And now, to rewrite it in URP 17 I'll need to dig into it myself
Hahah, I'll probably do it when Unity 6 is stable!
Thank you sir for your amazing work. It looks beautyful. I followed the tutorial but couldnt make it work for unity 6. I get this warning in the console: "The render pass ScreenSpaceOutlines+ScreenSpaceOutlinePass does not have an implementation of the RecordRenderGraph method." I´ll keep trying! thank you!
@@mans7432 any progress? (When I move to Unity 6 I will most likely post an updated version to GitHub)
@@RobinSeiboldunfortunately no.. i was getting frustrated so i temporarily gave up
Quick question, what does the colors mean when coding? I get that green is adding, but you sometimes highlight something with yellow or red and I don't know what that means
Green is adding as you said, yellow is change, and red is removal.
How do you do the animations of the shadergraph in the video?
They are custom made in Blender. I pretty much recreated the full Unity shader graph visuals in Blender, but simplified!
Looks great!
I'm having trouble replicating your view space normals texture. No matter what I do, the texture created by the view space normals texture pass ends up being completely white (darkening slightly at the corners of the screen). It's almost like the view space normals shader graph you showed is reading the normal vectors of the view itself, rather than objects in the scene. If you have any ideas on how to resolve that, I would appreciate it!
Hi send me an email and we can try to resolve it!
Hello not sure if you still need the help, but I had the same issue, I resolved it by unexposing the view space normals texture in the shader graph.
Varying thickness of outlines based on distance from camera how to add it to the shader graph
It should be pretty straight forward, have you tried?
I really love the production quality and chill vibes of the video. Do you think you'd be willing to share the finished code for the outlines? Also, do your outlines work with an orthographic camera?
Thank you!
Yes, I'll try to get it on Github in the near future! I haven't tried with an orthographic camera, but I can't see why it should not work.
Thanks!
Hey, I while ago I asked about if you were willing to share the code, you said you were but you never gave an update on that.
@@dominic_sanchez Hi! Yes I've had a long christmas break and working on my next devlog. Will probably clean up the outline post processing effect and get it up on GitHub right after the release of the next devlog, should be late january or early february.
Nice! Cant wait for the next devlog. Any hints as to what it's going to be about?
This was a stunning video to watch. Just simply amazing. I was just wondering how you created the custom node file. I've wanted to try and follow along but I can't quite figure out how to make that file.
Thank you! ❤
Here's the documentation for custom nodes in Unity shader graph
docs.unity3d.com/Packages/com.unity.shadergraph@5.16/manual/Custom-Function-Node.html
and the following article helped me a while back when I first started creating custom nodes
blog.unity.com/technology/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019
Hope that helps! The full code is now also available on GitHub
github.com/Robinseibold/Unity-URP-Outlines
@@RobinSeibold Holy shit! Thank you so much.
Thanks for the tutorial and resource! What are the settings on your renderer feature that gets the result at the end there? I followed along and even copied the code exactly from github, and it doesn't look anywhere nearly as good as it does in the video, even after playing with the settings for a while. For example, mine doesn't create those nice lines on the edges inside the object, like shown on the pyramid and plus-shaped thing. Any thoughts?
Send me an email with images of your result, and I'll try to dig up the settings used in my video.
@@RobinSeibold seconded! the edges on my version are very harsh and almost pixely? how are you getting the lines to be so smooth?
yea interesting method for sure. made something familier in my coming asset. but as a single subgraph and let the depth control by distance instead probally an idea for u safes u a bit code and u can combine all into an single custom function that way
Does the outline is assigned to the whole scene? Is it possible to have different colors per object using this method?
It's layer based, and with some extensions to the shaders you could quite easily achieve different colors per objects!
Curious what did you use to create the video, such as the code view and shader graph animations?
Custom made animations in Blender!
Is it possible to enable transparent? It seems only work when the material of models is opaque. Thanks!
You mean having outlines on transparent objects? Haven't tried it yet, but it might/should work with the correct settings.
Hey for some reason the outlines work great on the viewport, but in the Game tab the outlines in the back that are hidden behind the mesh render anyway, any idea why? thanks.
you need to set in "Outlines Occluder Layer Mask" layers which should cover outlines. Then them wont render
@@yunnmy What should I set it to? I played with it for a while trying a bunch of options but it didnt work. it does work in the viewport tho.
@@yunnmy never mind I fixed it, it was my camera's near clip plane
does this allow you to set line thickness? ive been looking for outlines that work on hard edges for years. unfortunately im not a coder and all of this is far beyond my own abilities and understanding so its no wonder most of the stuff on the asset store use the inverted hull method. i can only hope that someday there will be a standard feature in unity that does this.
It does, although at higher thickness values artefacts will start to appear.
in unity 2022 there's a new fullscreen shader graph and a new urp buffer node that allows access to normal map easily. do you think it is possible to replicate this effect in the shadergraph now? (i don't think layermask is replicable, but maybe other features would work?)
I don't know, but it's possible!
Hey I was wondering exactly how did u get the background of the environment such as the colors and the hills
It's just a default but altered skybox and terrain, I quickly explain it in 'The 3Cs - Devlog 1' (th-cam.com/video/LMqio9NsqmM/w-d-xo.html)
@@RobinSeibold thanks
This is an awesome and really clever effect, but I've been trying to get this to work on WebGL but am hitting a wall. Are the shaders not compatible with WebGL? I keep getting
"Error: Shader
Error: Hidden/Universal Render Pipeline/Edge Adaptive Spatial Upsampling shader is not supported on this GPU (none of subshaders/fallbacks are suitable)"
In the (Google Chrome's) console every time I run my game in the browser and the outlines aren't there, while the other shaders I wrote do work. I can't find an Edge Adaptuve Spacial Upsampling shader in my project files though.
Solution: That error was completely unrelated. WebGL's quality setting is medium by default, which makes the depth texture not work. Set default quality setting to Ultra.
Love your vids!
impressive explanation #2
how do you make the live changes with code?
It's just editing magic for this devlog.
Hello, I'm a novice developer of Unity.
It's my first time encountering shader, so I tried hard to imitate it even though I was clumsy.
Is it possible to create an outline like a screen only for objects I want based on layers?
And I wonder if it can be applied to the 2D spine model.
If there is a solution, please reply.
I'll be waiting!!
Hi! I don't know if you have seen that the source is available at github.com/Robinseibold/Unity-URP-Outlines
As for your first question, this implementation does exactly this. For instance in my game only foreground objects will have outlines, and not the environment.
As for the second question I have no idea, but everything (almost) is possible with some tweaking!
Good luck!
Can you display whole the code only ViewSpaceNormals?
github.com/Robinseibold/Unity-URP-Outlines
thanks,but how can i get the effect of the video at 7:30, only use ViewSpaceNormalsTexturePass? i am confused the difference between context.DrawRenderers and cmd.Blit.
how does he use the custom normals texture in the graph?
It's global, so check how to work with global variables and shader graph.
Hi! I know you are busy with devving and I do not know whether youtube will notify you of this since you must be gettings loads of comments already, I just wanted to know how you make the live changes with code.. Your interface looks so much cooler and cleaner than the normal unity. Did you record the coding and game screens separately and joined during video editing?
Its all just a lot of editing to make the video flow better, it doesn't look anything like this originally.
Can you by any means share the shader, I've been looking for something like that for a while, I've looked for tons of tutorials but nothing helped.
github.com/Robinseibold/Unity-URP-Outlines
Very clean outlines, really like them. Is there a way to hide them globally and only show them on a specific layer? I thought creating a new layer and set it in "Outlines Layer Mask" would have been enough, even excluded all other layers in "Outlines Occluder Layer Mask", but it still shows surrounding all gameobjects in the scene. Did I miss something?
Yeah, this effect was specifically developed for that use case, so there’s probably something wrong with the setup. Experiment, and if you’re still having problems I recommend creating an issue over at GitHub, make sure to provide screenshots.
@@RobinSeibold Will do, thanks!
i have this same issue, the outlines show on everything even though i dont have anything set in a layer mask, its all global
@@minima_studios Have you figured out how to only get it on one layer yet?
@@RobinSeibold sort of, i have layer ground set in the outlines layer mask, and the player set in the occlusions, but the outlines go over the player when the p[layer crosses an outline
Is there a way to not have the skybox be black as well? Like keep it unaffected? I've tried playing around but I'm not finding it? Thanks for sharing this btw.
Yes, the skybox can be excluded, as can be seen in my videos. Have you solved it yet?
No problem! :)
@@RobinSeibold I did yes, thank you. Not sure if it's "the correct way", but all I did was set the alpha value to 0 in the background color settings.
@@Ivan-gz6fw did you find whether its the correct way?
Hey there, just wondering if theres a git repo for this shader. I tried following along and got lost somewhere and can't figure out why it isn't working properly.
github.com/Robinseibold/Unity-URP-Outlines
question; playing around with the git file you provided (thank you!) but my outlines are giving me choppy lines instead of the smooth ones you''re getting. are there certain settings to get the lines to be smooth and fluid like the ones you hve in the video?
Sounds like an aliasing problem, have you tried enabling FXAA or SMAA? The current implementation does not support MSAA, see text from repository README:
”Does not work with MSAA, the current work around is to use FXAA or SMAA on the camera instead.”
I had the same problem, try to change the value of the DepthBufferBits in the ViewSpaceNormalsTextureSettings ! 18 does work well for me
Cool and awesome video
Thank you!
I followed the video exactly but I think there's a mistake in my code somewhere, my outlines appear in strange places across objects and in the wrong shapes, is there any way you could put your code on github so myself or anyone with a similar problem can find their mistake without having to completely restart? I've been working on this for 3 hours now and am starting to get rather frustrated.
github.com/Robinseibold/Unity-URP-Outlines
I'm having a little bit of trouble with the custom node source file, I don't know how to create it. Don't know how, don't know which format (if it is HLSL or .cging format). Can someone please help?
Edit1: Where did you get OutlineScale from in 10:40?
The source code is available here: github.com/Robinseibold/Unity-URP-Outlines
@@RobinSeibold Thank you very much!
Hey man, does this outlines work on Unity 2022.3.X? I tried implementing to my project but unfortunately I cannot get it working.
What warnings are you getting? Are you using the latest version: github.com/Robinseibold/Unity-URP-Outlines
Hey! I forgot to tell you that i managed to get it working. Everything looks awesome, but there are some parts that does not work correctly if I go far away (For example, a cube inside a wall with all normals facing the same way). I tried adjusting the parameters but if I increase the Roberts Cross Multiplier, this black "shadow" appears and paints like a diagonal in my scene. I do not know if I explained me correctly but that is my problem right now xd
Is there a way to *only* display the exterior outline ?
Yes
@eibold Thanks ! Would you mind pointing me to where this setting is ? I can't find anything that removes all the interiors lines (and only keeps the outline)...
@@Yggdr4zyl Oh, it doesn't support it out of the box sorry, but with some minor adjustments it should!