UE4 Tutorial: Occlusion Masking

Поділитися
Вставка
  • Опубліковано 7 лют 2025
  • How to make an occlusion masking material function that shows your character when they are blocked from view. The effect can be combined with any other material and is easily customizable to fit a variety of needs. Topics covered: Material functions, material parameter collections, material instances, material graphs. Big thanks to meso for the original concept.
    LINKS:
    Blog post: olusiagame.com/...
    Texture Pack: gumroad.com/l/...
    SUPPORT:
    PayPal - www.paypal.me/...
    Gumroad - gumroad.com/ja...
    Patreon - / underscoremedia
    CONTACT:
    Discord - / discord
    Twitch - / bevd0g
    ArtStation - www.artstation...
    E-Mail - underscore@gmx.com

КОМЕНТАРІ • 126

  • @olusia2581
    @olusia2581 5 років тому +24

    Thanks a lot for the mention and the link in the description :) Your video tutorial is great - much easier to follow than my simple and hasty description. Nice work!

    • @underscore00
      @underscore00  5 років тому +3

      Thanks for watching! :) And thank you for the great method! Olusia is looking great so far, keep it up! I love roguelikes ;)

    • @KavanBahrami
      @KavanBahrami 2 роки тому +1

      @@underscore00 is there a reason you use the nodes 'subtract AB' 'abs' 'vector length' rather than the single 'distance AB' material node in your blog post write up?

  • @DanielGreenDGArtworks
    @DanielGreenDGArtworks 4 роки тому +68

    In case anyone is still watching this I found a solution to the shadow issue, add a node in called 'Shadow Pass Switch' and plug the 'if' output into the 'Default' slot on the node, then add a single 'constant' with a value of 1 to the 'Shadow' slot and then plug this into the end of the function!

  • @JAMbosco
    @JAMbosco 4 роки тому +14

    Wanted to point out
    To prevent occluding the shadows of the object, you can use a *Shadow Pass Switch* node in the material between the occluder function and the opacity mask output
    Just put the occluder result on the Default pin and add a material expression with number 1 with value "1" on the Shadow input and connect the Switch to the opacity mask and you got it
    Thanks underscore for sharing this ! It's much appreciated

    • @JAMbosco
      @JAMbosco 4 роки тому +2

      Something like this: imgur.com/a/mR5XNOv

    • @AJeyLMFAO
      @AJeyLMFAO 4 роки тому

      @@JAMbosco It works, thanks man!

    • @JAMbosco
      @JAMbosco 4 роки тому

      @@AJeyLMFAO Welcome mate

    • @AJeyLMFAO
      @AJeyLMFAO 4 роки тому

      @@JAMbosco can you tell me how to add a glow around the edge? Or just the color at the edges of the sphere?

    • @JAMbosco
      @JAMbosco 4 роки тому

      @@AJeyLMFAO Will look upon that and tell you, I'm also interested in something like this !

  • @timothygooding9544
    @timothygooding9544 22 дні тому

    Really cool to see and actually followable

  • @pompompela6339
    @pompompela6339 4 роки тому +1

    Wow, been trying to do this on my own for a while now. This works perfectly, thanks dude!

  • @justadaniel
    @justadaniel 5 років тому +1

    At 13:30, you can actually place a texture object parameter node, you just can’t promote the texture object to a parameter. (Just in case you need it for a future tutorial.) You can also set the texture to the node in BP using the same “set texture parameter” as a regular one. :)

  • @Vakaseemer
    @Vakaseemer 3 роки тому

    Awesome result! Thanks for the tutorial!

  • @Xperto_
    @Xperto_ 5 років тому

    I can see how this could be useful in a dense forest. Thanks for the great tutorial

    • @Xperto_
      @Xperto_ 5 років тому

      PS nice window layout

  • @aura-interactive
    @aura-interactive Рік тому

    Thank you! Very helpful indeed!

  • @matthewdusty199
    @matthewdusty199 5 років тому +2

    Playback Speed 0.25. Good Tutorial!

  • @Grimswoden
    @Grimswoden 5 років тому +1

    Another awesome tutorial thank you

  • @KavanBahrami
    @KavanBahrami 2 роки тому

    Solid tutorial, I now need to make it work for VR as its currently locked to the camera forward, whether or not it's look at the player. If I get a clean solution I'll come back and edit this comment.

    • @KavanBahrami
      @KavanBahrami 2 роки тому

      Ended up going a different route. I compared the distance between CameraPos and PlayerPos to the distance between CameraPos and AbsWorldPos, If it was less I just passed white, but if greater I took the angle between the CameraToPlayer vector and the CameraToPixel (AbsWorldPos) divided it by the max degrees I wanted to expose around my character (15) and then clamped result between 0 (or whatever fade I wanted) and 1. Different route, but was the only way I could get the same effect without being locked to the camera view. Now if follows my character around behind objects even if I'm in headset looking away from it. Hope that helps if anyone is doing this effect in VR, if you have any questions hit me up and I'll share a blueprintue pastebin

  • @RonitManhas
    @RonitManhas 5 років тому +1

    Really great quality content 👍👍👍

  • @luyaohuang6579
    @luyaohuang6579 2 роки тому

    THANK A LOT, it is really helpful

  • @_Envoy
    @_Envoy 5 років тому

    thinking about to add this to my top down shooter

  • @Nkrasart
    @Nkrasart 3 роки тому

    Thanks! Awesome!

  • @DeiversonSilveira
    @DeiversonSilveira 3 роки тому

    Amazing! Thank you!

  • @Montazeran8
    @Montazeran8 Місяць тому

    ❤❤❤

  • @YousefBuHazza
    @YousefBuHazza 5 років тому

    Thanks for this tutorial

  • @LLamafux
    @LLamafux 5 років тому

    Perfect

  • @NatePlayzGamez
    @NatePlayzGamez 3 роки тому +2

    this is absolutely awesome :) thank you SO much. quick question if its ok, im using the top down templae on ue4, and its not really working when trying to click and navigate within an occluded object. any ideas on how to make it work? thank you so much for your time mate :)

    • @darkagestudios8879
      @darkagestudios8879 2 роки тому

      go into the Mesh I think and make collision custom then tick ignore visibility

  • @najh1717
    @najh1717 5 років тому +1

    That's awesome! I subbed btw. Can you make a tutorial for creating an Iron Man type blast?

  • @risenchief6143
    @risenchief6143 5 років тому +1

    Hello, thanks for this tutorial. Did you find the way to fix this hole in shadows?

  • @lightps5515
    @lightps5515 5 років тому

    wooow! COOL

  • @benmoseley5178
    @benmoseley5178 Рік тому

    This is awesome thank you for sharing. Im trying to do something a bit more simple with this but struggling to. I have a diorama with rocks sticking out the base of it, instead of modifying the rock models i was hoping to place a mesh like a cube over them with an occluder material so they disappear. Is that possible with this method if i simplify it somehow? Thank you

  • @codeyhanson259
    @codeyhanson259 4 роки тому +2

    could this effect be done only by one camera and not all camera's

  • @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.

  • @Tomipolus
    @Tomipolus Рік тому

    Great tutorial, how would I go if I wanted to apply the effect to my third person character?
    Lets say there is a button that controls the characters arm, but the character itself is obstructing the view, and I would like to apply the effect inside the middle of character's body, so that the arm is visible from behind the character.

    • @Tomipolus
      @Tomipolus Рік тому

      I kinda did it, but its centered in the camera view, is there any way to make it follow the hand? As if the effect is between the wrist and the camera?

  • @ethandoesguitar1019
    @ethandoesguitar1019 4 роки тому +1

    Great tutorial, one of the complex ones that I actually managed to follow! What values would I have to tweak to make it not fully opasive, im trying a tilting maze where the occlusion masking happens on the walls closest to the camera, so would I be able to somehow have the lowest opacity 0.5?

  • @JoeTheSpaceGuy
    @JoeTheSpaceGuy 5 років тому +1

    There are literally no tutorials out there for «fog of war». Could you try to cover this?

    • @coderpup4639
      @coderpup4639 5 років тому +1

      Hey, I've not tried fog of war myself, but if you want to try it yourself, my initial thoughts would be learn how snow trail textures work and you could probably adapt that to a map for fog of war.

    • @Sivxgamer
      @Sivxgamer 4 роки тому

      Theres a free one on the marketplace now by VAFogOfWar that works pretty nice, but it's a plugin.

  • @tomraitener8281
    @tomraitener8281 3 роки тому

    thanks for your tutorial learn a lot !
    I need to apply this effect on megascan material but no idea how to do it? Any solution ?
    Thanks in advance
    Tom

  • @LeeJackson3d
    @LeeJackson3d 3 роки тому

    Nice. Any chance you know how to make the occluded object just fade a little so the opacity is half, but still within a bubble?

    • @underscore00
      @underscore00  3 роки тому +1

      Yes you can! I chose a masked material for performance reasons, but you can set the material to translucent if you like. You can also use a node called 'DitherTemporalAA' that will add graded opacity to masked materials without losing functionality by changing it to translucent :)

    • @LeeJackson3d
      @LeeJackson3d 3 роки тому

      @@underscore00 thanks for reply. That works well, the issue i have tho is my whole terrain is translucent now heh. The things to be occulded at mostly terrain that runs from one material.

    • @SkullsForSale
      @SkullsForSale Рік тому

      @@underscore00 MY GOD SIR! You are absolutely the bees knees!

  • @alessiagrassi
    @alessiagrassi Рік тому

    is there a way to use a cylinder shape instead of a sphere?

  • @ФедорСимонов-ф1ч
    @ФедорСимонов-ф1ч 3 роки тому

    tell me how change size first sphere in center???

  • @uddandushaik2051
    @uddandushaik2051 5 років тому +1

    Can you help me i have weapon fps animations but i want to replace with my character in place of another character.reply please i will be so happy. thanku

    • @underscore00
      @underscore00  5 років тому

      Hi! Sounds like you need to look into animation re-targeting! That's where you take the animations from one character and re-target them to the skeleton of a different character. Is that what you're trying to do?

  • @eran3161
    @eran3161 4 роки тому

    Great video, it's a pretty good start to build on. Btw since opacity masks can only switch between fully visible and fully not visible, the Hardness parameter doesn't really do anything, right?

  • @AdrenResi
    @AdrenResi 5 років тому

    hey underscore are you coming back soon

  • @ayanoaishi794
    @ayanoaishi794 5 років тому

    Thanks for the tutorial! But I was wondering if you could show how to create icons like in fortnite. Would be nice to have cool icons for cosmetics in my game C:

  • @yoapolloboy
    @yoapolloboy 5 років тому

    Hey bro, u can do a new tutorial to cloth simulation for 4.21 please?

  • @pakoo7715
    @pakoo7715 5 років тому

    hello, could u say some words about Wpn world collision? i mean, could u make a video how to fix weapon clipping through the wall?

  • @MadaoKing
    @MadaoKing 4 роки тому +1

    Great tutorial! I am having a problem where the occlusion mask is not happening on the character but right next to it. Do you know what might be the cause for it?

    • @bernardgra
      @bernardgra 4 роки тому

      Hello, did you manage to fix this by any chance?

    • @MadaoKing
      @MadaoKing 4 роки тому

      @@bernardgra yes i did! :)

    • @bernardgra
      @bernardgra 4 роки тому

      @@MadaoKing I am having a similar issue. How did you manage to fix it?

    • @MadaoKing
      @MadaoKing 4 роки тому

      @@bernardgra I missed one variable in it. happened when i try to skip steps

    • @bernardgra
      @bernardgra 4 роки тому

      @@MadaoKing I see. I think my problem comes from the fact that my camera fis finda fixed in the center of the screen and the character is not always in the center :/

  • @yashbijlani6652
    @yashbijlani6652 5 років тому +1

    It annoys me soo much seeing how underrated you are :(

    • @underscore00
      @underscore00  5 років тому

      The channel is growing slowly :) The best thing you can do to help is to share videos far and wide and get as many eyes on it as possible! No pressure though, thanks for watching :)

    • @yashbijlani6652
      @yashbijlani6652 5 років тому

      @@underscore00 ok ill tell my friends to subscribe to you

  • @LooksLikeIdiot
    @LooksLikeIdiot 3 роки тому

    Sick tutorial, just the thing I needed, would anyone happen to know why it doesn't work with an ortographic camera? If i change my camera to perspective it goes just fine but with ortographic it leaves a weird stationary culling spot always in the same place in the scene. Does the ortographic camera not physically move? is there a way to make this work with it

    • @lhmsc
      @lhmsc Рік тому

      In theory an orthographic camera is infinitely pulled back and zoomed in. Probably because of it's nature the camera position isn't calculated correctly.

  • @studiotkt2991
    @studiotkt2991 Рік тому

    Thanks for the vid, but i have a problem, the panner node refuses to work. I also tried a rotator (as it only needs a single value) but they don't update, so to speak. Using the MPC if i adjust the speed value in real time, you can see the U channel scrolling, but it won't move on its own. I'm on 5.3 and have had panning lava materials work in all versions prior to 5.3. Is it a bug? My mat function looks exactly like yours, and yes i have meticulously gone over every node to confirm.

    • @underscore00
      @underscore00  Рік тому

      Hmm interesting. Are you saying the panner doesnt work in the editor or when you play the game? It sounds like your editor is potentially not set to real-time. If that's not the case then I'll have to investigate, I havent followed this in 5.3 yet.
      Thanks for the thoughtful comment :)

    • @studiotkt2991
      @studiotkt2991 Рік тому

      @underscore00 I've actually had to read some pretty obscure articles but it seems that a scalar parameter (fed from MPC) is understood by the panner to be a 'fixed' number, i unplugged the speed and multiply and just fed it a .1 on x speed and it works. Maybe this is a change in 5.3? i.e the panner can also be used to offset the uv coords, not just animated panning. Not sure, but thanks for your time.

    • @underscore00
      @underscore00  Рік тому

      @@studiotkt2991 ah interesting, I hadn't noticed that! Might be worth making an update video about

    • @studiotkt2991
      @studiotkt2991 Рік тому

      @@underscore00 I think it would benefit new users especially to make a new video ( more likes the better am i right :) ? ). I mean a few nodes have changed, for example, the 'absolute world position' node now has split struct pins so you can choose which axes to take, ultimately meaning you don't need to 'transform vector' anymore. Little things like that would confuse a newbie.
      As I said, i have been using unreal from 4.6, i moved from unity when i heard murmurs of nanite being developed and OMG am i glad i did. Moving to materials without tessellation was a shock to me, it made sense for high poly models in the nanite system, however, characters aren't supported within nanite, so doing away with tessellation/heightmap in this instance, in the knowledge that nanite will eventually include characters, probably wasn't their best move.
      I know a lot about unreal, but i am sooooooooooooooooooo far away from knowing everything. Point being, i thank you once again for making specific videos, but more importantly, with specific titles. Searching for what you need in unreal, is a completely different vocabulary for searching a unity vid.

  • @ChinaFriedPanda
    @ChinaFriedPanda 4 роки тому

    Is there any way to make this a semi-transparent mask instead of fully transparent? I'm aware that Opacity Mask is designed to be either 0 or 1 :(

    • @underscore00
      @underscore00  4 роки тому +2

      Yes! You can convert the material to translucent and then use the opacity pin (instead of opacity mask) and then use a clamp node to increase the minimum to a value above 0. This also opens you up to using soft edges and other effects, but you might notice a slight hit to performance.

  • @darkagestudios8879
    @darkagestudios8879 2 роки тому

    So this only works as a Material? I am new to this and I have it working but If I have a pre textured BP asset how do I get it to work on that without replacing the material ?

    • @underscore00
      @underscore00  2 роки тому +2

      Its a masking material, so you only need whatever nodes are plugged into 'opacity mask' to make the effect work. This means you can pretty easily adapt your existing materials by selecting the main output node and changing the domain to 'masked'. Hope that helps :)

    • @darkagestudios8879
      @darkagestudios8879 2 роки тому

      @@underscore00 Thank you for the reply, I realized that after a little playing around :) I was using pre made assets and didn't know how to get it to work with them (Still don't) so I am making my own :)

    • @leoivanovic4538
      @leoivanovic4538 2 роки тому

      @@underscore00 Great tutorial I wish this part was in the video but really glad you responded. So we have to go into each material for each object and add the "occluder_MF" into the mask plug? Thanks again a lot of us are really new and all these little steps really matter!

  • @jvcnb_off
    @jvcnb_off 4 роки тому

    So this isn’t working for me, is there any way my camera distance has something to do with it? Aspect ratio and camera distance are the only thing I changed from the third person template

    • @cryptobotyt
      @cryptobotyt 3 роки тому

      Hey, you ever get this resolved? I'm having the same issue where it appears behind my player if the camera is not centered directly over them.

    • @jvcnb_off
      @jvcnb_off 3 роки тому

      @@cryptobotyt ua-cam.com/video/5Y1Zj5hXdZw/v-deo.html I find this one easier to follow, even though it's in what I think is Russian lol

  • @JAMbosco
    @JAMbosco 4 роки тому

    But how can you implement this on an already masked two sided foliage material?

    • @JAMbosco
      @JAMbosco 4 роки тому +1

      Okay I got this.. Using multiply *face palm* xD

    • @underscore00
      @underscore00  4 роки тому

      @@JAMbosco thats exactly what I wouldve suggested :)

    • @Mr1eeer
      @Mr1eeer Рік тому +2

      @@JAMbosco Wish I read this comment three hours ago.

    • @SkullsForSale
      @SkullsForSale Рік тому

      Can you elaborate please? I have foliage that already has an Occlusion Mask node, without it plugged in the leaves are a globby mess, how do I input both of them into the Occlusion Mask input?

    • @SkullsForSale
      @SkullsForSale Рік тому +1

      AAAhhhh I mixed it with the "MultiplyVectorWithQuaternion" node, it works! :D

  • @arvideo2145
    @arvideo2145 2 роки тому

    Hi, Does it affect performance in any way? e.g Does it reduce FPS?

    • @underscore00
      @underscore00  2 роки тому

      If you use it like in the video, the performance impact should he negligible. If your experience a frame rate drop, let me know and we can discuss the specific case :)

  • @sloane_lysbeth
    @sloane_lysbeth 6 місяців тому

    i can only get it working along horizontal planes. has anybody else had this problem?
    im not sure if it's a change between ue4 and ue5 or if im missing something somewhere.
    i included a vid that shows what i mean.
    ua-cam.com/video/Kk9Mr0W6iLQ/v-deo.html

    • @sloane_lysbeth
      @sloane_lysbeth 5 місяців тому

      i figured it out. in unreal 5 the transform vector node has drop down options. by default the source is set to tangent space. you just need to switch the source to world space. silly mistake on my part.

  • @nowak93
    @nowak93 4 роки тому

    Where did you learn all this? I find it hard to find good learning material on Unreal Material Shaders.

  • @a_blue_chicken1093
    @a_blue_chicken1093 10 місяців тому

    1:44 racism!!! (its a joke)