Using Blender like Substance Designer

Using Blender like Substance Designer

July 12, 2019 34 By Bernardo Ryan



hi 80 boys here recently I put out a video tutorial about procedurally texturing clean asphalt and before I go on I just wanted to mention you don't necessarily have to have seen that video for this tutorial to make sense though this should be able to stand on its own basically the asphalt idea was a challenge to keep everything as real-time as possible and do it in blender 2.8 s real-time ie the engine but from that I got asked a bunch of times how to take the results of that tutorial and simplify it onto a single plane that way it be possible to get it into something external like Unreal Engine 4 for example well even if staying within blender this also means massive amounts of procedural calculations no longer need to be calculated making everything a whole lot simpler and faster so we'll be covering baking to a plane but we'll see that has its limits seeing through transparency so instead we'll be setting up a little more like we might with say substance designer having nodes specifically for certain passes one of the more useful tricks to know is how to convert the bump node output into a normal map output instead it's possible that you might not have heard about substance designer so I just wanted to offer a bit more context there substance designer as they say themselves have become the standard for creating PBR materials you can do some pretty incredible procedural texturing with it with all the advantages that come with that infrared varieties and so on you work mostly node ly with in substance designer and those nodes are connected to output passes that upon rendering give you all the textures required to drive your material it can do tiling textures and depth map creation which are both things I want to go into more detail with or blender by the way in a future video it can do some very notable things blender really struggles with blur and flood fill probably being key examples what's great to see though is that several projects are underway to improve procedural texturing within blender it's great to see substance designer as such a high example to kind of try and strive for and reach towards and it is very tempting to spend some time creating an addon that makes working in this way a lot more effortless basically blenders got a lot of potential for this sort of stuff something else substance designer does amazingly well though is just with the sheer amount of excellent procedural organic grunge textures that can be used and are very artistically appealing and usable something else that I feel like blender could probably reached awards for blender Simon Thomas has some good examples for texturing procedurally that I highly recommend checking out and talking of grunge and noises he also has some free stuff that includes some more advanced noise patterns that are very cool a lot of the more advanced stuff though does require a lot of nodes behind the scenes and for me one of the main downsides when trying to use Eevee anyway for some real-time results is that we quickly max out the amount of nodes that we can use and so that's where I wanna start off in this video so as a quick recap we get the pink texture of death if we use too many procedural textures that we want to work in real time so a solution would be to use the cycles rendering engine instead of the look their rendering mode we have here but that doesn't work for us if we want to keep things real time in which case a second option is to extend the texture by layering further details onto a new plane with a new material that hovers ever so slightly on top so we just need a mask to use on the top plane to say where we want to show the top material or the bottom material now if you've absolutely no idea what I'm talking about you can check out this tutorial that digs into it in a lot more detail so coming back to this example if I simplify the amount of nodes being calculated here by redirecting the flow by holding ctrl and left click and try to find that point there and just plug it into here instead and then let go we can see our material springs back to life so I've got those other layers in this particular example all hidden at the moment and by the way we can use this filter icon to show what options we want to see on this far right-hand side currently I just want to see visibility and render ability all these objects will render but in this viewport they're not on display at the moment we've got a bunch of paint stripes and an upper layer so I'm just gonna left click and drag across all these so that we can see them in our viewport let's select that and if I press G to move it then you can start to see the parts of the material that this hovering plane is responsible for I'll right-click to reset and that can also select this additional object and press G here move the mouse around and you can see that hovering slightly above everything else so a downside to that is going to be if we bake down to just one texture then we're gonna lose our kind of infinite resolution we're just gonna have the resolution of the image that we baked too and the second problem will be that we'll lose the ability to tweak the texture efficiently we'll have to return back to this setup make the tweak rebake and then continue from there but there are obvious pros to this so it's going to then calculate new changes a lot faster you'll notice the more noise that you add the longer you have to wait until you see the results of that node let's take a look at a simple plain baking process because something very cool about blender is how easy it is to do in normal circumstances to bake to a point but we're gonna see a little problem with baking this particular setup but we'll come to that in a second so all we would need to do is go shift a mesh plane I'm gonna gonna press G and then Z and just raise that above everything next we need to create the texture to bake to so I'm gonna click new on here let's call this our baking material and let's zoom in a little bit actually don't really need this stuff though I just need an image texture so shift a texture image texture drop that in there and then I can create a new image from here let's make this 2048 by 2048 and I'll call this bake me no need for alpha and let's bake the base color so we don't need any crazy bit depth here so I'm gonna leave that off and click OK let's create a new window so we can see the 2d image that this is gonna bake so I'm gonna select this lower shader editor and we can choose any other corners of this I'm just going to click from the bottom left just because we can so once the cursor turns into a little across I'm just gonna left click and drag to the right and then this shader editor I want to switch to one of our 2d editors so the image editor is fine let's find out bake me zoom out a little bit so we need to have this selected so it knows what we want to bake to then we need to come down to our bake section and say what we want to bake I'm gonna try baking the diffuse and we don't need the direct and in correct I just want the color we have selected to active enabled which means I'm going to press Z to toggle into wireframe so I can easily left click and drag across all the geometry there with our materials on and that leaves our top plane that we want to bake to still the active object and selected to active and then just hit the bake button after the bake is complete it gives us this image now something else to bear in mind for that is that it's gonna take the amount of samples into account so if we just take a look at in sampling here you can see I just got one certain passes are going to need more samples to get a clean bake but in this case we should just find that one does the trick now let's just take a look at this control space to maximize that window zoom right in and you can see that we have a large black area right here and we can see there's large black patches here so basically what is happening is that this bake isn't taken into consideration the transparency and currently there's no way to factor in our alpha in the bake panel so we'll just need to find another way to go about this one workaround could be that we just bake each little hovering plane separately and also bake out the Alpha masks that would work in some cases and then mix between those with a mix shader' on just the one plane in the end but I think a more attractive option in this case anyway is instead of bacon is just simply render and treat blender a little more like you might a program like substance designer all we need to do is set up the camera so first of all I'm gonna take this baked pie Mona delete it with X let's press Z to go back into our look death mode and in this scene here I have a collection called camera you can easily create collections just by pressing C for example with the cursor in the outliner and then drag our camera or whatever we want into that collection well I'm just going to undo that with ctrl Z and leave it in this original camera collection so I have this baked camera which is already set up but I'm going to press X and delete that and set it up again I'm going to select that camera collection so that we go shift a and add in a camera it adds it into this collection I'm gonna let's press M to open up our properties sidebar you can see it has some rotation values which I'm gonna left click and drag across and press it to 0 or the shortcut key to do that would be all and if we press G to move that off we can similarly use alt G to put it to the center of the world well actually I'm going to raise this above I'm going to press G and then zet two out there and then let's come over to the seam tab and the dimensions here I've set this to a square resolution like 2048 and if we press zero to jump into this camera you can see that we can't see the full extent of what we've done here with this material so all we need to do is come over to the camera settings change that from a perspective to orthographic and instead of it being six units that we can see or 6 meters we're gonna set this to 2 which if I select one of these planes here you can see the dimensions here is 2 meters by 2 meters finally we just need to set up the materials of the planes of this geometry that has all of our procedural nodes on so if we take the bottom layer for starters this lower layer and zoom out here to take a look at it what we want what we have is main inputs here so for example the base color the roughness and whatever is informing our normal and so where those enter our principal shader will channel those instead to a very simple emission shader setup so as you can see here the base color splits into a simple emission shader and I've just called that base color by typing that in here so in for the properties sidebar similarly for the roughness and here I've also got height so this node here ends up informing the height of the displacement the bump and also goes straight into this height emission shader finally down here we also have this normal map but I'll come back to that and explain that in a moment so assuming you've already seen the asphalt texture in tutorial you likely already know this but I thought let's just spend a few seconds to show how to use these reroute in nodes and label them as it's actually really easy so we can go shift a and we'll find under our layout section we've got these frames here that we can just drop into position and then if we wanted to we could drop any nodes on top and now we can move the frame around press n to open up the properties sidebar and we have various options to change here and we can actually call it something useful by typing in the label area and that comes up here we can also give it a separate color something like this or we can delete that with X actually just select a node and then go shift P thanks to the node Wrangler add-on do that automatically for us again I still eat that with X because I just want to show about these riru ting nodes as well so I can go shift a and add in a reroute node here and we just get this little circle I can move around with G and if I drop that on the line there you can see this little noodle lines being redirected but there's a quicker way to do that again which is just holding shift and then right-clicking across it to draw a line and they will automatically create a new rear ooting point for us one last thing to bear in mind here if I press T to open up the tools you see I'm actually set to this select a tool we can also select these links cut tool and that way if we left click and drag across here it'll break that connection but rather than switching tools I just like to keep the Select tool on and I'll break the link between these two in a different way this time so simply by adding yet another node in there and pressing X just to quickly delete it so let's just do that again I'll just go shift and right click cross it and as soon as it lands just hit X and that way I don't need to switch the tools so just press T to close up to give these little riru ting nodes available simply select it just come over to the label setting in the properties sidebar just make sure we're on that item tab and then we can type anything we want into there and it should show up here in the graph all right let's get back into it so let's say we wanted to start with the base color to make things easier let's make sure we have the node Wrangler add-on enabled make sure we go f4 and then preferences go to our add-ons find the node related add-ons here and make sure this is enabled then I can click this then when we control shift and click on this base color here it's automatically going to change the material output to that shader for us and we can see in the viewport a bit of a change now and then what I'm going to do is go to the upper layer or I could just alt and left click in a viewport and go up a layer new there and then similarly I've set this up again here but there's a slight increase in complexity here because it's a top layer it has some alpha transparency to worry about so that's why each section looks more like this so what I need to do is ctrl shift click on this mix shader' here and now we're getting the resource of what our base color should be so whatever informing this base color in the principal shader is instead being plugged into our mission shader here and then whatever was informing our alpha the main transparency so what was being looked into this area here is now also being plugged into the mix shader' factor between a transparent shader and this emission shader I can also do that here without paint stripe white so I've already set this up so if we just come over to where we find our base color again we have this same setup so I'm going to ctrl shift click on this one and then let's come over to the paint stripe yellow and then find our base color again here control shift click on it and then if we zoom out now and go control space in this viewport we'll see that is the image that we want for our base color this is essentially our base color baked so what we can do now is simply render before we do render though just a couple of things to bear in mind so I'm going to go to control space so we can get access to our properties over here the main properties window and let's come over to the rendering tab and find our color management which is here what we want to make sure is that we're on standard here and not filmic if we're on filmic we're gonna get a lot of cool benefits for our final render expanding the amount of dynamic range that can be captured and displayed to us on the viewport but this particular setup we're going to need to make sure that is set to standard and that way what we get is going to be more predictable here something else to bear in mind is that with the emission shader we're again only really going to need one sample and it may have occurred to you that this actually should work for Eevee so in a sense we could bake in Eevee in a way or at least you know render what we need in Eevee however at the moment I would advise against doing that just because there seems to be a slight issue just at the border of the render so to demonstrate this slight border problem that we're getting with the renders coming out of Eevee I've taken the roughness pass of all the geometry that's making up this since I think it's a little bit more noticeable on this example I've switched the render display mode over to the image editor so when we press f12 to render it'll pop up in here instead of a separate floating window and as you see we're set to cycles if I go control space on this just so that we can see that we're in slot 1 and if I hit f12 it'll rerender for us and if i zoom right in on the edge here we can see no particular darkening right at the border so control space again and I'll do now is switch over to Evy and I'll press number two in this image editor to switch the slot there so I'll press f12 and let's go full screen with this one control space I'll zoom in even further to make it as obvious as I can so you can see a slight darkening at the border on that and if I press number one to switch to our cycles you can see we don't get that so by contrast I think this is a little bit more noticeable toggling between one and two there another option that we've got available to us if I press 3 to move over to slot 3 and control space is we can do a viewport render so for that I've turned off everything in the view using these two icons so it's nice and clean and we can go view viewport render image and now we have that render in our image editor over here so control space to maximize so we have slot 3 for the viewport render slot 2 which looks almost identical if not identical there actually and then slot 1 is our error free at the borders cycle render so with that explanation out of the way for why we're using cycles I'm gonna jump back to where we were in cycles before demonstrating that evie border problems so that we can continue rendering our base color paths so all we need to do is press f12 lets it render if we shrink this window and zoom out here we have this image ready to save now something that I'd recommend doing is at the moment I'm in slot 6 and what I do is just use a different slot for each pass so first slot 6 let's say we're using that for base color so let's jump over to slot 7 and then I want to close that if we want to get that back by the way we can just hit f11 and then ever just bring this back into view we can switch that back to slot 6 and there's our render again let's move that back to slot 7 though and now let's set up another pass for example the roughness Pass so I would just ctrl shift click this that the yellow stripes at the sides in the middle here I want this roughness area here for the upper layer that we have selected there I'm going to just zoom out and find the roughness that has been set up here and then finally alt left clicking to get the lower layer and then this is a simple setup just a single emission shader and now this is going to be our roughness pass so f12 to render this and there we go and if we press 6 we can still Tuggle back to our base color now they our roughness pass on slot 7 to render out a height map that's easy enough we just control shift click on another of these shaders and go through the other planes but instead of doing that let's assume we want to take this out into something like Unreal Engine or unity so in that case it would be pretty handy if we could just get a normal map straight out of here rather than just a height map and we could do that by taking a look at what we get coming out of our bump map node so I'm working on the lower layer right now so I'm just going to turn off the visibility of all the other layers so let's turn off the upper layer and just switch that lower layer back on zoom in a little bit you can see the type of blue that we have on here is not the kind of blue typical in a normal map so I'm going to switch over to this solid shading view and click on here and you can see the map cap is showing us a typically get my corrected normal map representation there and so we get this kind of purplish hue and if we switch back to the look there you can see that's definitely not the kind of hue that we're getting throughout here however we can convert that bump map using these nodes here to get a kind of colors that we need for a normal map so we ctrl shift click on this emission shader here there we go so what's happening here is I'm just taking a couple of color mix RGB nodes and the first one is sets it out but the fact that slider all the way up so we're adding a value of one to every channel and then we're going to multiply by 0.5 so if we click on here you can see 0.5 on each Channel or we could just divide by 2 at that point we get something resembling a normal map and if I mute this with the M key the gamma node then you'll see we get kind of a slightly lighter normal map kind of represented in a linear color space but I like seeing it in the viewport in the standard RGB color profile that's how most normal maps that you come across will look anyway so we can set the gamma to 2.2 and then at that point we have something that we can render so I'm going to turn the rest of the layers on left clicking and dragging across I'm going to take the upper layer and find our normal map section so adding 1 and then divided by 2 or multiplying by 0.5 rather gamma correcting it and then ctrl shift clicking here and now we've got both the layers let's take the paint stripes scroll out and then exactly the same setup here control shift clicking mix shader' and same again here I've placed this stuff up here control shift click and there we go we're ready to just render that normal map so f11 here's our roughness I'm going to press 8 to move to slot 8 close that down and press f12 the only other piece of the puzzle is to save the renders out and see those set up in a new material whether that be in Eevee cycles or maybe another external program like Unreal Engine unity karo and so on first what I'll do here is go to control space minimize that view and in this 2d window here I'll basically just find our render result and now within this window we can hit six seven and eight to switch between our renders now all we need to do to save this is to go to image and then save a copy I like to do save the copy rather than save as just so that this rendered version is unchanged sometimes instead of the render easel blender we'll switch it for the version that we've just saved to so instead of that I'm gonna save a copy then I'm just gonna find somewhere to save it to we're gonna give it a name so let us call this tutorial base color and the former is PNG an 8-bit which is completely fine at the base color and to save a little bit of file size since we're not using an alpha channel we can switch this just to RGB and then I can hit save as image next I'm gonna press seven within this view and switch to the roughness again the go image and then save a copy I'm gonna call this roughness and I've found that actually saving this out as 8-bit here is okay as well but if you are getting any weird resource I will be tempted to switch this over to 16-bit but I'm just gonna leave it as is and switch it to RGB and then we can click save as image and then I'm gonna press eight to switch over to the normal and for this particular material since it's quite rough and pretty detailed it's not what I always say like a clean pristine mirror like surface so I think for this we can go image and save a copy and save this out as tutorial normal map and just keep this as 8-bit as well and we're not using an alpha Channel of course and then we can save again when working with the height and saving this out you may find that we need to save as 16-bit or perhaps even as an open EXR and for that we can try a px our 24 but I'm not going to do that in this case for more details on that we did this article over on creative shrimp called the five most no tips with bump and normal maps and if we just check that out we'll see some more details about baking some of the problems with the different color spaces in the file types and just generally a couple of things to watch out for there all right so I've opened up into a fresh version of blender it's gonna resize the window is slightly delete this cube with X go shift a to add in a mesh plane I'm gonna jump over to the shading workspace instead of this general layout workspace and I'll collapse this window by just reaching to the top right of it left clicking dragged in towards the 3d view and then back into the file browser there and then letting go over here I'll find the material that was already by default given to us and then off screen I've actually got a little file browser with the images that we just saved so I can select one of these drag it in first the base color then the normal map and then the roughness and then we don't need that anymore and then to quickly set this up the roughness is simply going to be plugged into the roughness the base color will be plugged into the base color let's take a look from the top orthographic now so seven on the numpad just zoom in and then also for our normal map all we need for this is to just input this into a vector normal map node so the color to the color and then the vector out into this normal vector in we take a look around the viewport you'll be able to see everything more or less working however you may be able to see an unusual amount of darkness and this is due to the incorrect color space that we're using and so I'm gonna switch this to non color and that corrects that for us instead of using this environment which is a good overall lighting I'm just going to switch from this one by clicking on this little down arrow clicking on the sphere and I want to choose one where it's got quite a strong low Sun just to make the bump sort of work a little bit harder now technically the roughness map is non color data as well but if we switch that since we didn't gamma correct it as we did with the normal map it doesn't quite work correctly in blenders viewport there so we can just leave that happily as srgb it might be easier to just see this all in the same version of blender so much they're just going to go ctrl C and we've copied one selected object then I'll switch over to the main blender file where we they'll have all of the procedural notes I'm going to go ctrl V and a pasted one object in under our camera collection so I'm just gonna select it press em and let's move that to the road collection and move back up again this is a simple plane and then I'll just press G and then why move the mouse to about here left click to drop that into position and we can see that they look I'm very very similar now only of course this material that we're using the simple material it's just that and this is a whole collection of planes with loads of nodes doing fancy computational stuff and just to finish off why not just show that same material in something else external like Unreal Engine 4 in this case so with this I'm just going to create a plane by filtering it over here and then we can left-click and drag this in lift that up and after zoom in there and then in this section as we did in blender I'm just going to drag the file browser from off-screen onto screen here and just drag these in we can group these all together and do it in one go in this case though and then we have our textures using our base color I'm just gonna right-click this and create material and we'll just go with the default name is giving us double click on there and with this little material window that we have here I'm just going to click and drag this normal map into it and the roughness map into it at that point I can dock this by clicking on the tab and just putting it next at this or the tab and then from there we can just take the white out pin here and put it into the roughness and for our normal map you can see it's automatically been converted here the main difference between normal Maps in blender and normal maps in Unreal Engine 4 though is that in an Unreal Engine 4 we're gonna need to flip the green Channel now thankfully Unreal Engine does make that really easy so if I just come back over to the normal map itself in the content browser double click on it you'll notice in the details here on the right hand side that srgb isn't enabled which is correct it's non color data and we have this setting down here flipped green channel which we just need to enable you notice that flips in the view then we could just save that and exit that tab now and then continue setting this up so I'm just going to take this color out and plug it into the normal and then click on the apply come back over to the main tab here and then we'll take our material as it gets updated there and left-click and drag that onto our plane and then now we can just all bit around the view we should see all the maps taking effect there just make sure our snapping is enabled and then I'm gonna alt left-click on to this y-axis there and just pull out a copy just so there's a little bit of a longer road it's not necessarily designed to tile this texture at the moment but you can see it doesn't do too bad a job of that and there we go alright so again we have come to the end of the road let's carry this on into the comments below if you want to go into any further detail on anything and if necessary to help clarify anything we can add extra imagery on the main page for this tutorial over on creative shrimp or follow it on with another video alright everybody thank you very much for watching and I'll see you next time