Material Layering Systems in Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] traditional material authoring an Unreal Engine limits you to baked Maps out of something like substance or blender the problem with this is every object or group of objects has an individual set of maps and material so if we have rusted metal over here and we use rusted metal again we're duplicating a lot of information not only that but we lose flexibility when we have to go back and bake new maps when we make a change the final nail in the coffin is maps are tied to texal density to resolution there's a better way in some respects it's the future of texturing and unreal and we call it material layering systems I'll break down this process into two simple steps steps one is material layers two is material blending I'm explaining our theory in blender for a few reasons one the setup is a bit simpler than unreal so it's easy to see what I'm doing and two if you can understand how this works in two different softwares you can lock in the unchanged Concepts and filter out the quirks that are a little more software specific to start explaining our theory in blender let's look at step one material setup let's grab a robotic arm from offworld depot.com this was modeled by bushan jtop he's worked on films like Dune and Blade Runner he's modeled this prop specifically for our site along with some other great ones you could check out it's a good example to show our Theory to simplify our example I'm deleting the tarp we have here so we're just focused on the metal material add a new material and delete the old one just to be thorough by default a material has this principled shape and a material output we want two materials in one so start by duplicating using shift d our main Shader to mix between the two shaders we need the mix Shader node for our shaders I'm keeping it fairly simple I went to textures.com and found a metal texture I liked and a rust texture blender comes with a handy add-on called node Wrangler you just need to make sure it's enabled under edit preferences add-ons and node rank to set up a full texture just press crl shift t with a Shader selected and choose all of your images it'll set up the entire network including your map tiling I'll tile my maps and get each Shader set up individually now we have both the metal and the rust step two is material blending to blend our materials dynamically I'm using my absolute favorite procedural texture add-on in blender I bring it up just about every other video it's called fluent materializer and what fluent does is within blender if we just press f for fluent we get these helpful procedural Maps like this cavity map what we could do is use this to drive the factor of our mix Shader rather than having just a straight gradient falloff which I hate we can use this texture input I'm just using a grunge texture from my site and plugging that into the texture slot from here we can change our distance to affect the spread of that rust fluent can bring out Edge and cavity detail and so much more it's worth mentioning some of the nodes it uses only work in Cycles which is blender's Ray tracing engine so make sure you're not an Eevee so we have this Dynamic mask now to drive the amount of rust in blender something will adapt to also work in unreal a bit later traditionally if you want to now to take this into unreal you'd have to bake down each asset the problem is is and unreal we would lose all of the benefits we just created but what if we could apply the same effect and the same principles in unreal let's save blender we'll need it again and open up a new Unreal scene let's start by bringing in just the same robotic arm Geo I exported a simple fbx from blender now let's create a new material by simply right-clicking and creating a new material let's call it m under underscore base for material base next we need what unreal calls a material layer so to do that go to materials and material layer let's call this ml for material layer uncore base we'll create one base layer and then instance for additional layers the final piece to this puzzle is our material layer blend just go to materials material layer blend we'll call this one MLB for material layer blend underscore base with that out of the way our steps are pretty similar to what we did in blender we need to set up our material layers and then we set up our layer blending let's start by double clicking our new material layer and blender each material had a principled Shader and input maps and on real it's no different let's start by dragging in the texture maps for our first material to keep organized I created a new folder for each set of material Maps metal and rust then we just need a node called make material attributes this is basically our principled Shader however and unreal we have a bit more flexibility because rather than doing this setup two times like we did in blender we're creating a template or base material layer that we can instance for our additional layers anything we plan on changing within our other layers we need to convert to a parameter so for example each material has different tilable Maps so we can actually rightclick each map and convert to a parameter take a moment to name these appropriately like albo normal and so on now I'm only showing you two layers but you could take everything I show you in this video and build way more complex systems keep in mind unreal has a built-in limit of 16 textures per material with all of your blending layers if you're exceeding that limit another good optimization you can utilize here is something we call Channel packing if you're not familiar Channel packing is basically when we take gray scale Maps like oclusion roughness and metalness and we pack them into the channels of an RGB image in some cases an rgba image where we use the alpha Channel as well this can help us get the most out of our maps for my scene I'm using occlusion into red roughness into green and metalness into blue it's important to pick a standard and stick with it the whole project you can pack single images into red green and blue channels and blenders compositor and it can help reduce memory usage in your scene as well as help us fight off that 16 texture per material limit the last parameter we should expose is our texture tiling in blender we had a texture coordinate node and in unreal we have the exact same node just add a multiply node by holding down M and clicking and a single value by holding down one and clicking then multiply the value by the coordinate right click and we can convert that value to a parameter as well this exposes it so we can edit it later depending on our material layer let's call it Ty link plug that into each appropriate map just like we had in blender now make sure to save to create the additional material layer we just need to rightclick and create a layer instance the next one we might call M lorei for material layer instance uncore rust since we expose the parameters in each instance we can just swap out the maps as well as edit the tiling do the same for any additional layers you might be working with now step two just like in blender is our material blending setup in blender we did this with a procedural cavity node from our fluent add-on and onreal we don't have that ability instead what we'll do is bake out the blend map we already created in blender it's actually pretty simple select our object and just control shift click the last node before the mix Shader to isolate it this is essentially our grayscale cavity map for blending this drives the rust amount to bake this out of blender press shift a to add a new image texture node this doesn't need to be plugged in anywhere this is the image we're baking the information onto with that in mind let's do a 4K image called mask 1 we don't need Alpha information now with the desired point in our Network isolated and the new image texture selected we can go to our bake settings under render properties since we're isolating an area in our node graph it's actually just emitting from the surface of the object so we can change bake type to emit since emission values render rather quickly we can change our render sample count to something like two also under color management just make sure we're using a standard view transform we don't want a color transform like agx or filmic affecting the result of our bake then just press bake it shouldn't take more than a few seconds within our image editor we can find mask one and come up to image and save it wherever we need to I saved mine as a 16bit PNG remember how I mentioned Channel packing earlier let's actually utilize that now so instead of one grayscale image with one blending map why don't we just grab a few more take a minute to develop different sections in your node graph for different mask types in addition to my cavity map I'll include an edge map as well as a random per Island map using the geometry node now create a combined color node and we can solo that plug our first point we identified in the node graph our cavity map into red the second one which is the edge map into green and our third map the random ID map into blue now keep the combined color isolated and let's just bake a new map you could try other variations for blend Maps as well you really don't need to stick to exactly what I'm showing you instead of our first attempt where we just had one map now we have the power of three all in a single image pretty cool and pretty optimized that's the power of Channel packing back in unreal let's open up our material layer blend base just like our mix Shader node and blender we have input a b and our factor or in this case our Alpha all we need to do is drag in our mask we just baked from here we create a channel mask parameter node and we go into the alpha we want the mask to be something we can edit so we can rightclick and convert this to a parameter as well and that's all we need to do we have red green and blue channels in our image if we used the alpha channel to pack yet another fourth image all you need to do to utilize that is to add an append Vector node put RGB into a and Alpha into B and our actual material in a moment will have individual control of red green blue and Alpha channels or all of our blend maps to make sure down the road none of these mask values exceed one just drop down a simple clamp node and make sure we have a minimum of zero and a maximum of one I'm doing this because we could actually add something like blue on top of the green Channel or we can subtract them from each other as well if you want greater control over the mask we could add something like a value step node after the clamp plug clamp into mask offset value then plug the result into Alpha let's create a single value let's convert that to a parameter we'll call mask spread we can make the default value 0.5 the slider minimum zero and the maximum one plug it into gradient this will act as a slider to spread the effect of our mask this is something I was playing around with and it actually gave me some pretty decent results for growing and shrinking The Edge mask this is one area I know that I have more to learn learn so if you've got a better note set up please let me know in the comments for now this along with our mask options works pretty well back in our content drawer if you had a few different blend options you could rightclick this material layer blend and create an instance in our case I think our single image blend with the three options we already have is plenty now in the actual base material this is where it all comes together first scroll to where it says use material attributes and check that box that'll simplify our setup here since we've already really defined everything we need within our individual material layers and blends so let's go searching first we need our material attribute layers I just searched the word layers then we need to get our material attributes themselves so search get material lastly we need to set our material attributes you could probably guess search set material this is just one of those things you'll have to remember in my mind it's layers get and set you might consider taking a screenshot here and saving it for your reference or just bookmark the video now when we click on the material layers we can see we already have a base layer this is our background layer or our metal layer we don't need to set anything here for now all we need to do is click this plus button for more layers like our rust layer and and click it again if you have any other additional layers you've got going back in the content drawer we can finally finish this thing out right click our base material and create a material instance this is finally the material that'll be applied to the metal arm call it mi4 material instance uncore robot arm drag and drop this onto the mesh when we edit the material instance we need to drag and drop each material layer asset and our blend asset into the appropriate slots notice how when we expand either the layer or blend asset we get all of our exposed parameters we can change the tiling for each layer as well as the mask spread value we created under Vector parameter values in our blend we can see our red green and blue channels put a one by anything you'd like to use we could for example have one in red and negative 0.5 in green if we wanted to subtract half of Green from Red we could go as far as ne1 to totally subtract one map from another here's an example where I created a third layer I just instanced the existing material layer and plugged in some new maps for this chipped paint texture don't limit yourself here with everything I've shown you plus a few other techniques you could get creative you could do overall layers to help tie assets together like World space driven layers so anything below a certain point gets a layer of liquid residue we've really only started to scratch the surface on how material layering systems optimize our scene and enhance flexibility while I don't have time to cover every little trick in this video please consider subscribing to my site offworld depot.com and I'll continue producing videos just like this one to improve your own own Indie production pipeline thanks to my offworld depot.com supporters these artists really make everything possible so special thanks to them and I'll see you in next week's video crazy feel my body shaking Shing all the [Music] fa I don't know why I've been here w underneath the pressure
Info
Channel: Riley Brown
Views: 11,391
Rating: undefined out of 5
Keywords:
Id: P2ahDcajDEg
Channel Id: undefined
Length: 17min 2sec (1022 seconds)
Published: Fri Apr 05 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.