Dynamic Footprint System Part 1/2 - Unreal Engine 4 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome back to another engine 4 tutorial and in today's video i'm going to show you how to create a dynamic footprint system so in this we're going to have different materials as you can see here but this works with any i've got two picking up as many as you want and when we're on the snow we'll have a snow footprint and when we're on the grass we'll have a grass footprint again you can do this with as many as you want so i'll show you what this is gonna look like now so we hit play so you can see as i'm walking on this concrete here we don't have any footprints you can add some on this if you want but i haven't if we go into the snow we have these snowy footprints here as you can see if i go into the grass we then have grass footprints now you might not like the look of these too much as it's just a solid green color and a solid white color but you can change that to be whatever you like you can change it have an actual texture if you want i just did solid colors just to test it out like this and just to give you the basic fundamental codings of it but again you can change the looks to be however you like and also you can see at the very end they are disappearing so after a set amount of time they will also despawn meaning it won't lag out the game at all and it will be very efficient for a computer and for the game so i mentioned efficiency there so i did spend quite a bit of time this morning trying to figure out the best way of doing this i tried a lot of different ways and i think i found the most efficient way that i've found anyway so i tried a lot of different things so i tried to do a dynamic material so would then just change the texture parameter depending on which surface we're on but if we did that if we were on snow go to grass this snow would then also change the grass as the texture parameter has changed to be the grass one which should then think set a material so it would then create a material for ones which are already placed down so they don't change but that would mean if we go to snow and go to grass this would say a snow if we went back to grass this would then also be snow or then change that material to be grass meaning these ones would be grass as well so that might not make a lot of sense because it is quite confusing but then to fix that you'd say to just create a new material for each one so it then sets a new material for the ones that are placed down depending on which surface they're on so you can do that but i've basically done it kind of like that but more efficient so we're gonna have a different material for each surface so like i say i've tried a lot of different ways this is the one which i found to be the most efficient and kind of easiest to do and understand as well so if you have any other ways that you'd think about doing this let me know down below and i'll have a look into them to see if they're any better but like i say i think this one's quite good but let's get right into it so i'll delete what i've got now and then show you how i did this so what our first step wants to be is we want to import our footprint textures so i'm going to do this in my footprint system folder and then here so what i'm going to do is i'm going to just drag and drop in my footprint textures here string drop them in there and we have them like that i'm going to do is i'm going to open them up and i'll leave a link to these in the description down below now what you can do is you can either have two basic ones like this so i've just got a left and a right which i've just flipped and these are technically snow ones but you can have snow ones grass ones mud ones anything like that and these will just then be actual textures or you can do what i'm doing is just have one main one and change the color of it it doesn't matter too much and i'll show you how to do a textures later on as well you just follow the exact same steps i'm going to take and then i'll show you how to do that when it comes to it so once you've opened them up what we're going to do is we want to get rid of this background so that's why i've made it a black background so i can do is i can just take chroma key texture there select the color hit the eyedrop tool hit the black press ok and now we've got rid of the background color there save close that and do it with your other footprint as well so you can see i've got a left and a right you're gonna want to do the same thing as well or just have one if the foot has no specific shape but it most commonly will so again chroma key texture hit the color eye drop tool hit your background color press ok and we've got red of it like so save and close that then we want to make our materials so i'll put these in mats here actually so move them into there what i'm going to do is i'm going to control click on these to select them both right click and we're going to create material like so and what i'm going to do is i'm just going to rename these so this is footprint l g matte for footprint left grass and then i'll rename the other one to footprint rg for footprint right grass these are obviously going to be grass footprints i'm going to open those up straight away like so in here what i'm going to do is i'm going to move this texture sample out a bit and then also down and disconnect the rgb color there by holding alt left click i'm just going to deselect this and over on the right down here i'm going to change the material domain to be deferred decal blend mode to be translucent this means we can use it in a decal which is how we're going to be doing in these footprints the a value of this so the alpha is going to go into the opacity of our return value there and what i'm going to do is i'm just going to hold down 3 left click to get a constant 3 vector which is a color if you want to do this with actual textures what you do here is hold down t left click and get a texture sample put your texture in there and then plug the rgb into the base color like so i'm doing it with just solid colors so what i'm going to do is i'm just going to connect the result of this into the base color like so and change this concentrate vector color to be a nice green like this so i think that will be good for me hit okay and we can hit apply and that's what we need to do in here so all we've done is we've just made this material to either have a texture of our grass footprint or we want it to have the color of our grass instead the reason we're doing this text sample here in the opacity is this is going to give us the shape of the footprint this is going to give us the color or texture of the footprint so you're going to do that apply save and close that and then we'll do it in the other material as well this is still grass it's just this was the my left footprint the other one is my right footprint then like i say we're gonna do the same in here so move the texture sample out and down the a will go into the opacity disconnect the rgb like that and then we can just material domain deferred decal blend mode translucent hold down 3 or t left click to either get this constant 3 vector or your texture sample plugging it in to the base color and actually what i'll do is i'll just duplicate this one over so i can have the exact same color but if you're just using textures then obviously it'll be a lot easier for you so base color like so hit apply and save like that now we've done this for the grass but what we're going to do is we want to create these for every single material that we are going to have so in this example i'm making i'm going to be having a grass i'm going to be having a snow but you can have grass snow mud concrete anything like that so the concrete might just be like wet surface or something but you can do whatever you like so like i say i'm only going to have two which is snow and grass you can have as many as you want just do this in every single one that you have so what we want to do to make more is you want to select them both right click and hit duplicate like so then we'll rename these to be appropriate this will instead be l s for left snow and this one will be r s for right snow and then let's open those up and change the color to be white instead of green or change your texture to be snow instead of grass so i'll have it like that have a bit of a gray so it stands out a bit more like so i'll duplicate that over and then save and apply this material as well so again you're going to want to do this for every single material you have so just create a new material for each footprint of each different surface you want it to be on ie grass mud snow sand anything like that so we can close those like so so now you've created all the materials you want what we want to do is we want to actually create these footprint decals so i'm just going to go back to my main footprint system folder i'm gonna right click i'm gonna create a blueprint class this one is gonna be an actor i'm gonna call this one footprint underscore r you can name this whatever you like but for me this is my right footprint so that makes more sense for me i'm gonna open that up straight away before creating our left one in here we want to add a component we want to add a decal like so to change its rotation on the x to be 90 and then it's on the y to be minus 90. now you don't need to do the x one as well but that's just for my specific texture mess about the rotation in it perfect for you but the y you want to make sure it is minus 90 so that it is facing the floor and it's facing down so it works properly otherwise you won't get it working so make sure on the y it's rotated by minus 90. and then also on the y i'm going to scale it down to 0.75 now you don't need to do that as well again that's specific for my texture as otherwise it would be a square and i don't want my texture to be a square but again get it perfect for you and how you want it to look in the decal material i'm just going to set this to be a base material of my footprints rg so right grass it doesn't matter as this is going to be changed later on this is just as a reference as we need a material in there then you can change the fade start delay i'm going to set that to five but this is how long it will be there for before it starts to fade out so for example i want my footprints to be on screen for five seconds then they disappear you can set this to be a lot longer if you want so 30 seconds a minute anything like that but just keep in mind that the longer they are on screen the more laggy it can get it will only really lag out if you have a lot so obviously if you've got a minute's worth of footprints that'll be a lot more than five seconds worth of footprints so just get that to be how you want it to be the fade duration is obviously how long it will take to fade out so i'll also set that to five seconds as well so five seconds after they've spawned in they'll take five seconds to despawn then we just wanna make sure that we have destroy owner after fade ticked meaning they will actually disappear and not just be invisible this is again helping with performance and efficiency then we compile and save that then what else we want to do in here is we want to create our different materials so what we're going to do is we're going to hit the plus variable here and i'm going to call this one grass matte like so and i'll change the variable type to be a material object reference there hit compile that i'm going to change this default value so again make sure you compile it to change it i'm going to set this one to be footprint rg matte so my right footprint for the grass compile and save that i'm going to hit plus variable again i'm going to create my snowmat so again do this for as many materials as you made compile that change this to footprint rs for my right snow so that's all i need to do as i've only created grass and snow but if you made grass no mud sand anything like that do this for all of them this is how we're going to set which one it needs to be so you compile save and close that then what we're going to do is we're going to right click on that and we're going to duplicate it and change this one to be footprint l now we have our right footprint and our left footprint and then we're going to open up our left footprint all we need to do here is just change these materials around so instead of being right they are left so footprint lg for my left grass and then footprint ls for left snow and also change the default value of this decal as well to be lg compile save we can close that now we have those set up now we've got them set up what we need to do is we want to be able to spawn them so what we're going to do first is we're going to find out where we want to spawn them so to do that we're going to open up our character blueprint so for me that's content that person pp blueprints third person character but for you this could be third first whatever you've named it once we're in here we go straight up to the viewport we're going to do is we're going to add a component and we're going to get a plane i'm going to name this one foot l for left foot drag and drop that onto the mesh there so it's parented to the mesh so it moves with the mesh and the parent socket i'll change to also be foot l to the left foot compile that and i'll just rotate and move this to be perfectly aligned with the right foot as well so i'm just going to toggle off the snapping so i can get more precise movements and then just move this to be where i think it should be so i think that will be a good height that's around the center and i'll just scale this down the scaling doesn't really matter as we're only using this for location reference but it just looks a little bit nicer so again make sure this is placed directly in the center of the foot where you'd want it to be again this is where the decal is going to spawn so make sure it's just a little bit above the foot like so so it's not going to go under the floor so now that's a good reference for where the left foot is going to spawn so i wanted to do you want to control c control v that to duplicate it and get foot r so rename it foot r drag and drop that back onto the mesh parent socket this time will obviously be foot r so the right foot and then just move this to where we want it to be so let me put snap back on foot are like so so this is going to determine where the footprint should be spawning so we want it to be directly under the player's feet not just where the player is in general specifically the feet so we compile and save that what we also want to do is we want to make sure that we select both of these and then over on the right we're going to scroll down until we find collision generate overlap events we're going to untick can character step up on we're going to set that to be no collision presets will put as no collision and then also further down we'll untick cash shadow and tick hidden in game so what this means is that the player won't be able to see them and there won't be collision on them at all so as far as the player is aware these don't exist it's purely for us developers to see and mess about with to use as a reference for where we want the foot to spawn or the print spawn sorry so compile and save that and that should be that all done so what we need to do now is we set up where we want to spawn it now we want to set up when we go to spawn it so what we can do is we can minimize this as we'll come back here later on i'm going to go to our animations so for me that's content mannequin animations i'm going to do this in the third person run but you want to do this in every single animation you have which you want to spawn footprints in so this could be the running the walking the idle and the landing on the jump so open up all of those it's the exact same process in each one i'm going to show you how to do it in just one of these as that's all i need to do for this tester so once you're in here i'm going to pause the animation i'm just going to get to a side on view like so so we can see it perfectly like this let's go all the way back to the beginning we want to do you want to move this timeline along until the foot hits the floor so i think there the foot is now landing on the floor maybe a little bit further back like that maybe i'm going to right click on here and i'm going to add notify new notify i'm going to call this one footprint r so where the right foot has landed and move that to be on the timeline like so move this along again till we get to where the other foot lands so i say about there is good right click add notify new notify footprint l this is the left foot now again move that to where it wants to be and i think that is all the ones i need in here like so so as you can see if we move this timeline along the players running their foot lands there so that's why we want to spawn the footprint we're running again the foot lands about there so i'll move that over a little bit and now that's where we want the other footprint to spawn so we set up where and now we've also set up when so now if you're setting this up in multiple animations what you can do is you can right click add notify skeleton notifies and now you have these footprint notifies here you don't need to create more you can just access these ones again and so that will work perfectly again just find where you want it to spawn so there that's when the foot's landed and that will work perfectly like so once you've done that that'll be great so you can just save and close that again doing it for all the animations that you want so i think that'll be for this video on part one of creating this dynamic footprint system in today's video we've created materials created the decals and we've also made when and where we need to spawn these footprints and then tomorrow i'll upload the second part of defining these surfaces so you see here we have grass and snow we're going to be defining each one so the system knows which is which and then we'll actually be spawning these footprints spawning the correct type so if we have grass or snow and then that'll be it done so it's going to be two parts i recorded it all on one and edited it all and it's come out to just over half now it's about 31 minutes so i decided that might be a bit too long for one video so i'll cut it in half do this outro here and just split it so it's about 15 minutes each roughly about that so again at the end of this video and tomorrow the second part is coming out on doing what i've just said so thanks so much for watching i hope you enjoyed and i hope you found it helpful and if you did make sure to like subscribe down below so thanks so much for watching and i'll see in the next one
Info
Channel: Matt Aspland
Views: 10,276
Rating: undefined out of 5
Keywords: ue4, unreal engine 4, unreal engine, tutorial, ue4 tutorial, unreal engine 4 tutorial, how to make a game, how to, blender, games design, ue5, unreal engine 5, dynamic, footprint, footprints, foot, print, foot print, step, steps, footsteps, system, change, material, materials, changing, grass, on, snow, mud, sand, dirt, decal, decals, advanced, basic, quick, easy, part 1, part 2, part, playlist, series, prints, snowy, muddy, footstep, leave, ue4 footprints, on ground, ground, right, left, where, when, floor, the, time, texture
Id: VJstjFMVbZw
Channel Id: undefined
Length: 16min 8sec (968 seconds)
Published: Fri Dec 18 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.