Procedural Fabric Weave - Blender Shader Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so i've just got a file here just with a plain just a regular default plane and i'm in ev so this is gonna be a uv map because if you're ever doing furniture or upholstery in this case you're always going to be able to want to unwrap so we're starting there and then every procedural shader needs to start with vector math scale just to make sure a nice control for the whole shader because we are going to need to scale down at the end if this makes sense so uh your images that you map to this are going to have a uv space of 0 to 1 in x and y and so if i multiply this by 20 right now we have a space with 0 to 20. so your texture is going to be repeated so we are going to want to finalize the shader with a divide so in readiness let's drive the scale with a value say something like 10 just so we get a good look at what's going on the next thing we're going to want to do here is separate xyz there we go so to get the offset pattern we need to add one to every other row so to do this we can take our y gradient which is the upwards one here and do a math modulo at two so now it's going to go zero to two zero to two zero to two and then do a greater than one and that just gives us that black and white mask we can add this now to our x values so now our x values every other row is being offset because it's adding it it's essentially pushing it left so now if i were to modulate this one at two you can see that we have that pattern instead of modulating we're actually going to use a ping pong just it's going to do half the work for us so we're going to ping pong at one and that's just going to go zero to one to zero to one to zero but the so the wavelength here is going to be two still all right so that's how horizontal we've sorted let's grab another ping pong just stick this on to the y and we need this to pinpoint 0.5 so that we can have the same uh the same row width and to make sure that we're going up to the the same values we're gonna just multiply this by two so multiply by two there we go so now we have zero to one for each row and zero to one for each stitch horizontally there's one more thing that we're going to do to these and we're going to be pulling out the in-between threads so it's like the warp and the weft isn't it so you've got the where we have these black lines on our horizontal ones these we want to basically use these as our vertical lines so that we have these offset sections in between each one of our big big lumps here so to do this we're just going to use a map range converter map range plug this onto the ping pong like so and from our from min from max is going to be 0 to 0.1 so that's just clamping right in there and then we're also going to flip it so our two main two max is gonna go one and then zero and that's just going to give us those verticals so we'll do a little bit of work on the shape of these once we have when we're working on the actual displacement just for now let's start having a look how we're mapping so where we're doing this ping pong just in parallel so i'm just control shift d to bring that out sideways there i'm going to switch this over to snap snap there we go and i'm going to snap at 2. so now we have this offset constant value and we're going to take another one i'm just doing underneath so i have my x and y still in order we're taking our y values here the original y's from a separate and you can snap at one or just floor is going to be computationally a little bit easier so there we go these are our x and our y values for the texture mapping and then we can just join these together so combine xyz join those up like that this is our big map right now these are the 0 to 10 values because we multiply at the beginning so we are going to divide at the end converter back to math divide and let's just do join this straight up so that gray can go into the purple just fine there and that's giving us the texture we want now this here we go this map range this is just going to be for coloring so we're not going to worry about mapping a texture to these lines unless you particularly wanted to because it's such a small detail right you can just mask on the color afterwards after you actually have the texture on there one other thing i think is worth doing just based on your references is squeezing this in because right now all of our stitches are two times as wide as they are long so to do this we're going to do essentially the same kind of pre multiply post divide but in this case instead of doing the scale here we're going to be doing a multiply at the beginning we're going to use a combine xyz just so that we have our value okay i'm just putting that on top there and let's set this to one to begin with and because we're doing this we need to do it the same at the end so just before you look at it like brackets right so the first scale and the final divide and now we're doing this scale and that divide so this is happening inside here so i'm taking this divide duplicating it bringing it back this can bind xyz up and forwards okay so at the moment nothing's happened see daisy at the moment nothing's happened because it's all just one it might combine xyz but if i start increasing my x then you can see that we're doing something there so i'm gonna set mine to three maybe four i think three looks good okay so now it's taller than a is wide which i think looks close to the reference cool so this is our coordinate output i can put a texture on here now so let's grab a an image texture node open our image texture and i'm just gonna use this one so this image texture that i made here is literally one pixel high you don't need any more than that really because it's just going to be stretched vertically uh we can set this to closest and that's going to get rid of any weird weirdness going on there looks really blocky this is just because our general overall scale is very high um very low here so if we set that to 200 weirdness going on there looks really blocky this is just because our general overall scale is very high um very low here so if we set that to 200 then you can see that we're getting that effect a little bit better there let's just go for 20 at the moment just while we're doing this okay so if you wanted a bit more control of your image then you could add a mapping node as well so i'm just going to ctrl j put those together here so what about our in between threats well let's create a mask so wherever this map range is greater than zero because this is a gradient so we just want to know where it is greater than zero there we go and we're going to use this with a color mix rgb which i'm going to stick after the texture and i'm going to use my greater than on that mix factor and now you can see that we have these lines so now you can pick whatever color you wanted to give that kind of yarn yarny color now let's have a look at our actual displacement so we're going to grab a vector displacement node plug this in and i want this to be now shaded so that we can get some shadow so i'm just going to temporarily add a diffuse node just because i'm going to leave this as a kind of mid gray just while we work on it jump into cycles so that you get displacement i've just turned off the scene world there just to make it a little bit brighter without having to bother putting in an hdri we need to add a subdivision surface simple adaptive and that should do it obviously if you're if you're working on bigger items so for the cushions you're going to want to have one you're going to have one which is the one that you see which has an adaptive subdivision and you're going to have one which creates hair fibers on top of it uh maybe i'll do that at the end actually just to show you how we do that i'm just saying that because you can't have a modifier after your adaptive subdiv if i add anything even like a collision which doesn't really do anything to the geometry you can see that that gets rid of the adaptive subdiv just on the one that we see needs to be adaptive subdiv so that we can do that and then n options settings here we go let's turn on displacement and bump in our material now cool let's start mixing this up so we have our ping pong if i just plug this into my height and i'm going to change my mid level to zero and i'm also going to change my scale to something a lot lower so this is another reason to have our texture scale off to the side because if i made this texture much much bigger for example like going up to 10 i want this to be twice as displaced and the way that we do this is with a math node take your texture scale into the second input the second input here and then we're going to set this to divide so now as this number gets higher the divide output is going to be smaller so basically the more texture we can see the smaller these end up displacing it's inversely proportional so now this divide becomes the texture sorry the displacement scale all of these are really peaky we don't want that we want these to be nice and round so we can use rgb curves of color rgb curves throw one of these on here and we can just do something like that uh we actually want this horizontal one to have a little bit of a dip in the middle so that we can take that middle thread so we can use rgb curves of color rgb curves through one of these on here and we can just i'm going to use something like that with quite a fast fall off there cool and then for my these ones these vertical ones we need to multiply these two together which will go like this and that's just going to join them but now we see that in this angle we're just going zigzag so just make it easier for us to see what's going on so we're going to stick another one on here this time we don't need that bottom flag just because we can give it a nice quarter round here and that's just gonna bring each one around so this is why we needed to make sure this was a zero to one range why we did the multiply because when it comes to the rgb curve this is a zero to one so now if we have a look at this this is our multiply output and this is the current height map so now we can see we have a little lump for each thread a little bit more here because we want to add these threads as well so we're going to use a color mix rgb set this to lighten so this is just going to put the lighter color on top which for this is going to be that new thread so put your new thread into the middle there and come back to our diffuse here so now we can set the factor on how much that's going to come up so if you do need this to be super accurate then we can basically put this rgb curve let's duplicate this one so this is this one right coming lengthways here if we put this onto our frames there then you can see that our map ranges now get that same loop going over sideways and i am also going to multiply this shift d there so what i'm doing now is i'm just basically controlling the lengthways falloff of these sort of warps here so you may wish to have these ones a little bit more i don't know curved it depends yeah it depends how close you're getting and obviously you can set the height on this lighter node here okay something like that is probably adequate uh if you want control over how much gets multiplied on each of these then you could set these to mix rgbs instead and then you can see you can have a little bit more control over whether these come all the way down and then if they don't come all the way down you can have your your weft your warp these other ones these little skinny ones can kind of stick in there maybe that looks a bit better actually i'm going to go with that so instead of using this uh this second one here i'm just using a multiply in the middle we're just going to balance these by hand this one can come down to about 0.5 they'll lighten i'm going to leave it 0.8 cool hopefully this isn't too much spaghetti so it's still making a bit of sense and i'll make sure there's like a high res no tree feature we'll look at separately as well alrighty then let's leave this here so now i want to add some we're going to do a little bit of like thread kind of stuff i know you don't really get much of a view of this because at normal viewing distances you're quite far away but sometimes you may see a little bit so it can be nice to do let's just use a wave node so texture wave texture and where can we plug this in just to this original multiply and if we set this to diagonal then it's totally fine kind of how it wants to be there about 1.2 something like that we can add a bit of distortion not too much distortion and that's probably fine okay let's start adding a bit of randomness to this and then we can throw the whole thing together just try and make stuff visible so randomness we already have a value per thread which is great so we can just stick a white noise node on here just throw that on here i'm going to set this to 2d just to make it a little bit faster and then we're going to use a separate rgb on the color and this is just going to make sure that we have three different noises this is important because we're going to do different stuff with them and i don't want for example if i make the threads lighter at one point then i don't want them also to be the same ones which get less displacement it's just quite important to make sure that we have different noises to do different things let's take another mix rgb here just before the displacement node and we can just set this to multiply so if i have a higher value then it's going to be kind of squished down uh maybe i actually want this before the lighten i do so before the lighten on that first main input so this is the one that comes out of the threads this is the general large thread just because this lines up to the large threads otherwise we're going to have a divide exactly on that little thread in the middle if we put this before like this then we get to cover that with the little thread so now you can see if i increase my multiply there then we get different uh different values and what that means for the displacement is some of them get displaced more some less so you can play with your multiplier here to get random displacement amounts let's go for something a bit subtle 0.5.6 should be fine uh we've got a few more here let's grab our g our green so this is just another white noise let's plug this into the phase offset just make sure that these don't all that do anything did a little bit let's make this bigger then so we're going to multiply this by just some big number so just to make sure these feel like they're different right okay we still have our red channel that we can use and we're going to throw this one onto our texture so let's use a color hue saturation so if we inspect this what i'm going to do is i'm going to increase the value a little bit and i'm going to decrease the saturation just so that we get a few of these white ones and i might also change my hue to like 0.48 just to kind of tweak it around the color wheel slightly and now my factor is going to let me switch between that so if i was to plug my red from the white noise which is our last white noise here plug this into the factor and now you can see what's going on there so that's basically randomizing how much of this hue saturation is being sort of inflicted on the color i don't want this uh kind of constant thing here so let's tweak it we're gonna use a converter color ramp on here so color ramps can be really good for stuff like this where we can have a little bit of extra control so i want most of it to do almost nothing and a little bit of it to do a lot right so we have a few threads at the top and uh there's some variation in all of it but it's just really the ones right at the top where you're getting a proper effect of that so i'm just squishing two flags up here at the right hand end and the sort of the middle one is just a very low value here 0.02 that goes into the factor you can see that and then this is our color add those threads back on and there we go let's get rid of this diffuse let's add a shader principle bsdf here we go so we're getting a bit of something here we can turn our specular down uh no wait speculate up roughness up so it gets a bit of a sheen and we want a bump map as well so bump our thread weave here this can be something super low 0.001 wait maybe 0.01 there we go 0.01 should be fine there i want to add a little bit of variation to the surface actually while we're just here let's stick the height map onto the color as well so just at the end here add another mix rgb set this to multiply we're going to find our height map which is here and we're just going to stick this in what this is going to allow us to do is fake ambient occlusion so it's just going to pretend that there's a bit more shadowing in the gaps sometimes with your displacement if you're a long way away from something then you don't actually have so much displacement or you know even if you're just in eevee and you actually don't have displacement then this is going to allow you to kind of fake it a little bit by adding some fake shadows into your color let's go with something subtle just because we do actually have displacement so let's add a little bit of wiggliness to this it's all very straight looks like it's been made by a machine so we're going to come back make a bit more space at the beginning here i'm going to join these two together just on this thread after the multiply we're going to add two nodes we're going to add a mix rgb set to linear light and then we're going to add another mix rgb set to linear light so turn off the first one turn off the second one and then what we're going to do is we're going to add some noise nodes texture noise node and i'm going to plug this in not on the second multiplier because this is compressed horizontally i'm going to put this into the first one and just into that scale and i'm going to turn off the detail just so that i have this open pattern and i'm going to make this really big so 0.05 or something like that i'm going to take my color plug that into my linear light and that is going to give me some variation if i come over to my end here and i increase this you can see that we're getting that kind of torsion across the surface if i increase this up to like 30 and you can see we're just basically tweaking kind of like the tension is changing right you could make this a bit bigger 0.1 if you want to be a bit more pronounced and we're going to do the same thing again so just ctrl shift d to duplicate that and i'm going to plug this one into my second linear light this one is going to be a bit higher scale something like that let's have a look at our output again and increase this so my goal here is to make the individual threads different sizes so let's maybe increase the detail but i've got two i'm just trying to make it look a little bit more broken up we don't want these on full the idea is just give them a little bit of a push but not to actually make it look bad if you don't think this is affecting enough you can always add a scale node to it so let's just stick that on there and you can see you can have a really big effect on this so if you'd set that something like two then it's just gonna give you a little bit more a little bit more push you probably don't need it generally for like tension i would recommend just sculpting your fabric you know if you're doing cushions just sculpt them or simulate them so we have a little bit of variation here i'm actually going to take this first noise texture let's just bring it down and along we're going to add this into the bump there we go so we've still got this noise here i'm just going to come up and join in the bump and it's going to be just multiplied in with this i'm actually going to put it in first we can go from just having that to having that and our threads and that's just going to give us a bit of a bit of control over there all right this is looking pretty good so far i wonder if there's anything else we need to do to it maybe stick it on a cushion so let me just save that and let me append there we go so this object does not have a subdiv so let's add that make sure it's adaptive it's going to give us the proper coverage and let's turn up our scale here so we've got 200 interesting okay i was getting confused why this is just in straight lines and it is because my uv unwrap is below the uv space with modulo anything which is below the uv space is just it's not really going to work so make sure that you are inside the uv space and there you go there we're going to get the offset so i've done something wrong so let's turn this up here 500 it's giving us a bit of space you can see all of these paler threads which you can tweak the amount of on this color ramp up here so we can come along to the end there and i can just maybe move this up a little bit take out some of those odd ones but i may slightly increase that value just to give us a bit more variation in the main bunch let's just add a little light i just want to get a better sense of what this looks like so i don't think this is displacing enough so i'm going to use this divide to increase the displacement amount let's have a look at what it looks like on one i don't actually know how coarse these fabrics are so uh apologies if this actually looks terrible and we can always add a little bit more darkness into those if you need more fake shadowing there we go and again if you want more consistency then you can set these like so your adaptive subdiv by the way the amount that is going to work it's on your render tab under subdivisions you can set the viewport amount i'm going to set mine down to one just so it's slightly slower but it'll be more accurate nice i think that's looking all right so you have a fabric now which looks all right hopefully let's say you want to put on some actual threads you know you want it to feel like it has actual fibers coming off it what we said before about not being able to overwrite this adaptive subdiv thing that's kind of a real issue here so we want to duplicate this literally just double up our whole model make sure you rename it so i'm going to rename this one to cushion hair and we're going to jump across into particles so i'm going to turn off adaptive subdiv in this one and just give me two levels go into my particles add a new particle system change it to hair and um we need to go into render turn off show emitter if you turn off show emitter you won't see the cushion or whatever it is that you've made you'll just get the hair as you can see because we have this particle here we don't have any option for adaptive subdiv so this is why you need your base one to get the adaptive subject for your threads to look good and then a different one for the actual particle sim okay just to save my computer i'm going to go into solid view so you can see that we have overlapping meshes here so under the we just turned off the show emitter for the render let's also do it for the viewport there we go so you can see it's still a separate object but we just we don't see the cushion so we're displaying is rendered our render is a path it's important we're going to turn on advanced and we're going to drop the hair length to zero and we're going to go into the physics here which is why we need to be in advanced so into the physics set our browning to something quite low even lower than that 0.02 because it depends how long you want the hairs to be and then we're just going to drop down here into hair shape root diameter and tip diameter and we also have the diameter scale so if we go back into rendered view we can see these are much much too thick so we can drop our diameter reach down to 0.1 maybe we just want these to be hairs you know just thin hairs and let's add some children let's go for interpolated children you can just have a play basically with trying to get their flow to look right i'm honestly not too sure about how particle sims work i've never really got the hang of them but i want to try and split these up a bit these might do better even shorter 0.01 just to really pull them back and i might also want to make them thinner still so back to the hair shape 0.05 something like that and you got to watch out making them too thin because if they don't show up properly and you render and they get denoised it's just gonna look real muddy so let's just add a camera in here and just see what we can get in a render okay we seem to have made a very woolly cushion much much too wooly so we're going to hit escape cancel that and we're going to just drop our hair amount really really low so let's go back into our hair settings here we're going to drop our number to 500 and our children to 20 for the render amount maybe still too many but you get the idea might have too much displacement and a bit too much of a bump strength but from you know from a normal distance it looks kind of okay probably get away with a little bit more on the linear lights as well just to push them around a bit more i'm going to jump into the physics here okay slightly lower maybe i should do this on the children so my child length a bit lower here 0.6 and i might just while i'm working on this increase my viewport distillation to two pixels just to save us crashing so i'm just distorting those a bit more and then i'm also going to turn down the this multiplier on the bump because this one controls the amount on there oh actually one thing that i forgot to do when we turned on displacement we turned on displacement and pump we actually want displacement only if you have it set to displacement and bump it may still keep the bump data from the faces whereas displacement only i generally find gives you cleaner mesh rounding across the subdivision that's just something to be aware of set it to displacement only you'll still get the bump mapping it just won't be taken into account your displacement okay you can see that we're still getting that there i'm just going to turn these down a little bit 0.05 maybe yeah that'll do us alrighty then
Info
Channel: Erindale
Views: 8,851
Rating: 4.9950619 out of 5
Keywords: blender, shader nodes, shading, beginner, procedural, material, nodes, shader editor, introduction, tutorial, eevee displacement map, eevee displacement node, blender pbr tutorial, blender pbr textures, blender pbr textures free, pbr textures in blender 2.9, Blender 2.8, vfx school online, blender tutorial, blender eevee, blender enviornment, blender easy, blender easy tutorial, blender cycles, intro to blender, blender 3d, b3d, learn, free, concept art, parametric, computational, design
Id: _zmhsVqBwTg
Channel Id: undefined
Length: 29min 3sec (1743 seconds)
Published: Tue Sep 07 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.