UE4 Tutorial: Occlusion Masking

  Рет қаралды 42,365

underscore

underscore

5 жыл бұрын

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/occlusion-masking/
Texture Pack: gumroad.com/l/kPmAYm
SUPPORT:
PayPal - www.paypal.me/JBunderscore
Gumroad - gumroad.com/jackmadethat
Patreon - / underscoremedia
CONTACT:
Discord - / discord
Twitch - / bevd0g
ArtStation - www.artstation.com/artbybeven
E-Mail - underscore@gmx.com

Пікірлер: 121
@olusia2581
@olusia2581 5 жыл бұрын
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 жыл бұрын
Thanks for watching! :) And thank you for the great method! Olusia is looking great so far, keep it up! I love roguelikes ;)
@KavanBahrami
@KavanBahrami Жыл бұрын
@@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 3 жыл бұрын
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!
@DragonCrestPC
@DragonCrestPC 3 жыл бұрын
Thanks!
@Nkrasart
@Nkrasart 3 жыл бұрын
Thanks!
@bardiyaes1399
@bardiyaes1399 2 жыл бұрын
Big Thanks!
@isaackershnerART
@isaackershnerART 2 жыл бұрын
Thank you! been looking all over for that answer!
@franciscojavierpapaia9140
@franciscojavierpapaia9140 Жыл бұрын
Legend
@JAMbosco
@JAMbosco 4 жыл бұрын
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 жыл бұрын
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 !
@Vakaseemer
@Vakaseemer 2 жыл бұрын
Awesome result! Thanks for the tutorial!
@Grimswoden
@Grimswoden 5 жыл бұрын
Another awesome tutorial thank you
@RonitManhas
@RonitManhas 5 жыл бұрын
Really great quality content 👍👍👍
@justadaniel
@justadaniel 5 жыл бұрын
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. :)
@pompompela6339
@pompompela6339 3 жыл бұрын
Wow, been trying to do this on my own for a while now. This works perfectly, thanks dude!
@RogueTurkey
@RogueTurkey 3 жыл бұрын
Could you happen to help me out lol?
@pompompela6339
@pompompela6339 3 жыл бұрын
@@RogueTurkey ???
@RogueTurkey
@RogueTurkey 3 жыл бұрын
Yeah lol
@pompompela6339
@pompompela6339 3 жыл бұрын
Go on...???
@RogueTurkey
@RogueTurkey 3 жыл бұрын
It’s just not working lol
@DeiversonSilveira
@DeiversonSilveira 3 жыл бұрын
Amazing! Thank you!
@aura-interactive
@aura-interactive 10 ай бұрын
Thank you! Very helpful indeed!
@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
@YousefBuHazza
@YousefBuHazza 5 жыл бұрын
Thanks for this tutorial
@luyaohuang6579
@luyaohuang6579 2 жыл бұрын
THANK A LOT, it is really helpful
@Nkrasart
@Nkrasart 3 жыл бұрын
Thanks! Awesome!
@_Envoy
@_Envoy 5 жыл бұрын
thinking about to add this to my top down shooter
@LLamafux
@LLamafux 5 жыл бұрын
Perfect
@ethandoesguitar1019
@ethandoesguitar1019 3 жыл бұрын
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?
@eran3161
@eran3161 3 жыл бұрын
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?
@matthewdusty199
@matthewdusty199 5 жыл бұрын
Playback Speed 0.25. Good Tutorial!
@najh1717
@najh1717 5 жыл бұрын
That's awesome! I subbed btw. Can you make a tutorial for creating an Iron Man type blast?
@KavanBahrami
@KavanBahrami Жыл бұрын
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 Жыл бұрын
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
@risenchief6143
@risenchief6143 4 жыл бұрын
Hello, thanks for this tutorial. Did you find the way to fix this hole in shadows?
@lightps5515
@lightps5515 5 жыл бұрын
wooow! COOL
@tomraitener8281
@tomraitener8281 2 жыл бұрын
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
@NatesPlayzGamez
@NatesPlayzGamez 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 Жыл бұрын
go into the Mesh I think and make collision custom then tick ignore visibility
@benmoseley5178
@benmoseley5178 8 ай бұрын
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
@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.
@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:
@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?
@AdrenResi
@AdrenResi 5 жыл бұрын
hey underscore are you coming back soon
@alessiagrassi
@alessiagrassi Жыл бұрын
is there a way to use a cylinder shape instead of a sphere?
@yoapolloboy
@yoapolloboy 5 жыл бұрын
Hey bro, u can do a new tutorial to cloth simulation for 4.21 please?
@user-yb2ec5rr4c
@user-yb2ec5rr4c 3 жыл бұрын
tell me how change size first sphere in center???
@Tomipolus
@Tomipolus 9 ай бұрын
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 9 ай бұрын
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?
@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.
@codeyhanson259
@codeyhanson259 4 жыл бұрын
could this effect be done only by one camera and not all camera's
@arturin8084
@arturin8084 Жыл бұрын
Where you able to do it?
@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 жыл бұрын
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.
@C_CREATURE_
@C_CREATURE_ Жыл бұрын
@@underscore00 MY GOD SIR! You are absolutely the bees knees!
@MadaoKing
@MadaoKing 4 жыл бұрын
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 3 жыл бұрын
Hello, did you manage to fix this by any chance?
@MadaoKing
@MadaoKing 3 жыл бұрын
@@bernardgra yes i did! :)
@bernardgra
@bernardgra 3 жыл бұрын
@@MadaoKing I am having a similar issue. How did you manage to fix it?
@MadaoKing
@MadaoKing 3 жыл бұрын
@@bernardgra I missed one variable in it. happened when i try to skip steps
@bernardgra
@bernardgra 3 жыл бұрын
@@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 :/
@JoeTheSpaceGuy
@JoeTheSpaceGuy 5 жыл бұрын
There are literally no tutorials out there for «fog of war». Could you try to cover this?
@coderpup4639
@coderpup4639 5 жыл бұрын
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.
@danielwhitehead8965
@danielwhitehead8965 3 жыл бұрын
Theres a free one on the marketplace now by VAFogOfWar that works pretty nice, but it's a plugin.
@uddandushaik2051
@uddandushaik2051 5 жыл бұрын
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?
@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 жыл бұрын
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.
@RogueTurkey
@RogueTurkey 3 жыл бұрын
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
@jonzcrypto
@jonzcrypto 2 жыл бұрын
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.
@RogueTurkey
@RogueTurkey 2 жыл бұрын
@@jonzcrypto kzfaq.info/get/bejne/a79hjc1mzb7Iiqs.html I find this one easier to follow, even though it's in what I think is Russian lol
@arvideo2145
@arvideo2145 Жыл бұрын
Hi, Does it affect performance in any way? e.g Does it reduce FPS?
@underscore00
@underscore00 Жыл бұрын
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 :)
@studiotkt2991
@studiotkt2991 7 ай бұрын
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 7 ай бұрын
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 7 ай бұрын
@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 7 ай бұрын
@@studiotkt2991 ah interesting, I hadn't noticed that! Might be worth making an update video about
@studiotkt2991
@studiotkt2991 7 ай бұрын
@@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.
@darkagestudios8879
@darkagestudios8879 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
@@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!
@yashbijlani6652
@yashbijlani6652 5 жыл бұрын
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
@JAMbosco
@JAMbosco 4 жыл бұрын
But how can you implement this on an already masked two sided foliage material?
@JAMbosco
@JAMbosco 4 жыл бұрын
Okay I got this.. Using multiply *face palm* xD
@underscore00
@underscore00 4 жыл бұрын
@@JAMbosco thats exactly what I wouldve suggested :)
@Mr1eeer
@Mr1eeer Жыл бұрын
@@JAMbosco Wish I read this comment three hours ago.
@C_CREATURE_
@C_CREATURE_ Жыл бұрын
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?
@C_CREATURE_
@C_CREATURE_ Жыл бұрын
AAAhhhh I mixed it with the "MultiplyVectorWithQuaternion" node, it works! :D
@nowak93
@nowak93 3 жыл бұрын
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 3 ай бұрын
1:44 racism!!! (its a joke)
UE4 Object Mask l Unreal Engine 4.26 (Tutorial)
8:12
Coreb Games
Рет қаралды 37 М.
UE4 - Tutorial - Render through Walls!
16:30
Dean Ashford
Рет қаралды 44 М.
Heartwarming moment as priest rescues ceremony with kindness #shorts
00:33
Fabiosa Best Lifehacks
Рет қаралды 8 МЛН
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 21 МЛН
Этот Пёс Кое-Что Наделал 😳
00:31
Глеб Рандалайнен
Рет қаралды 3,5 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 42 МЛН
UE5 Camera Occlusion Masking - Tutorial
8:29
Alex Huang
Рет қаралды 3,9 М.
UE4 - Tutorial / HowTo - Line of Sight Vision System
46:52
UE4 Tutorial 101 - Occlusion Outlines
40:33
Rodrigo Villani
Рет қаралды 75 М.
Unreal Engine Materials in 6 Levels of Complexity
44:12
pwnisher
Рет қаралды 173 М.
How to HIDE Texture REPETITION in Unreal Engine - UE4 Tutorial
11:43
Unreal Sensei
Рет қаралды 368 М.
Dither Temporal AA Node | 5-Minute Materials [UE4]
5:23
PrismaticaDev
Рет қаралды 33 М.
Recreating BG3's Camera System in UE5 | 07: OCCLUSION MASKING
19:07
Distance Fields (Part 1) | 5-Minute Materials [UE4/UE5]
9:20
PrismaticaDev
Рет қаралды 105 М.
UE4 Tutorial: Panini Projection
14:00
underscore
Рет қаралды 14 М.
Unsink Your Boat - How to Remove Water From Boat in UE5.3
10:00
Peanut Games
Рет қаралды 3,7 М.