UE4 Tutorial 101 - Occlusion Outlines

Поделиться
HTML-код
  • Опубликовано: 1 авг 2024
  • ► Outlines Tutorial: read here for the topics timings
    In this tutorial you'll learn how to create an outline post process in Unreal Engine 4 to show objects behind walls.
    Topics:
    0:00 - Intro: what we're gonna do
    1:04 - Project and objects requirements
    2:44 - Post process material
    4:47 - Seeing the material effect on the scene
    6:17 - The CustomDepth texture
    8:15 - Outlines detection theory
    11:12 - Sampling the required pixels
    20:05 - Separating background from object pixels with an inline
    22:21 - Highlighting the outlines on the objects
    24:29 - Mixing the outlines and the original scene
    26:26 - Isolating only occluded outlines
    29:50 - Making line thickness configurable
    31:27 - Giving a different color to each stencil value
    37:36 - Commenting nodes
    37:57 - Using a StaticSwitch to toggle outlines occlusion
    40:11 - Thanks! Please, like and share :D
    rvillani.com
  • ХоббиХобби

Комментарии • 313

  • @Bas3008
    @Bas3008 5 лет назад +8

    This tutorial is really awesome! The best thing is that you don't just add all the notes and show the result, but you explain the thought process behind it. That's incredibly helpful.

    • @RVillani
      @RVillani  5 лет назад +4

      Thank you! I always wanna know the "why", not just the "how". So that's how I try to explain stuff. Because if you know the "why", you might use it to solve something else.

  • @rexxthunder
    @rexxthunder 4 года назад +3

    I like how you actually explain what each of the parts are doing as you make them. Great job!

    • @RVillani
      @RVillani  4 года назад

      Thanks, Rexx! I really appreciate that, as it's the thing I try to focus the most. ^^

  • @micmacha
    @micmacha 7 лет назад +1

    I'm relatively new to the UE4 community, and have been looking everywhere for a reasonable tutorial just on post processing and making occluded objects visible in some way. You sir hit the nail on the head. I've subscribed to keep track of you--thank you very much!

    • @RVillani
      @RVillani  7 лет назад

      Thanks!
      Just a heads up, I don't post only tutorials, I also do some art stuff using Unreal and post the videos. But I'll soon be back on making tutorials. Gotta make time in between jobs.

  • @IinesySankka
    @IinesySankka 7 лет назад +6

    As a newbie in the VFX community, I'm extremely grateful for you doing these. Just wanted to let you know that. You're a huge help. Thank you so much

    • @RVillani
      @RVillani  7 лет назад

      I'm very happy to help ^_^

  • @zackcanoe
    @zackcanoe 6 лет назад +2

    非常感谢,你的教程帮我了一个大忙!thank you very much, your tutorial helped me solve a big problem!

  • @chlbrn
    @chlbrn 6 лет назад +3

    Thank you for explaining the concepts and reasons behind this technique. I have watched some videos about custom depth pass and your video is this only one that I fully understand and I achieve the result I have been looking for a long time. Thank you.

    • @RVillani
      @RVillani  6 лет назад

      And now that you know the concept, you can even do new stuff with the acquired knowledge :D

  • @Zarrey
    @Zarrey 5 лет назад

    this was the only outline tutorial that i got to work. it even worked the first time. thanks a lot!

    • @RVillani
      @RVillani  5 лет назад +1

      That's great, man! Happy to help

  • @Beriol9
    @Beriol9 7 лет назад +3

    Thanks a lot for the explanation! I've looked everywhere for an explanation for outlines, but everybody just shoves the material in your face without any comments. You explained it perfectly :)

    • @RVillani
      @RVillani  7 лет назад

      Thanks! I'm also not very fond of "do this and that" tutorials. I wanna know WHY to do this and that. Why press this button instead of the other one?

    • @Beriol9
      @Beriol9 7 лет назад +1

      Exactly :) by understanding how it works I managed to modify it to suit my needs, for example making it work with multiple outlines on top of each other (as you mentioned at the end of the video). By the way, I'm looking forward for your next tutorials! :D

    • @RVillani
      @RVillani  7 лет назад

      Thanks! I'll tru to get back to them, but right know I need to be able to pay the bills, so I'm drowning myself in freelancing. But I still have a big list of tutorials to make.

  • @mFurb988
    @mFurb988 3 года назад

    Very clear explanations. One learns about the different components and why their combinations provide the different effects. Thank you.

    • @RVillani
      @RVillani  3 года назад +1

      Thanks, Sven!
      I believe knowing the "why" besides the "how" helps us create other things from the same concepts.

  • @AlexM-xr4rc
    @AlexM-xr4rc 7 лет назад +1

    Hey thanks for the help! The material I followed in the video didn't exactly work for my situation (because I'm working on a 2D game) but I'm able to replicate this method to an existing highlight material I have that works. Really great tutorial! Very thorough.

  • @kanoeyes
    @kanoeyes 5 лет назад

    The best tutorial about outlines! Thank you!!!

  • @Randenie
    @Randenie 2 года назад +1

    Thank you so much for this tutorial. It has everything I needed for the project I'm working on. Thank you, thank you, thank you!

  • @NJoint
    @NJoint 3 месяца назад

    Man, this is the best tutorial I've watched in a long while.
    It wasn't just some mindless button-pushing. You made me understand what I was doing.
    Thanks a lot

    • @RVillani
      @RVillani  3 месяца назад

      Thank you for letting me know! 🫶
      I really strive to teach the why, not just the how. That way you can get this new knowledge and apply it to a different problem.

    • @NJoint
      @NJoint 3 месяца назад

      @@RVillani you nailed it with this one. I shared it to a couple of colleagues. I really hope you can afford to do this more often

    • @RVillani
      @RVillani  3 месяца назад

      @@NJoint Thank you for the kind words! I hope so too. I was very frustrated with my latest videos. The audio was bad (don't know how I didn't notice that while editing) and I feel like I'm not explaining things in a clear manner. Because of that I've been holding off on making more content until I figure out why I became so terrible at explaining this stuff.

  • @mbwilding
    @mbwilding 3 года назад

    You're insane man, thanks for explaining everything step by step rather than just doing it.

    • @RVillani
      @RVillani  3 года назад

      Thank you, Matthew!
      Yeah, man. Sometimes I appreciate quick videos that just show me how to do what I want ASAP, but on mine I like to show the why's too, so you can use the knowledge to create something else.

  • @michael6422
    @michael6422 4 года назад

    Man you're awesome , savior to us all .

  • @Jorge-vv8cy
    @Jorge-vv8cy 5 лет назад

    Awesome tutorial bro. this way i can comprehend why this works.

  • @erbmur
    @erbmur 7 лет назад +1

    Dude, you, you are something special. I have been looking for something like this for a very long time now!
    Modified it slightly to only highlight on things when you are close to them, but wouldn't have been able to do it without you.

    • @RVillani
      @RVillani  7 лет назад

      Great! Glad I could help! :D
      It's greatly appreciated if you share it wherever you can! ^_^

    • @coreythomas2778
      @coreythomas2778 7 лет назад

      If you could explain how you did that it would seriously help me out.

    • @RVillani
      @RVillani  7 лет назад +2

      You can measure the distance between the object and the camera using the custom depth output. Then, take that value, subract your minimum required distance from it, ceil, clamp to 0~1 then use 1-x (OneMinus) on the result. Multiply that by the outlines alpha. So, if the distance is less than the required (ie., you're close to the object), the result will be 1 and it will show the outlines. If it's any greater (you're far), the result will be 0 and the outline will be removed.

    • @erbmur
      @erbmur 7 лет назад +1

      I just used an overlap volume, and have overlap enable/disable custom render

    • @RVillani
      @RVillani  7 лет назад

      Hahahaha that'll work too XD But for several objects at different locations, you'd need more overlaps.

  • @GrayveRoseMusic
    @GrayveRoseMusic 7 лет назад +1

    Good work, very well spoken, even if in a language that isn't your first, because that didnt stop me from understanding. Really wanted a stylistic approach to letting Players with certain roles see all other Characters through walls with an outline, and have each Character a different unique color that matches them. This was perfect for that, thank you gent + scholar.

    • @RVillani
      @RVillani  7 лет назад

      Thanks a lot!! I'm happy to help the Unreal community! :D

  • @ColdfireAC
    @ColdfireAC 7 лет назад +3

    Thank you for this excellent tutorial! So well explained. Please do more tut's like this

    • @RVillani
      @RVillani  7 лет назад

      Glad to help! :D
      I will start making them again. Just gotta complete some stuff before (work and a Broly model in Unreal)

  • @hugogomezcervantes7102
    @hugogomezcervantes7102 7 лет назад +1

    Man You make PP and outlines so easy to understand! thank you very much.
    Subscribed :D hope to see more tutorials!

    • @RVillani
      @RVillani  7 лет назад

      Hugo Gómez Cervantes Thanks a lot! I'm currently working a lot and there's not much free time, but I'll get back to them some day. I do miss doing it.

  • @Sabselol
    @Sabselol 7 лет назад +1

    You Mister Villani, are my personal hero of the day!

    • @RVillani
      @RVillani  7 лет назад

      Sabselol Wow! Thanks a bunch! =D

  • @ZioYuri78
    @ZioYuri78 7 лет назад +1

    Great tutorial, thanks for the theory part, it's really well explained and i learned a lot about shader!

    • @RVillani
      @RVillani  7 лет назад +1

      Thanks for the feedback, Zio! :D I'm glad it helps!

  • @FLTxxdxx
    @FLTxxdxx 4 года назад

    Great Work, thank you for the time put into making this

  • @rickfuzzy
    @rickfuzzy 9 месяцев назад

    This was great. Thank you. Learned a lot

  • @breikdans1646
    @breikdans1646 4 года назад

    Awesome Video!! I learnt a lot!! Muchas gracias por tu explicacion Rodrigo!!

    • @RVillani
      @RVillani  4 года назад +1

      Gracias, Alberto!

  • @bot-bot
    @bot-bot 7 лет назад +2

    Thank you Rodrigo! This helped me very much. Another great tutorial with all the explanations. Not sure which version of Unreal you are using, but in 4.13.2 there is a small difference on how the material is being assigned to the PostProcessVolume. It is under Details -> Post Process Volume -> Blendables in case someone is on the 4.13. The rest is the same. Keep up the good work mate :)

    • @RVillani
      @RVillani  7 лет назад +1

      Thanks a lot, Bojan!
      I'm using 4.15

  • @Stefan-xt5sk
    @Stefan-xt5sk 7 лет назад +5

    This seems very useful, so I've subscribed to remember you when I might need this. :)
    Also I've coincidentally found comments of a fellow student on this video who has watched this just one day ago. (Arlen der Dichter) :D

    • @RVillani
      @RVillani  7 лет назад +1

      Cr4zy Dude cool!
      It's a small world indeed! :D

  • @cesarmarchetti2143
    @cesarmarchetti2143 5 лет назад

    This is how you do a tutorial. Many Thanks!

  • @mailerdaemon85
    @mailerdaemon85 7 лет назад +44

    Hey, thanks for the nice tutorial! I noticed that the outlines flicker a little bit. Just in case someone else wants to get rid of that flicker:
    In the material settings go to Post Process Material and set Blendable Location to Before Translucency.

  •  Год назад

    Thanks man. It couldn't be more descriptive.

  • @Jay66Bird
    @Jay66Bird 6 лет назад +1

    Nice job man!

  • @DEFICITGames
    @DEFICITGames 5 лет назад

    Awesome Tutorial! Thanks!

  • @szerothH
    @szerothH 4 года назад

    Thanks bro, this helps me a lot!!

  • @DD-zw6qf
    @DD-zw6qf 9 месяцев назад

    I had an issue with something I made and couldn't find any information so I decided to watch this video as a break and to learn something new
    After 30 minutes I saw you did something which was exactly what I was looking for, thank you!

    • @RVillani
      @RVillani  9 месяцев назад

      Thanks for letting me know!
      What was it that you needed?

    • @del1an
      @del1an 9 месяцев назад

      @@RVillani Rendering the side of an actors with custom stencil that is not behind walls or any mesh (28:07)

  • @Pitoshko
    @Pitoshko 2 года назад

    Finally I found that efficient one! Great!

  • @adamc3607
    @adamc3607 Год назад

    Great tutorial!

  • @iandejong2570
    @iandejong2570 3 года назад

    really clear explanations - thank you!

    • @RVillani
      @RVillani  3 года назад

      I'm glad you think so! I've been teaching programming to my cousin and I always feel like I mumble too much. haha
      But that might be due to me not planning our classes ahead. 🤔

  • @George-pk5jw
    @George-pk5jw 5 лет назад

    Nice thanks for tutorial, you are awesome!

  • @sleepwalker6043
    @sleepwalker6043 7 лет назад +1

    Thank you for making my life easier.

  • @limks96
    @limks96 4 года назад

    Thank you for sharing ur knowlegde !

  • @alecek
    @alecek 5 лет назад

    You save the day !!

  • @folksgames7047
    @folksgames7047 7 лет назад +1

    Thank you bro!! Great video

  • @davidewing2825
    @davidewing2825 6 лет назад +2

    I love this tutorial, it is amazing!
    I'm trying to figure out how to make this effect a character ability, so I can turn it on and off in game.

    • @RVillani
      @RVillani  4 года назад +1

      You could have a Lerp in the material in which 1 uses the effect and 0 doesn't. The Lerp alpha would be controlled by a Material Parameter Collection parameter. Than you could set that parameter's value from Blueprints.

  • @myangel582
    @myangel582 4 года назад

    Thanks man ❤

  • @MortMort
    @MortMort 6 месяцев назад

    When i change the UV cordinends of the Custom Depth and add them togeter It dosn't mask it out, but if I dont offset the Scene texture custom depth texture it dose mask it out, why dose it not work as soon as I offset the UV's and add them togeter?

    • @RVillani
      @RVillani  6 месяцев назад

      Maybe the offset values are miscalculated somehow? Could be many things. I advice you preview each node in your sequence of nodes to see if they display expected results. If you need to see specific numbers, you can use the debug nodes and preview them (Debug Scalar, Debug Float2 and so on).
      That way you debug where things are going wrong in the logic and find what needs fixing.

  • @alangonzalezleon6556
    @alangonzalezleon6556 6 лет назад

    I have a problem instead of coloring the edges the whole mesh has the color but when I move the camera the edge are the one with the color any idea D:

  • @saintkiler1187
    @saintkiler1187 3 года назад

    Great tutorial. Thank you very much.

    • @RVillani
      @RVillani  3 года назад

      Thank you!! Glad to help!

  • @Shrublandsprite
    @Shrublandsprite 7 лет назад +1

    This is so awesome! You saved me from pulling my hair out over this! :D

    • @RVillani
      @RVillani  7 лет назад

      Arlen der Dichter I'm very happy to help! ^_^

    • @Shrublandsprite
      @Shrublandsprite 7 лет назад

      I really appreciate it!
      I have another question though. Everything works fine now, but I would also like to add a colored silhouette to the outlines, as to basically fill them with a different color tone. In the video you are at one point seperating the inner shape from the outline, so I tried to use that to create my desired effect, but I couldn't figure out how to do it. Maybe you could give me a hint on how to do it? :)

    • @RVillani
      @RVillani  7 лет назад

      Arlen der Dichter you mean to tint the object itself?
      There's a part where you detect what's inside and what's outside the object, so you'd use the inside as an alpha to lerp the final color with the tint you want.
      I can't really see it in detail right now (traveling), but if it's not clear, tell me and I'll try to explain better when possible.

    • @Shrublandsprite
      @Shrublandsprite 7 лет назад

      The Lerp already helps, but somehow I cant manage to get the desired effect. I have been able to get outlines and fill my character, but then the rest of the world had a tint as wenn. Also I could no longer use the two color system you set up in the video. A more detailed explanation would be greatly appreciated, but don't stress yourself. if you dont have the time :)

    • @RVillani
      @RVillani  7 лет назад

      Well, approx. by 23:00 I showed how to get only the objects as white. So you can multiply this result by your Lerp tint alpha in order to tint only the objects.

  • @cmds.learning7426
    @cmds.learning7426 3 года назад

    very good tutorial!thanks friend!

    • @RVillani
      @RVillani  3 года назад

      thanks for the kind words :)

  • @rodrigodias4251
    @rodrigodias4251 3 года назад

    Esse tutorial me ajudou muito! Obrigado!

  • @zimavi
    @zimavi Год назад +1

    How to fill inner part of object with same colour with transparency?

  • @jussimaravillani3522
    @jussimaravillani3522 7 лет назад

    Vou tentar, gostei muito, obrigado

    • @RVillani
      @RVillani  7 лет назад

      Que bom! Fico feliz em ajudar! :D

  • @abeymiranda5457
    @abeymiranda5457 7 лет назад +1

    Hey thanks for the in-depth explanation! I have a question, how do i add a 50% color fill inside the outline?

    • @RVillani
      @RVillani  7 лет назад

      You mean like highlighting the object?
      Well, it's been a while that I did this, but if I'm not mistaken there's a part that output's 1 or 0 if inside of the object. You can use that (multiplied by 0.5) as the alpha for a Lerp between the original SceneColor and your highlight color.

  • @LauriKalliola
    @LauriKalliola 3 месяца назад

    Thank you for the awesome tutorial and in-depth teaching!
    I have a question on using a similar material:
    In the editor viewport view the occlusion outlines are drawn as intended, which is only when an object is behind something, for example a wall.
    But in the play mode and camera view the outlines are drawn on meshes even when there is nothing between the camera and for example the player mesh.
    Any ideas on how to fix this or what settings to look at?
    Thank you!

    • @LauriKalliola
      @LauriKalliola 3 месяца назад

      Hmm, the problem was fixed when I swapped from using the normal "Camera" component to using "CineCamera" component. The normal camera probably has some rendering/post process settings which caused my issues.

  • @LJ_Dev
    @LJ_Dev 2 года назад

    Great tut. Thank you very much! .
    Is there a way to hide the outlines for certain objects?
    Like for example, my character goes into shallow water and his legs are hightlighted by the outlines. How can I ignore that water on this shader? Thanks!

    • @RVillani
      @RVillani  2 года назад

      I'm not sure about that because water is a translucent shader, usually. I think you'd have to enable depth writes for it on the water material settings and then have the water mesh render to the same custom stencil channel as the character.
      Or a different channel that you account for in the post process and use it to hide the outlines.

  • @TheKikeval
    @TheKikeval 3 года назад

    You are just a god

    • @RVillani
      @RVillani  3 года назад

      Smith will suffice.
      I hope you got that reference haha
      Nah, I'm just a long time UE4 user trying to give something back to this community that helped me get where I am ^^

  • @gomidasodabasioglu
    @gomidasodabasioglu 6 лет назад

    perfect.

  • @hiro4476
    @hiro4476 Год назад

    Easy to understand tut!
    @29:14, the lilo outline.
    Is there a way to exclude terrain/ground from the calculation?

    • @RVillani
      @RVillani  Год назад +1

      Thanks!
      Good question. The floor has to render into the depth buffer, otherwise it'd be a translucent material, wasting performance by rendering everything behind it. So it should be there in the Scene Depth.
      That said, you might be able to mask out lines on top of it by rendering the floor mesh(es) with a custom depth stencil. Then you could test in the post process material if the scene pixel also has that stencil value, and if so, don't display an outline there.

  • @SilverEye91
    @SilverEye91 2 года назад

    Hi!
    Is there a way to modify this calculation to render not just the outline but the entire object? I'm trying to find a way to render the silhouettes of different objects as different colors but I'm having some trouble getting it to work. This is a great tutorial but I need some extra help to get that final step to the result I want :D

    • @irenenaya7644
      @irenenaya7644 2 года назад

      If you only want to render the entire object in a different colour, you don't really need any calculations. You just use the subtraction between custom depth and scene depth, use OneMinus to invert it, and use that result as the alpha of a Lerp between the SceneTexture (the PostProcessing0 one) and any colour you choose. You can look at this tutorial from the UE people here: ruclips.net/video/JH07z9Ap1hk/видео.html
      If you actually need both the outline and the entire object (like at different times you want one or the other), i would try playing with the line thickness parameter. Since the outline always grows inwards, there's got to be a value at which the whole object is 'painted' 🙂

  • @nick9137
    @nick9137 6 месяцев назад

    If anybody wants to be able to selectively occlude (for example lets say you have a pickup coin and your character, you don't want the outline on your character when behind the coin) you can do the following: do everything in the video except ALSO add an IF node, and we will use a stencil value of 2 as an object we don't want to occlude, (our coin will be 2, our character will be 1), you can do an if and if the stencil value is = 2 then instead of rendering out whats in the video you want to render out just the post processing input with mask of RGB, hope this helps

    • @RVillani
      @RVillani  6 месяцев назад

      If you were asking how to do that, that's pretty much what I'd have suggested. A stencil value for "ignore this". I don't think there's another way if you can't tell those objects apart.
      Thanks for that comment!

  • @twinsplayknight
    @twinsplayknight 2 года назад +2

    hey, This tutorial was very helpful to me, but im noticing that the lines are drawing within the object rather than outside of the object. Its important for me that the lines go around the outside of the object instead of within it, do you know how i could do this?

    • @MrJayden1116
      @MrJayden1116 2 года назад

      did you find a solution to this?

  • @DevinDTV
    @DevinDTV 7 лет назад +3

    Ok I spent some hours being frustrated trying to get outlines to not x-ray, but finally got it working thanks to your video. Then I learned a way to make outlines even appear above other objects that also have outlines. I think a lot of people want to know how to do this. It's very easy to implement. You can even have objects have outlines above other parts of themselves (like the near side rim of a bowl having an outline).
    i.imgur.com/O1xwUO8.png
    i.imgur.com/SGJ0WHE.png
    i.imgur.com/t6jNAjh.png
    Hopefully those screenshots explain what you do well enough. Basically at every point where you'd normally be adding the texel depths together as in this video, instead you subtract the pixel's depth by the texel depths. Then you add those subtraction results together. Divide by a new scalar parameter which will let you adjust how aggressively it outlines things, and then finally subtract by 1 instead of 10 million. Clamp and ceiling as normal and the rest of the steps are the same.
    Hopefully someone else found this as useful as I did.

    • @DevinDTV
      @DevinDTV 7 лет назад +1

      Oh also in the screenshot you'll see that further objects have thinner outlines than nearer ones. This was easy to accomplish. Not only that, but I have it adjust for your screen resolution as well.
      i.imgur.com/loG4CLJ.png
      This should explain it.

    • @RVillani
      @RVillani  7 лет назад

      Very good, man! :D

    • @stasismedia
      @stasismedia 6 лет назад +1

      Thanks for your input. I've managed to implement the overlapping outlines based on your screenshots.

    • @DevinDTV
      @DevinDTV 6 лет назад +1

      np, glad I could help

    • @siba2893
      @siba2893 4 года назад

      Thank you this was really helpful, do you know how to avoid the x-ray on the outlines when other objects are occluding them?

  • @randomguru1770
    @randomguru1770 6 лет назад +1

    Hey man, thanks for this tutorial. I finally managed to not render outlines for hidden objects.
    I do have another question tho. In the end of your video, at about 39:25 you're talking about rendering the outlines for overlapping objects with custom depth on. Could you please explain to me how i should do this? I've been trying for a while now, but none of my efforts work. Working with materials is different from other programming logic to me, and i just can't fully wrap my head around it.

    • @RVillani
      @RVillani  6 лет назад

      The logic you use to detect the outlines between custom depth and non-custom depth objects, you'll have to use it to detect outlines between different custom depth values

    • @joseruiz1763
      @joseruiz1763 6 лет назад

      I've been trying to do this for a while but I think I'm still not undertanding how this works well enough to do it.
      From what I understood, you get the outline between custom depth and non-custom depth because the addition of the 8 texels around the one we're on gets very high if even a single one is in a non-custom depth area.
      I assume that if you're comparing two objects with custom depth enabled the difference between the numbers is going to be much smaller, but I'm not sure of how much. How do I figure out what is the number I should subtract to the final addition for this to work?

  • @1_Man_Media
    @1_Man_Media 5 лет назад +1

    other than the fact mine is a fill not an outline this tutorial was great explained a lot of material stuff for me.. In the newer ue4 with 2 outpots for screen position uv seemed to do nothing pixel works but I have a fill is there something I can do with the uv or something to change it to an outline? I kinda dig the fill if I get an outline working I will prob make a toggle for the fill as well :)

    • @MrNecaKralj
      @MrNecaKralj 2 года назад

      You ever found a solution for this?

  • @prasadwadekar1499
    @prasadwadekar1499 3 года назад

    I loved the tutorial, but could you please elaborate how to toggle it,
    so that it can be use as an ability.

  • @hereticbyte
    @hereticbyte Год назад

    is there any method to some specific actor "not block mask"?
    im making RPG and when my character equip a Sword. the sword cause masking to player body mesh.

    • @RVillani
      @RVillani  Год назад

      What if you add equipped items to the effect with the character? Then instead of blocking, it glows with them.

  • @kostet1977
    @kostet1977 6 лет назад

    That`s very nice stuff man! Extremely useful for me. The only thing i`d like to ask is how to use it together with original material of outlined object.

    • @RVillani
      @RVillani  6 лет назад

      Thanks!
      It doesn't affect the mesh material. You just need to activate custom depth on the mesh, but its materials remain untouched. So the original material will still be there.

    • @kostet1977
      @kostet1977 6 лет назад +1

      ok, thanks a lot, i have to try to reproduce all your actions first. Maybe later will have some more questions.

  • @Jukerlaw
    @Jukerlaw 3 года назад

    U just earned a sub.

    • @RVillani
      @RVillani  3 года назад

      Thank you! ^^

    • @Jukerlaw
      @Jukerlaw 3 года назад

      @@RVillani Actually there's one more thing I wanna ask. What's the differences between Scene depth and Scenetexture.Scenedepth nodes?
      Also I feel like pixeldepth and scene depth are similar, they all do output the distance between camera and the rendered pixels right?

  • @flatinumfox
    @flatinumfox 2 года назад

    Great tutorial. I was looking at ue5 and ScreenPosition now has a ViewportUV / PixelPosition options. I'm curious how those work.

    • @irenenaya7644
      @irenenaya7644 2 года назад

      Not sure how they work, just want to point out that the one we're meant to use here is the ViewportUV one

  • @unrealkitty
    @unrealkitty 7 лет назад +1

    although my english is not good. but your expression is very clear. thank you for your excellent tutorial. expect more.

    • @RVillani
      @RVillani  7 лет назад

      Thanks! I'm kinda busy these last months (need money to make tutorials xD), but I'll try to get back to making tutorials as soon as I can.

    • @unrealkitty
      @unrealkitty 7 лет назад +1

      of course, earning money is top priority. but your tutorial is also valueable. I learn much knowledge about why to do something, not just how to do.

    • @RVillani
      @RVillani  7 лет назад +3

      Thanks!
      Yeah. I don't like those tuts where they just say what buttons to press. You gotta know why you're doing stuff.

    • @unrealkitty
      @unrealkitty 7 лет назад +1

      yes, we all want to know what happen behind the back of node. just like what you painted about background knowledge of outline in the tutorial.

  • @hasanshafy_
    @hasanshafy_ 2 года назад +1

    Where can I learn more about outline detection theory? How the renderer caculates the pixel depth and such.

    • @RVillani
      @RVillani  2 года назад

      That's an excellent question. I've never thought about it that way. I just found a bunch of tutorials with different techniques that helped me decide what worked best for me with the tool I have (Unreal, in this case).
      When you read about different ways to do the same thing, I think the theory comes as a consequence, because you start to realize what works better for certain situations, why it is so and with that knowledge you can even start creating your own way of doing it.
      That all said, I guess you could read about image processing with kernels to understand a bit more about this kind of effect. Sharpening is a similar technique to edge detection.

  • @michtrns3396
    @michtrns3396 2 года назад

    So great job! i love it! :D - What if i want a Range in this? you know, when a camera need to been close to see it?

    • @michtrns3396
      @michtrns3396 2 года назад

      nvm. i found a way to make it :)

  • @spinningninja2
    @spinningninja2 4 года назад

    Love this tutorial! Running into a bit of a snag though, if anyone can help. Every step of it has worked for me until he tests out the occlusion part around 28:10. When he tests it un obstructed objects are black while others are white, but for me everything just turns white, no matter the custom depth. My blueprint looks exactly the same, but I'm wondering if its possible if I've missed any steps anywhere? My current engine is 4.23 if there was anything changed there that might be causing this

    • @LeosNestingDolls
      @LeosNestingDolls 4 года назад +2

      From the ScreenPosition node make sure you are using the Viewport UV pin to connect to the add nodes - there are two pins in more recent engine versions compared to just one as in this video.

  • @matty3732
    @matty3732 7 лет назад +3

    Great tutorial!! but I have a question, what if I don't want the outlines for objects behind?
    I mean for all the static mesh but not when are behind something.
    I'm trying really hard but I can't find a way to do it!

    • @RVillani
      @RVillani  7 лет назад +3

      Thanks!
      Check if the custom depth value is higher than the scene depth. If it is, your custom depth mesh is behind some other scene object, because those values are the distance from the camera.
      An easy way to mask it out is to do:
      • SceneDepth - CustomDepth
      • Clamp (0, 1)
      • Plug the result into a Ceil node
      Now you'll have 0 if it's behind something and 1 if it's not. You can use that with a multiply or a Lerp to mask other effects.

    • @matty3732
      @matty3732 7 лет назад +1

      ok I finally manage do it! thank you!!!
      (I didn't except you would have respond to my comment :D)

    • @RVillani
      @RVillani  7 лет назад

      Matty37Casa nice! I was gonna send you an email, but when I had the time. Glad you managed to do it =)

    • @badrequest5596
      @badrequest5596 6 лет назад

      i was having the same problem but doing SceneDepth - CustomDepth was just removing the outline completely. so i tried adding a 1-x node after the clamp/ceil and it inverted the result and now the outline is only when objects are visible and not when behind something else. while im at it, can i change the size of the outline? i wanted to make it just a little bit bigger.

    • @OmegaMouse
      @OmegaMouse 5 лет назад

      Would you please spell this out for me? I'm having the same issue with the outline showing through objects in front of it. What exactly does this modification look like and where do you plug this in at? Thanks!

  • @ruslandad365
    @ruslandad365 Год назад +1

    Great Tutorial
    Thanks!!!!

  • @beginadobe
    @beginadobe 3 года назад

    Is there a way to achieve this if the highlighted objects are being occluded by other translucent/transparent objects?

    • @RVillani
      @RVillani  3 года назад

      I don't think so. You could enable Allow Custom Depth Writes in the translucent material settings to get it to render its depth, but then you won't have the custom depth from the occluded object.
      It would only be possible if translucent materials rendered to the depth buffer, but if they did, they'd make things behind them not render at all.

  • @ljjoao788
    @ljjoao788 6 лет назад

    When I add my last multiply to the Alpha in the Lerp in guves me an error. Does anybody know why?
    It says coercion failed. But I can add my multiply to the emissive color and it works.
    Thank you and great video :)

    • @RVillani
      @RVillani  6 лет назад

      Check if your Alpha input is not a value with more than one channel. For instance, the white pin out of a color node has 3 channels. The pin out of a TexCoord node has two. You can only use single channel values (floats) on Lerp's Alpha input.
      To check that, use a ComponentMask node on it, turn on Preview for that node and activate one channel at a time to see if they're outputting something.
      Thanks!

  • @AndrewSearaCanada
    @AndrewSearaCanada Год назад

    Hi!
    Thank you so much for the video! It helped me a lot.
    Can I Ask you if you think it would be possible to apply in the material something that activates the outline only when the camera/player is close (at x distance)? Or because it's a post-process material it wouldn't be possible?
    Thanks eitherway :)

    • @RVillani
      @RVillani  Год назад

      Thank you!
      You're in luck! Because this technique only generates inlines (so contours only on top of the outlined meshes) you can get those meshes distances from the camera (custom depth map) and subtract it from your desired max distance. The result will be negative for meshes further away and positive for the ones closer. Than you can use Saturate on that result to clamp between 0 and 1 and use it as a mask (lerp or multiply) for the outlines.

    • @AndrewSearaCanada
      @AndrewSearaCanada Год назад

      @@RVillani Thank you soo much 😃☺☺

  • @GaneshPingale
    @GaneshPingale 7 лет назад +3

    Thank you for the detailed explanation. Worked as expected but the outlines are kind of shaking. Do you know why and how to stop it?

    • @RVillani
      @RVillani  7 лет назад

      I believe it can be Project Settings > Engine > Rendering > Postprocessing > Custom Depth with TemporalAA Jitter
      It's enabled by default. Try disabling it.

    • @GaneshPingale
      @GaneshPingale 7 лет назад

      Unfortunately, still same jitter after disabling/enabling the option.

    • @RVillani
      @RVillani  7 лет назад

      What about Rendering > Default Settings > Anti-Aliasing Method
      If it's not that, then I really don't know. Does it shake even with the camera and objects completely still?

    • @Beriol9
      @Beriol9 7 лет назад +7

      I experienced the same thing, To fix it, open the material and go look in the parameters for the "Post Process Material" section. Inside there is an option "Blendable location": select "Before tonemapping"

    • @RVillani
      @RVillani  7 лет назад +2

      Good one! I didn't remember that. It'll make you post process be calculated before the anti-aliasing pass, if I'm not mistaken.

  • @damnation8794
    @damnation8794 5 лет назад

    Hey I did this tutorial twice just to make sure. I can not change colors. I want to use everything in this vid but several different ways. I did not realize that my game would basically be all post processing

  • @dreaghy
    @dreaghy 5 лет назад +4

    Hello !
    In UE4 4.20.3 the outline does work but within a weird part !
    I followed each step and your material is the same as mine !
    If I can describe more, the outline appears to fill up the entire outlined object,but I wanted just an outline !

    • @dreaghy
      @dreaghy 5 лет назад +1

      Oops my bad, the "Screen Position" node have now 2 outputs, and I did plug it in the second one rather than the first one ! The first one worked finally ! Sorry for the inconvenience !

    • @zacd1297
      @zacd1297 5 лет назад +1

      Thanks for posting this, it really helped save me some time!
      To anyone else who reads this, for clarification, you want to use "ViewportUV" NOT "PixelPosition".

    • @Darth_Gamers
      @Darth_Gamers 5 лет назад

      Im on 4.21 and I’m getting the same thing, but all of my nodes are correct. When he shows the different previews of what should happen, my results are all the same except for the step at 24:43.

    • @Darth_Gamers
      @Darth_Gamers 5 лет назад

      I figured out a way to fix it. I have a comment that’s not a reply to you, you can find how there

  • @samstersos
    @samstersos 2 месяца назад

    Hey, so I followed the tutorial and it works perfectly within the viewport but for whatever reason when I press play it stops working. Do you have any ideas what could be causing that? Thanks for the great tutorial!

    • @RVillani
      @RVillani  2 месяца назад

      thanks!
      Could be many things. The objects in play mode could be having stencil or custom depth disabled, for some reason. Or your player camera is overriding post process settings and disabling the PP material. Or something attached to the camera is drawing custom depth covering all the custom depth in the scene. Or you were testing from inside a Post Process Volume that's not set to infinite bounds, but in play you're outside of it. Or in your material you set some parameter during play that disables the effect. Or even something else specific to your project that I'd never guess haha
      You'll have to debug. While playing in the editor viewport, you can press F8 to eject from your player into level-editing mode. Then you can select things in the viewport or in the World Outliner and inspect their details to see if the expected depth/stencil settings are set on the meshes. You can also select your pawn/character and inspect its camera to see if it's overriding any post process settings.
      While ejected, you can also change the viewport mode from Lit to other view modes and see if stencil and custom depth look as expected.
      To go back into possessing the character, press F8 again.

  • @Granxdavis
    @Granxdavis 4 года назад

    Awesome tutorial, thanks a lot. But it is possible to do the outline with translucent objects?

    • @RVillani
      @RVillani  4 года назад +1

      In recent versions, I think so. There's an option in the material details to make a translucent material write to custom depth. I haven't tested it, but I suppose that's what it's for.

  • @linqingvs
    @linqingvs 4 года назад

    牛逼~very cool ~Thank you for shared!

  • @KIR_Engineer
    @KIR_Engineer 6 лет назад

    Great Tutorial. I''ve got one question. Is it possible to change alpha of color to make outline some transparent?

    • @RVillani
      @RVillani  6 лет назад +1

      Thank you!
      Yes. You can lerp the final result with the original scene color. The lerp amount will be the alpha

    • @KIR_Engineer
      @KIR_Engineer 6 лет назад

      Big Thanks, Rodrigo! It works!

  • @Tin_Can
    @Tin_Can 5 лет назад +1

    I've gone over the tutorial 3 times to try to figure out what's wrong, but this isn't working properly on 4.22.3 - in the final result, actors that are not occluded are still getting outlined, but that outline is jittering and looks glitchy - any occluded actors outlines work as they should though
    Edit: after reading a comment below, this issue is caused if Temporal AA is disabled, strangely enough - I originally disabled this because the occluded actors outlines were looking weird and this was a supposed fix for it, oh well, minor tradeoff for an awesome effect!

    • @__foo__
      @__foo__ 3 года назад +1

      I managed to fix it by changing the following project option: Project Settings> Engine> Rendering> Postprocessing> Activate the option: "Custom Depth with TemporalAA Jitter"

    • @Janokins
      @Janokins Год назад

      In the material, you can also set Blendable Location to "Before Tonemapping"

  • @piingy489
    @piingy489 3 месяца назад

    This tutorial is great! You explain so well!!
    I have a question regarding the time stamp 29:12 - how can I do so that I it will only render the lines on the objects that are not behind any other scene object?

    • @piingy489
      @piingy489 3 месяца назад

      I finally got my nodes right, so what i did was:
      Custom depth - Scene Depth, then put that into ceil and then clamp bethween 0 to 1. Then I masked R and then did a "oneminus". This then got put into the multiply node that was put into the lerp alpha :)

    • @RVillani
      @RVillani  3 месяца назад

      Nice one!
      Sorry I didn't answer before. I think I missed the comment notification :(
      There were some people who asked something similar, I think. But RUclips's comment ordering is weird, so it's a bit hard to find it.
      Thank you for the compliment on your first comment as well! 🫶🏻

  • @Severe_Valenok
    @Severe_Valenok 7 лет назад

    Hello
    What music track playing at the start?
    Great tutorial by the way!

    • @RVillani
      @RVillani  7 лет назад

      Thanks! It's Cold Killa (Sting) from the RUclips Music Library

  • @furrybproductions
    @furrybproductions 5 лет назад

    Is there anyway to make adjust the alpha of each color in the material? I'd like it so that one of them has an opacity of 0.

    • @RVillani
      @RVillani  5 лет назад

      The Lerp that mixes the effect with the scene: multiply the value that goes into the Lerp alpha by how much you want the colors to affect the scene.

    • @furrybproductions
      @furrybproductions 5 лет назад

      @@RVillani can you post a pic of the graph? I'm trying to use your material as a highlight material in game and need it to be visible behind walls as well as not behind walls.

    • @furrybproductions
      @furrybproductions 5 лет назад

      @@RVillani the reason I need one of the colors to have an opacity of zero is because I'm finding that the postprocess on the character helps occulude the highlight of objects behind them. If you have a better solution where I can have the highlight not show thru or over my character that would be best. Can you do a tutorial specifically on creating a highlight material that works in this way? It'd be a lifesaver for noobs.

  • @Darth_Gamers
    @Darth_Gamers 5 лет назад +5

    For anyone on 4.21 getting not just an outline but a fill too, I have a fix for that.
    After the step at 39:02 ish, replace the Lerp with an “If” node. Plug the old Alpha in the “A” slot, set “B” to 1 using the details menu, plug the color in the “A>B” slot, and plug the Post Process Mask in the “A

    • @kamui6780
      @kamui6780 5 лет назад

      What a good guy ^

    • @RVillani
      @RVillani  5 лет назад

      No. If is bad for performance. For anyone with that problem, use "Start Previewing Node" on each node of the process to find where the mistake is. A "fix" will only create more operations on top of something wrong.

    • @Righteous_Destiny
      @Righteous_Destiny 5 лет назад

      @@RVillani I was wonder if you knew about an issue that I'm having. The issue is even my character is 30 meters away he has a very thin outline when not occluded. Do you happen to know a fix for that? I'm in 4.21. Thank you

    • @RVillani
      @RVillani  5 лет назад

      @@Righteous_Destiny doesn't sound familiar. Is the character too thin or small? Can you share a screenshot?

    • @Righteous_Destiny
      @Righteous_Destiny 5 лет назад

      @@RVillani Thank you so much for the reply! I figured out the ossue it was the temporal AA that was causing the issue

  • @diegososa3912
    @diegososa3912 5 лет назад

    Hi Rodrigo, have you ever done the tutorial about how to fix when the outlines overlap?

    • @diegososa3912
      @diegososa3912 5 лет назад

      Can I contact you any way? I'm using outline to add people in a scene as just figures but when they pass in front of each other they overlap and it is not ok but I can not fix it.

    • @RVillani
      @RVillani  5 лет назад

      ​@@diegososa3912 You could contact me here: rvillani.com/bio-contact
      There's more than just e-mail there, but I won't post here to avoid spam. But I've been very busy. :(
      I have another tutorial (not in english though) that uses a technique on the stencils that displays only one color at a time. The problem with that technique is that it displays the color of the highest stencil value using Max.

    • @diegososa3912
      @diegososa3912 5 лет назад

      @@RVillani Thank you Rodrigo, I sent you an email from the company where I work explaining better my problem.

  • @MrSpronkets
    @MrSpronkets 3 года назад

    The resulting outline flickers a bit, any simple fix for this?

    • @RVillani
      @RVillani  3 года назад +1

      yeah. Project Settings > Rendering > Postprocessing > disable Custom Depth with Temporal AA Jitter

  • @nawakman
    @nawakman 3 года назад

    20:23 , actually since calculations are based on 8 samples pixels, this distance should be the meters multiplied by 80 instead of 100, because in your case there is 25% more lenght before the mask disappear. Anyway very good tutorial and well explained

    • @RVillani
      @RVillani  3 года назад +1

      I was just adding values there, so if the 8 samples are from 1/8 of the background distance (the 100km), it adds up to background distance. So I guess we're both incorrect XD
      The right thing to do would be to get max from all samples. Because the real intention was just to find if background is among the sampled pixels. That would really make sure it works up to 100km, not just 1/8 of it. I should've realized it back then.
      Thanks for calling it out and making me think again about it :D

    • @nawakman
      @nawakman 3 года назад +1

      @@RVillani To be fair this kind of calculations blow my mind, All yesterday I was trying to understand how it worked even though you given clear explication. Trying to think per pixel is so un natural to me

    • @RVillani
      @RVillani  3 года назад

      @@nawakman IKR! the way we have to think when making shaders is pretty unique

  • @christopheaurelie6943
    @christopheaurelie6943 2 года назад

    Hi Rodrigo, is it possible to keep the texture of the object instead of coloring the outline?
    I mean an oultline that keep the object texture

    • @RVillani
      @RVillani  2 года назад

      Hmmmm interesting. Like, if it was a weapon you'd see black outlines?
      I don't think so, because the object is hidden so if you tried to sample its color, you'd get the color from what's in front of it. You'd have to fake it with a texture for each Actor, but that would look a bit weird as the texture would likely move with the screen, not the object.
      Do you have an example of something doing that? Maybe there's a better way I'm not thinking of because I'm picturing it wrong

    • @christopheaurelie6943
      @christopheaurelie6943 2 года назад

      @@RVillani hey thank you for your answer. I'm trying to build a portal. I need :
      - the gun to be able to go inside the wall without being covered by the wall texture
      - and I was also thinking to use stencil for recursive portal (the dev of portal explained he did it with stencil).
      I'm burning my brain 😅

    • @RVillani
      @RVillani  2 года назад +1

      ​@@christopheaurelie6943 I don't suppose he was talking abou the same type of stencil we see in UE.
      I found interesting solutions to that clipping problem here: forums.unrealengine.com/t/visible-through-walls/44042/11
      My favorite is the vertex offset one: ruclips.net/video/K1kQGyBqcsE/видео.html
      The shadows problem at the end you could try to solve by not doing the vertex offset only in the shadow pass, like I show here: ruclips.net/video/MaDhhyrFbrM/видео.html (at 1:42:45)

    • @wecomfrom
      @wecomfrom 2 года назад

      @@RVillani thank you very much for your answer ! 👍👍👍

  • @ayoubrezzouk3060
    @ayoubrezzouk3060 3 года назад

    Guys i followed this tutorial but my outline is always mixed like if the custom stencil mask ( R) is returning a float value between 0 and 1 .....

    • @RVillani
      @RVillani  3 года назад

      can you upload a screenshot somewhere and link it here? I didn't really understand the problem.

  • @ianx2012
    @ianx2012 4 года назад

    Good Tutorial!!!
    Is anyway to hide in some object?
    I want it visible behind the wall, but it also visible to the character....

    • @RVillani
      @RVillani  4 года назад

      Thanks!
      I didn't understand what you're trying to do. If it's visible behind the wall, it's visible to the character. Right?

    • @ianx2012
      @ianx2012 4 года назад

      @@RVillani
      :(( Sorry for my poor English...
      Easy to say, what I want just not effect on the character.

  • @__foo__
    @__foo__ 3 года назад +1

    28:46 / The part of showing the visible lines only in the hidden parts of the object did not work, they are still visible in the visible and hidden part, but in the visible part the lines were blinking frequently. UE4.24.3

    • @__foo__
      @__foo__ 3 года назад +1

      I managed to fix it by changing the following project option: Project Settings> Engine> Rendering> Postprocessing> Activate the option: "Custom Depth with TemporalAA Jitter"

    • @RVillani
      @RVillani  3 года назад

      @@__foo__ by activating it? Not deactivating? Usually that settings is what causes people problems XD

    • @__foo__
      @__foo__ 3 года назад

      @@RVillani activating

  • @gomidasodabasioglu
    @gomidasodabasioglu 5 лет назад

    I see tremors on the screen how to fix that ?

    • @RVillani
      @RVillani  4 года назад

      Two ways: in the material details, set Blendable Location to Before Tonemapping or in Project Settings, on the search bar, search for "Custom Depth with TemporalAA Jitter" and turn it off.

  • @Went2PlayLLC
    @Went2PlayLLC 4 года назад

    how to receive shadow on 100% transparent material? Something like a cutout material, where you dont see color, only shadows from other objects.

    • @RVillani
      @RVillani  4 года назад

      I did something similar once. It wasn't perfect, but enough to fool the viewer on some situations.
      On a transparent material, set opacity to 100% and set it to Default Lit mode.
      Then, for its Emissive channel use the SceneColor node.
      Let me know if it's at least close to what you want.

    • @Went2PlayLLC
      @Went2PlayLLC 4 года назад

      @@RVillani ok, i have two nodes on translucency material, 1. scene color to emissive, and 2. opacity parameter 0, there is no shadow, its just clear translucence material. What happened now, is that shadow is pure transparent, like a hole. Opposite of what we are looking for.

    • @RVillani
      @RVillani  4 года назад

      @@Went2PlayLLC But I said "set opacity to 100%", so it should be 1.
      Then, if the material uses default lit mode, it should get some shadows, display what's behind it (because of Scene Color) and be fully visible. The shadows might be weak though, because of the emissive. But using emissive is the closest you have to making it's brightness match what's behind it.
      Also, it might cast shadows, but you can turn that off in the actor.
      And, something I never managed to solve: it'll have motion blur. So if you move your matte object, you'll see what's behind it with motion blur.

  • @markarmstrong4684
    @markarmstrong4684 3 года назад

    No matter what I do it colors the entire object instead of just the outline. Any advice on how to fix that?

    • @RVillani
      @RVillani  3 года назад

      output every node, on each step of the chains, to see if their output is making sense. That's how you debug materials. For numeric values, you can search for nodes called "debug". They exist for both a single scalar and float2, 3 and 4

    • @RVillani
      @RVillani  3 года назад

      doing that you can figure out where the problem comes from by seeing its origin and reduce wasted guessing time

    • @markarmstrong4684
      @markarmstrong4684 3 года назад

      @@RVillani Thank you