Pathways & Roads using RVTs [UE4/UE5]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello welcome back it is another video uh and today i'm going to be showing you how i'm dealing with roads and pathways and stuff in prismatica so let's jump straight in uh you can see i've been working on all my props and you know getting everything all done so and whatever um but on top of that i've been messing around with my rode spline system or systems before we take a little look under the hood at what's actually going on here um you will need to know a few little things so you'll need to know how to set up a runtime virtual texture you'll also need to know about height lerp which i have a video for here as a little extra bit of fun we do some grass occlusion using my runtime virtual texture grass occlusion method which is linked here and i guess you'll probably need to know how splines work but i will like show it all on the on the screen and you know if you if you want to copy it then you can copy it and and lastly but not leastly i forget what number i'm up to um you'll need to know a little bit about custom data so there is a video here about custom data and how it works and why it works and what it does back to the roads and you can see that it's actually like it's up in the air it doesn't matter whereabouts it is you know up or down because we're not actually rendering the object at all we're only printing it to the runtime virtual texture basically the way this landscape texture is set up the bulk of it here which is you know all the colors and the textures and the the blah blah they all get done here um but then they get put into a runtime virtual texture instead of going straight to the make material attributes or the you know the material output or whatever uh they go into the rvt so they're getting written to the runtime virtual texture and then within the same material we sample that runtime virtual texture and so we you know we pop it all out um into here basically so let's just like for simplicity's sake uh we'll say that the the landscape is all green and then the output here is just you know the color so that's basically how the landscape needs to be set up uh it needs to be using a runtime virtual texture like it needs to be writing to and reading from an rvt and so what that kind of does is it offloads all of the landscape um like shader code writes that to a texture and then it just reads from that texture from then on now the benefit of doing this is that we can actually print things to the landscape's runtime virtual texture so in this case we're printing this road to the landscape so the way that this spline is set up it's all done in the construction script and essentially what we do is on construction we create a dynamic material instance this part isn't completely necessary unless you're changing the texture value and stuff if you were just using a material instance you know per road type then you would be absolutely fine just um you know just leaving this part out and just having a material assigned to the spline uh so then we get the number of spline points minus two we do a for loop from zero to that indicy then we loop through them all we add a spline mesh component which looks like this it's just a a grid you know just a plane that can bend and deform and that kind of stuff and then you know set forward axis for each of these set the start and end we get the location the tangent scale you guys can probably just copy this if you want i might even pay spin all of this in the description so keep an eye for that so basically this is just setting up a spline then we set the material on each spline point to be this material here that we created at the start which you know again you don't have to do that if you're not changing any of the parameters um on construction and then lastly but not leastly we get the spline points at the the start so spline point zero and at the end and we set some custom data floats on them oh spicy this is a really nice trick that i figured out that just makes everything so much nicer looking so that's how the spline itself is set up again i will pay spin it in the description so let us now look at the spline material and and we'll we'll have a look at what it's actually do aaron you can see that the actual material output here it has well nothing going for it basically a blank material with zero opacity you know it it doesn't exist uh if we were to put opacity in it then you would see that it's just a you know it's a strip but the meat and potatoes of it happens over here where it gets put into runtime virtual texture output and then written to the rvt that the landscape is sampling so one of the cool things about printing to run time virtual textures is this opacity input um you can see that if i just or if i just put the opacity at one then this wouldn't have that nice fade out that we you know that we love it's just like it's it's all printing to the the damn thing so by using this opacity input we can actually you know put gaps in what we're printing and all that good stuff and as well as the opacity we get the inverse of that or the the one minus of that you might not need to one minus depending on how you've got it set up but this goes into the roughness channel which we're using for the grass occlusion so you can see that you know there is grass um but you can see that wherever there isn't brick even when there's just like little gaps and stuff the grass pokes up through it uh and you know it's it's kind of cool so the other cool thing that i'll show just before we get stuck into it proper um you can see here i've got a custom data float of index zero called start and a custom data float of index one called end and i've just got a random color in here and if i just put this into the base color then you can see that the start point is white and the end point is well orangey red something something um so this way we can differentiate which is the start which is the end piece and you can see here that i've actually got the bricks trailing off into nothingness so how do we actually get our pathways to look this fantastic well the answer is using heightlap basically all we're doing here is we have a texture called road texture uh this one is just a well a texture of a road and it goes this in this direction uh pretty self-explanatory and we have some tiling parameters here we can tell it to tile more or less keep in mind when you are doing the tiling and stuff it does need to be an integer or a uh what do you call it you know half of one or a quarter you can see here that uh there's a cut in the texture because it's not an integer it's not integeral whereas if i put this up to two then it's seamless that's how textures work and then we've got the tiling in the other direction this one doesn't have to be an integer um but you know it just basically says hey how like how thick do we want these these bricky boys to be so that's that little bit there um i pack my height map uh or you could call it a displacement map uh mine's packed into the b channel you might need to you know if you're using like proper textures and stuff have a separate sample with the same uvs for your height map you'll have a few textures i just have one texture which is a normal map and a height map so what i'm going to do now i'm going to get this height map and we're gonna put this into the actual uh like the meshes texture and stuff just so we can see what's going on so you can see here we've got our height map now what do we do with this height map well we use a height lerp so this is the texture input so texture minus one and then we have our height blend value multiplied by two add them together do some contrast and as we go from zero to one here you can see it's going to reveal the highest parts of the height map first so like the tops of these bricks so this by itself looks you know it's getting there a little bit dodgy so the way that we get this to fade towards the edges is we get a linear gradient we saturate it just you know for safety uh then we're going to one minus it and then multiply that by itself so what this is going to leave us with is a gradient from one side being black it's going to be grey in the middle it's going to be black on the other side and then we have two parameters called road falloff offset and road falloff hardness so we plug them into here and you can see as i start playing around with these you know we can create a gradient of of sorts um you know if the hardness is harder it will you know be brighter in the middle uh we can use the offset to kind of you know determine how thick or thin it is or you know if we have a low hardness but then a high offset we can get something that's like you know a smoother gradient from side to side and then on top of the you know side to side uh like fall off values we also have a start and end fall-off value using the custom data that we set on the spline for the start and the end points so what this is doing is if i just go into here and i go and fall off hardness so you can see here that we end up with a gradient at either end one of them goes this way one of them goes that way and the way that we actually create that is by just getting another linear gradient this time in the u direction so like along the path and then one of them is going in this direction uh multiplied by you know this custom data it's basically just a lerp from zero to one saying you know is this the end piece uh and this one's asking is this the start piece and you know it has the the inverse the other direction of the gradient and then we just add them together we multiply them by what's the the falloff hardness so how strong does this gradient need to be and then we subtract that from this so then what we end up with this kind of shape here so we've got you know from one end to the other end there's a gradient and then we've also added this one here from you know the the end point blah blah blah um and you know this is what we're ending up with very cool then as an extra layer on top of that we just have some noise uh this is some world space noise it's pretty pretty big um and then there's a parameter called noise influence that gets subtracted from the result there so let's just plug this in see what it does noise influence okay so you can see here it's just adding noise to this this thing um so you know if we want something that looks like it's kind of all broken up and whatnot or it's you know very worse for wear we can add noise to it and that's gonna help with making a bit more believable so you can see like over here i have this circular pattern and i've just you know i've pumped it full of noise and it looks pretty pretty ripper so that's basically just there to kind of break up the the tiling a bit so that it looks a lot more natural so we're getting to the pretty spicy part of this and that is determining the the colors and stuff so up until this point we've been creating our kind of final height map and so then this gets split into two parts uh one of them decides the color which has an offset and a contrast and then one of them decides the actual like opacity of the um the road so this one here uh it's called dirt offset dirt contrast it's just going to lurp between the color of the road and the color of the the dirt or something if we go to the dirt offset value we can say okay well the dirt needs to come up higher the dirt needs to go down you know lower uh we can adjust all of that then we can also adjust the dirt contrast so if i put this up to like 100 or 62 000 apparently you can see that the transition between the the stone and the dirt is like you know it's super super hard whereas if we turn this down a lot uh down a lot to like one or something uh it's like a smoother gradient so you can see as i turn this up yep put it down yeah cool so this is just a stylistic thing i i like to keep mine at like 10 ish and then very similar to that section we just have the the roads opacity so this is the opacity that's getting drawn to the runtime virtual texture it's also what goes into the the grass occlusion if i put this up to you know a billion then it's like very very hard if i put this down to you know five or uh one or something you can see that it's a lot kind of smoother in the way that it blends into the ground now one last thing that i do i actually use the specular channel of my runtime virtual texture as a height map for you know the actual landscape um so i can pass through the height map and use that for some cool landscape effects but the cool thing about this is that we can actually write the height map of the road onto the landscape so if i was to get my weather effects i have some like pretty cool weather effects you know in my landscape and whatnot if we were to get my puddles and start you know doing puddles as it was raining and whatnot you can see that the height map of the road is actually taken into account now like this isn't a 3d effect at all this is just all completely fake um but you can see that it you know it definitely adds a lot more depth to it i guess it's just really cool uh being able to access the height map in the rvt if we need to so that's just another a fun little bonus so i believe that is everything uh i believe that's the entire road spline material prismatica tm advanced uh enhanced road system thing nothing too special i'll just i'll pay spin this for you guys if you want there is another really cool thing that i did um which is probably a little bit out of scope for this video but it's this kind of radial tiling uh material thing that you know uses the same thing like the the height map and the blah blah blah all of the bricks are like the right length and whatnot and the way it works is we get the text coords offset it by half we do vector to radial value and then we actually break it up into segments using some quantization uh so you know you've got to know how many bricks are in the like how many rows of bricks are in the texture and then we can adjust the other text coord by that you know by like which row it's in so if i was to just get this and put it in there and well i guess the g is just already in there um then you'll see why this could easily be an issue if you were trying to do this any other way so you can see in here the bricks are like they're the right size um but as we go further and further out they just get stretched and stretched because that's kind of how the uh the radial vector thing works so the cool thing about this is that it breaks it up into like individual rows and then it makes each row tile more than the last row and basically fixes all of the the stretching uh and this can be you know as as big as we want it to be but you know i don't want to go out of scope for this video so i'll just i'll put in a paste bin you guys can study it if you want i'll do a little explainer video just like a short five minute video that kind of goes over this as a as like a part two to our pathway and whatnot so one last thing i wanted to add is that you could put the height map into a a virtual height field mesh i think they're called or if you're still using tessellation you could feed the height map into you know one of the channels on the rvt and then use that to do some tessellation stuff so that the the bricks and whatnot actually stick out of the landscape um rather than just relying on normal maps and that kind of thing like i do because it's a top-down game and whatever but if you did want some parallax or something you could use you know parallax occlusion mapping using the the landscapes global height map or displacement tessellation or virtual height field height whatever they're called i don't i don't know what they i've never used it but there are a lot of ways to kind of take this to the next level which could be cool but aside from that that's the video i hope you learned something hope you find it useful as i said before i've left both of these materials and the spline set up in a paste bin in the description so feel free to use these don't have to give any credit or anything like that but if you do want to go one step further in supporting the channel and the tutorials and all the all the good stuff you can do so for as little as one dollar per month through the patreon which is linked in the description so get on it please please anyway with that i say goodbye goodbye [Music] you
Info
Channel: PrismaticaDev
Views: 36,992
Rating: undefined out of 5
Keywords: ue4 spline road, ue4 spline mesh actor, unreal engine spline path, ue4 spline pathway, ue4 path, ue4 pathway, ue4 road, ue4 landscape spline, ue4 landscape spline road, ue4 rvt, ue4 runtime virtual texture, ue4 runtime virtual texture landscape, ue4 runtime virtual texture performance, ue4 rvt blend, ue4, ue4 tutorial, ue4 road material, ue4 road material free, unreal engine 5, ue4 landscape tutorial, ue4 landscape material, ue4 landscape painting, ue4 hide grass
Id: momc4h5J19Y
Channel Id: undefined
Length: 20min 45sec (1245 seconds)
Published: Sat Jan 29 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.