Just for anyone doing this in UE5. Currently custom depth does not work with nanite enabled meshes. So if you enable nanite on a mesh and then use this or any outline PPM it wont work. Maybe soon Epic will solve this. Just something to be aware of.
Tips for beginners like me: In UE 5.4 you won't find "Before tonemapping" option in material "Blendable location"... closest option is probably "Scene color before DOF"... In the material, if you got error "[SM6] (Node LinearInterpolate) Arithmetic between types float2 and float3 are undefined", it's because when you try to get "ComponentMask" from "SceneTexture", by default you probably get only "R" and "G"... you have to also check the "B" in the "ComponentMask" (was shown in video 5:40). If you drag and dropped "PostProcessVolume" into scene, and are wondering, why it's not working, easy fix is to go into "PostProcessVolume" details, and check "Infinite Extent (Unbound)".
Hey just tried this myself and it all works until I apply the custom depth. For anyone having this issue with 5.0, I had to go to Project settings and change "Custom Depth-Stencil Pass", under Engine - rendering > Postprocessing Set this to Enabled with Stencil!
Great vid, helped me a lot. Although there is a flaw that I ended up fixing. You are extending the outline both inward toward the mesh and outward away from the mesh (relative to screen space) Then you use a custom depth stencil mask to mask out any object that shouldn't have an outline. However, you didn't dilate the mask outward, so you end up masking out the half of the outline that extends outwards from the mesh. Look closely at 10:06. Notice how the outline where the two spheres intersect is twice the thickness of the line on the right side of the sphere. This flaw is especially noticeable using thicker lines. So to get the thickness of your lines nice and consistent, you need to expand the custom depth stencil mask. A simple way I found to do this was to create 4 custom stencil nodes, offset their UVs by a very small amount in all 4 directions ( I add 0.00006 to the texture coordinate for my lines of thickness 1 ). Then I combine all the stencils using max nodes before putting them into the divide by 255 node. If the mask is extended too far, the outlines can sorta bleed from the intended objects to the unintended objects, which could honestly be a cool stylistic effect with the right attitude. But otherwise, it took me a lot of trial and error to find the right mask offset for my chosen line thickness.
an absolutely goat tutorial. i found a couple of others, but they didnt work well off axis, only worked with cubes, or didnt work well with ISM's. great tutorial
Works great! Thank you so much. Can I make a thicker outline for stenciled objects? I want to use CustomDetph Stencil like highlighter for interactable object.
Hey there, I'm glad it helped! I have a tutorial on a highlight/ pickup system that uses this effect, might be useful 😁 Check it out: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-NOLgy-evbEw.htmlfeature=shared
Mate very easy to follow and clear. Great work. Your really helping me make sense of materials. Only question is - how can we stop these outlines from being visible in through other items. Oh and how can I set it up so that the outline wont cover more of the object as it gets farther from camera?
Hey there, sorry for the late reply! I really appreciate the support, thank you 😄 On your first question, funny enough it shouldn't be visible through objects as standard (maybe it's an ue5 issue) but a sure fire way to stop it is to turn on custom depth on the other objects (it can be any value other than the one used for your outline) 😄 On your second question, this is a little harder. You could try multiplying the outline scale or power with the scene depth (it might need a one minus). However due to it being a depth base effect it might have difficulty 😅 I hope this helps! If you have any questions, Jump on over to our discord and I'll do my best to help!
Really helpful for my final project!! Is there a way to add to different instances with different thickness and amount in the same project? Would be really helpful for my environment🙏🏻
One Important thing is Missing in the Tutorial. My Version was pure gibberish after i applied the bitmask. You may have to set "Custom Depth-Stencil Pass" to "Enabled with Stencil". Otherwise it wont work. (nvmd, gets told at the end, have not watched it through. Still maybe helpfull to clear earlier xD) But nice Tutorial !
@@realityadriftstudio It was pretty nice, not very indepth but faster than other tuts on this topic. It was really weird with Depth only (w/o stencil), because it was like slightly there, but really buggy. One time it looked like i had broken Memory on my Graphics Card^^...
Hey there! By using the custom depth stencil, we assign the value of 3 to a colour which in this case was red. However you can change the colour and value to what suits your project.
This was fantastic, but I noticed if I apply it to something like say, a basic cube - when I'm close to the cube it outlines it fine, but when I move back - eventually ever edge of the cube gets the outline. Go far enough back and it creates a weird wireframe effect. Any ideas what might cause this? On UE5.4
Did you ever resolve this? I am having the same problem, the Post Processing Mask works up close but the farther away I am it glitches out sometimes highlighting entire faces and eventually disappearing.
So I have a problem where I can see anything outlined through the map. For example, I added the outline to a few buildings and you can see the building outline from anywhere now even through walls.
If you have a bool param plugged into the back of the " sample scene depth" nodes and it's ticked on, you will see the outline through objects. If that is the case then, tick it off or delete the bool!
@@realityadriftstudioI actually wanted it to be fully visible behind walls and setting Use Custom Depth to True made it work unlike with default where it's partially visible, thanks!
Figured it out... If your stuck on this skip to 13:25. or Go to Project Setting > Rendering > under postprocessing select "enable with stencil" in the dropdown marked "Custom Depth-Stencil Pass"
This is working for objects near the camera but objects in the distance don't have the outline. Is that just because the outline is so small I can't see it? I've tried ramping up the values but still cant see any outline
Hey there! You may need to decrease the divide in front of the "scene depth node" this is kinda mask for the sky but if it is too low it will cut into the playable area too.
Hey, so how can I add multiple color varaiants on different stencils? We differenciated between "Enemy" and "Player", so 2 and 3. But I want a default (yellow) with value 1, a failed (red) with value 2 and success (green) with value 3. How would I do that?
Hey there! Might be best if I can send some screen shots. If you can jump into our discord, I'll have a look into it😄 Depending on what you need , you can add an additional custom depth stencil (copy what you have and add in with an add node) And then you can pick the value you want for yellow. But if you need it for everything in the scene except for enemies/ player then we will need to create a lerp Infront of the scene texture post process and mask and lerp it with a value from the "outline power" multiplied by the scene depth 😅
I know it’s been a while since you posted, but I’m quite new to unreal and am trying to make an old arcade tron-style game and I really like the look at 4:21 An issue I’m running into is trying to set it so different objects have different color outlines. I tried doing it in a similar way as you described in the video but I’m not sure if it’s possible or if I’m placing the mask in the right place in the material blueprint. Do you know how to resolve this? Thank you!
Thanks so much for the tutorial! How would you set this up to have more than 2 colors, i specifically needed 5 colors for different characters. Thank you for any advice you can offer!
Hey, thanks for the support! Kinda hard to explain via text but... If you duplicate your custom depth stencil lines including the bitmasks (the red and black from the video) Until you have 5 of them. Give each of them a different value in there bit masks and then add them together with a few "add" nodes and then into the multiplier at the bottom row. After that, you will need to connect each bitmask into a lerp node, the A channel will be this specific character colour (3 vector) and the B will be the other characters colours - another lerp with the same process but for the other bitmasks. The furthest right lerp should have the same connection as in the video though. I hope that makes sense! If not, drop me a message on Twitter or Facebook.
Hey there! Do you mean the details of the object? Such as wrinkles. It could be the values put into the outline amount, power and thickness aren't strong enough. If you could Jump on over to our discord and share some screenshots I can have a look😁
@@realityadriftstudio Thanks for your reply! Yeah the details are also outlined. I tried changing the values of power and thickness but it didn't really work. I guess my objects (e.g. shelves) have sharp edges so using the method in your tutorial doesn't work well in this situation. I changed to another method of creating outlines and it works now. Thanks for your help and thanks for the great tutorial!
@@77Delta Could you jump on over to our discord and share some screenshots? I'll have a look into it today. I can also send you my version of the material if we can't get it working 😊 I know there were a few issues with 5.1 but I don't know if this is one of them.
Hey! You could put a "one minus" node Infront of the bit mask node and then when you apply your custom depth stencil to those specific objects they should be masked out from the outline. Sorry for the late reply, currently not infront of my desk. 😅
How can i make it so that the outline does show under meshes? in my scene the outlines appear trough the models, i can make them go away by reducing the ammount divided by the scene depth, but then the onutline only show up on models close to the camera
Hey there, Sorry if I'm misunderstanding, So you can see the outlines through other objects and walls and you don't want that? The custom depth should mask the effect to the objects you specify with the bit mask 😢 I've seen that there are issues with nanite and custom depth? Not sure if that's affecting it.
Hey there! Yeah you can do that...kinda depends on the look you are going for but if it is a specific cube in the scene you need highlighted. You can use custom depths to "lerp" specific values/ parameters for that cubes outline (like the different colours, you can also do the same for the parameters) 😄 Alternatively, if you need the whole scene to be affected then there are two options. You can try and tweak the parameters to get the look you want but I think (depending on the look you are going for) it might be a little too much. You could also try this post process material: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-M98C_OoE40I.htmlfeature=shared There is a little more to it but it will pick out all the little details! I hope this helps ☺️
hi how can i have different BP player with different colors outline ?if i use red then all my npc appear red also i try add another to the post process but it overwrites it any clues?
Hey there! Kinda depends on how you're spawning the NPCs. If you drag out from your character skeletal mesh, add set custom depth stencil, you can set that character individual stencil bit value in the blueprint. If you create a variable for the but value (int) you can have a custom value per character (red, blue, green) etc ☺️ I hope that helps!
Nice tutorial and everything, but the problem with "these" approaches is that, this outline method with post process are only limited to the edges of the character. Now, my question is, is there a way to make the "in lines" of the geometry more visible, I see there is a little bit of it in this method, so I guess it is possible to make it more visible?
Hello, as you said since it is using the post process it has some limitations. You can crank up the detail by increasing the "amount value" and tweaking it with the "power" value. I will be looking into a full solution to this, and will update with my findings/ final solutions. I appreciate your feedback 😁
Hey there! Yeah, you could create lerp with the post process input connected to A and the outline effect connected to B. If you then create a parameter (called outline fade or something) and chuck that into the lerps alpha. To control this in Bps, you will need to create a dynamic material instance and add it to your post process and save the DYM as a variable/ reference in your Blueprint. With this reference you can set scalar and make sure it's set to the same name as your parameters name😄 you should be able to control the float with a timeline if you like. Sorry for the wall of text! I hope that helped. Check out our discord if you want to share some screenshots 😁
@@realityadriftstudio Thanks for the reply, how can I add a DYM to the post process, I have searched how to do it but couldn't find anything. The solution that I went for was using Material Parameter Collection
@@finesseandstyle No worries. The material collection should work fine too! It's just means its a world value so it effects every player. If it needs to be on a specific player's screen, then I'd do something like this : forums.unrealengine.com/t/change-post-process-material/448103/5 The post process effect would be applied to the setting in the player camera instead of the post process volume 😁 though if it's a single player experience, I'd just use the collection!
Is it possible to add more colors for the outline besides just two? I see that you plugged in the bitmask result into the lerp for the color red. Wouldn't doing that only allow 2 choices of color?
@@realityadriftstudio Okay last question. I got the multiple bitmasks going but when one object is in front of the view or another the outline colors blend. IE Block_0 with stencil value 3 for red is in front of Block_1 with a stencil value of 4 for blue. Block_0 outline is now purple on the section that overlaps in the viewport. Is there a way to disable this "Feature"
@@TheUncooked Hey there! From what I understand, this might be a limiting of the depth based effects but I'll have a look into it 😄 You could create an importance order of sorts but it would be static. So if A is higher than B then if A is behind B it will look correct but if B is behind A it might mess up. I'll give it a go and get back to you 😄
Hello, what is the FX that you display (smoke) when i try to add an effect on my scene it's not affected by the post process... but everything else is well affected by the outline. Is there something specific to activate for FX to be impacted by the Outline as well like in your video?
Hey there, the first thing that comes to mind is that your fx has translucent materials applied to them? In my scene the FX (explosion) is made up of static mashes that have opaque materials applied.
@@realityadriftstudio Yes it was that. I have change the material and it's works now. It doesn't looks like a smoke anymore... but at least the Outline work on it and I know why now. Thanks for your replay and your amazing video. Your game looks graphically so cool and beautiful. :)
@@Bak.RI'm glad you worked it out! One thing you could also try is ticking on "output velocity" in your material,kinda odd but it puts the object into the depth pass so it should apply the outline to it while keeping your translucency. You might also have to turn it on in the project settings too. Hope that helps! Thanks for the support! I really appreciate it.😁
@@realityadriftstudio Yes it works!! But the final render is horrible! I guess I will have to search for effect using opaque material. All your effect are opaque?? To be able to apply the outline on it?
Hey there! After spawning you particles effect via blueprints. Drag out of the spawn mode and add a set custom depth (tick on) and also set customs with stencil (set the value to the same number used within your postprocess material) 😊
thanks for help and positive reaction. i've actually found a solution close to that, so hope this answer will be helpful to others who trying to use it with particles@@realityadriftstudio
Is there a way to have a gradient for the outliner? I have a ""selectable" castle and I want to have an outliner gradialy less visible at the ground level.
Hey there! Might be difficult since it's in the post process/ using the depth pass. You could maybe use the distance fields as a gradient , plus that into a lerp which could give you your fall off 😊 (you might need to divide or multiply the distance field output by a large number) I hope that helps! Edit - Just tried it there, seems to work out ok! If you jump on over to our discord post some screenshots in the chat 😁
@@realityadriftstudio Thanks for the advice! But will it work with multiple meshes? I mean it's a castle with buildings inside that a separate meshes and I need distance field only from the ground.. Is it still possible? Can select/mask wich distance field to use?
@@АнатолийКнязьков-р6яkinda depends.... You will need to turn off distance fields on your meshes except for the ground. If that's ok then yeah should be cool!
thank you !!!!!!!!! on unreal engine 5, depending on the area the character is, is it possible to change the shader of the environment and the shading of the character too ?
Hey there! Yeah, kinda depends on what you are wanting but there are a few options. You could have multiple post process volumes (when the play enters one of them the shading will change) Or You could also mask these effects with custom depth stencils.😊
@@NotMGames hmm that is a little odd, is it ue5 or 4? If you could jump on over to our discord and share some screenshots that would be amazing! I'll have a look 😄
@@realityadriftstudio I just wanted to try it out and see if it suits my game. I'll leave it alone for now and concentrate on something else. Thanks for your help!
I was using a different method originally, tried this and it didn't quite work out for some off reason. Only half the screen has lines and they're all jittery and intense despite me copying exactly. Anyway I did learn how to control my old method better to reduce the amount of wireframes being drawn. Thank you! :)
Hi! Great tutorial, thank you! I have a question - if in your example the ball was Blueprint instead of StaticMesh - how could it be placed in the Custom Depth Buffer? I want to make it this way in my game - I have an items that I can pick up, like keys, flashlight, batteries. All these objects are a Blueprint for me and I want to have an outline around just those items in the game that I can pick up, that I can interact with. Like in Bendy and The Ink Machine. Thank you! Best regards, Valters.
I can do a tutorial on this subject if you like? But the basics are as follows: In your blueprint you need to drag out from your static mesh and set the custom depth value to be on and the stencil value to be the number you have set in your material. If you want it to be deactivated you would do the reverse. You would call this when you are looking at the items or you pick them up etc.😄
@@realityadriftstudio Tutorial would be great! I have a progress so far, that when I look at the item (Line Trace By Channel) it shows Name of the item, e.g. "Yellow key", or "Torch light" and when I click at it, then I pick it up, but yes - at the end I am looking for the functionality when I look at the item I can interact with, then first it shows glowing outline and then I can pick it up. Well and read your comment that PPM does not work with Nanite, this I solve. Now my items (Blueprints) are glowing, but they all are glowing all the time. I would like them to glow, when I approach them at certain distance. So, yes, tutorial would help me a lot! Thank you! BR, Valters
@@wotesi you can directly access the buffer of a static mesh component using the "set custom depth value" node. the target will be a primitive component, so you have to give it the specific mesh component you want, rather than an actor. when you look at the mesh, cast it to the type you expect it to be (static mesh most likely) and give that object ref to the node.
is there any way to put only on a specific object without the others being affected by the outline? because I followed everything and it worked, but it "passes" to other objects that I don't want to have. (thanks btw XD)
Hey there! You should be able to mask it with a custom depth set up - Lerp A= Scene texture post process 0 (rgb component mask) B= your outline material as is Alpha= the regular custom depth set up from the video (your choice of bit value) I hope that helps! Sorry if I've misunderstood 😅
Translucent materials are excluded from the depth pass, which is required for this process. It's going to sound weird but if you turn on "output velocity" inside your glass material, it usually includes it in the depth pass which might fix this for you. This might also need to be turned on in your render setting too. Hope that helps 😄
Hey there! You will need to create 4 custom depth set ups (with the bit mask and separate values) and then create a chain of lerps and 3 vectors/ colours! Might be best to show you via screenshots though. If you could jump on over to our Twitter or Facebook and drop me a message I'll help you out 😊
@@realityadriftstudio hi! Thanks for the reply! I found another solution but i encountered a new problem. When an object without the outline is in front of an object with the outline, it still looks like the object without outline has an outline. Any idea how to fix that?
@@tvtomas6645 No worries, I'm glad you worked it out 😁 and sorry for the late reply! I think it might be a limitation of this technique but I'll be looking into it!
Hey there! I'm not too sure, could you provide screen shots? Might be something missed in the material, is your custom depth turned on in the project settings? 😁
Hey there! Wireframe wise - this technique uses a mix of the wireframe and depth pass so it will outline the wireframe however you should be able to tweak and remove it via the power and intensity/ multiply😁 I'm not sure what you mean by following colour? Sorry 😅
@@realityadriftstudio thank you for replying!! The outline isn’t black, however o have the outline color set as black. Instead it’s the color of the object it’s outlining. I’m also having trouble where it’s making some objects completely black
@@HauntedTS13 is your custom depth stencil turned on? Should be in your preferences/ custom depth and then set it to custom depth with stencil 😁 These are really odd results, it's not something that should be happening. It could also (as a guess) be a bug with UE5. There have been a lot of issues throughout the engine unfortunately!
@@realityadriftstudio so the cel shader I was using didn’t like speculating/opacity mask which is why things were turning black. I also had the outline below the cel shader, but once I switched them the outline was black.
Hello! To apply the effect on specific actors you need to Activate custom depth stencil in your unreal engine preferences. Select the actors you want the post process to effect, go down to custom depth in the "details panel" stick that on and stick in the value number you have used within your material. If you go to 7:50 in the tutorial, I go into how custom depth stencil masks work😄
@@realityadriftstudio Thanks for the response. I tried that part too, but it didn't work. I'll look into it more because there must be some part I'm making a mistake in. Thanks.
@@o_ci9192 sorry for the hassle, I've seen a few things with custom depth not working like it should on UE5 specifically. Is your custom depth set up in the preferences?
@@realityadriftstudio I followed your cell shading tut and when I enable the outline mat inst in the postfxvolume, the cell shader just completely looked disabled and doesn’t work at all
@@Enderking394 Can you send me screenshots? I'll have a look 😁 The only things that come to mind are that the custom depth stencil in the settings are enabled and maybe a bug with ue5( if you are on ue5).
@@realityadriftstudio I was able to fix the issue, I had just simply set the one setting to before translucency instead of before tone mapping. Thanks for the tut.
Hello, I can see what you mean. This process just makes a rough approximation of the shapes and outlines them. I'm going to look into a solution to this and update it with my findings! Thanks for your feedback 😁
@@realityadriftstudio Thanks for this tutorial! I have a problem that sounds very close to this. I want to define objects that are very close to each other. Imagine a stone wall with blocks of individual meshes for example. I want to see the lines of the individual stones represented. Is there any way to do this using this method?
@@m00nunit29Hey there! You may be able to get something close to what you need by tweaking the multiple/ power on this effect. But I'm also working on a new technique/ outline method that should fix this issue 😁
@@realityadriftstudio I look forward to that, thank you very much! I did try the settings as you mentioned, it just didn't give me the effect I was looking for. It sounds like what you are working on will help, thanks again!
@@m00nunit29 no problem! Sorry for it not working for your situation. Due to it using the depth pass it has some limitations. In case you are interested, we also have a discord where you can share your projects and ask for help from myself and others 😁 discord.gg/GZm6NcXxHr
Hello! I appreciate the tutorial! I was actually hoping for the ability to have it render a full outline even when the object is obscured by something, would that be possible? I'm mostly just wanting it since I have a little fixed camera arcade game, and I'd like for the player to have an idea as to where they are even if they go behind a wall. Thank you!
Hey there! Yeah, if you create a Boolean and connect it up to the sample scene depth nodes ( the custom depth pins) and tick it on. That should hopefully allow for the outline to stick around behind objects 😄 let me know if you need any help! Thanks for the support, I appreciate it 😁
@@realityadriftstudio oh, lovely, I'll give that a try as soon as I can! Thank you so much for the quick reply! Absolutely, jt was a great little tutorial. I'd love to know more about how it works, but for just getting something working, it's a great quick guide and the music isn't too loud as often happens. I'll let you know if that works!
Hi, great tuto thanks! I just have a problem: I applied the outline material in a level (and it works fine), but when I created a new level and wanted to put the post process volume and the outline material, nothing happened... do you have an idea?