Toon Shader Tutorial - Part 2 - How to Make Dynamic Outlines (Blender 2.8/EEVEE)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys I'm David from mining boy studio and this is part 2 of our tutorial series on how to make a real-time - trader inside of a blender to point this episode will be all about - not lines so there's a way to do it with freestyle but since we want to show you how to make a toon shader in real time in evey we won't cover it in this video instead I'll first show you how to use what is called the inverted the hub method and it uses the cell deform modifier to create the outline we've been using it on their project dino Mansour's as you can see on our character Fang here and it looks great but I sort of wanted to have something a bit more dynamic so I'll show you a second technique you can use and it's an outline that reacts dynamically to light it's pretty cool you can combine it with the inverted hole method so even if you know how to do that you might still learn something in this video now if you haven't watched the first tutorial I recommend that you do it now just because I explained some tips and tricks and shortcuts I use so I hope you guys are ready and excited and without further ado let's get started alright so we are right where we left off at the end of the last tutorial we have our sphere here are a two material and our node tree at bottom of the screen and let's see how we can start adding to not line to do this thing so first thing we want to do is add a new material for the two not lines so let's click on this plus button here and the material tab click on new and then click on principal psdf and we want to change that to an emission shader so you can either click on it or press on E to go faster and then let's change this to a black so now if we go to the modifier properties you want to add something that's called a solid if I modify and change the material index here to what so will tell the modifier is whenever they see this material and sometimes you have an object with multiple materials so you can have different colors for each outline so whenever it sees one material it would use the material that's one material slot after it so in this case it will glue it will use this outline material and so if I had minus one it would take the material before it so the way the saw the fire modifier works to make it to not line is it will create a duplicate version of your mesh and extended outwards and once you flip the normals you'll be able to just see the parts that are sticking outside so you need to click on flat normals first and it will turn out back and the reason is we need to turn on a back face culling on the outline material here otherwise what you're seeing is essentially the extended mesh but not flex so if you activate back face culling now you see only the faces that are sort of inside the sphere and you can extend them using the thickness parameter and by changing the offset you can tell material to either extend this outline inside of the original sphere or outside of it and if you make it zero it's gonna be dead center so you can change the thickness you can play with the clamp value it will create some sort of a thick and thin effect at the bottom and top here it looks cool in some cases some time it's not exactly what you want but in general you want a bit of it and then there's the vertex group here which you can use to tell the modifier to only use certain parts of the mesh shell I'll show you how it works if you go to the object data properties here there's a vertex group and if you create one you can make any kind of selection by going to edit mode and that's I'm going to select the top faces here assign them to my group you can call it solidify so if I go back to my my modifier here and I select the solidify group I can either invert the selection here and change the factors so I only use whatever selection I made so it can be pretty useful but oh and by the way in the latest version of blender for some reason there's a weird bug when you use the solid 5 modifier you see how the there's sort of a glitch effect here once you activate it and it used to work perfectly in the blender 2.8 and before but ever since they changed the shadow engine there's this weird bug happening and the way to fix it is to go to the to your outline material and to change the shadow mode from opaque to none and so not sure why it's that way now but it seems like the duplicated mesh created by the solidify modifier is a casting like self casting shadow into itself so it makes this weird effect so just change this to none and we'll fix the problem so that's it this is the in so called inverted the whole method works very well but as I told you I want to show you an alternate way of doing outlines which would be dynamically reacting to lights so as you can see right now when I move the light the outline stays up so be exactly the same so let's see how we can do this differently let me just turn off my my other lights here and just use my first light for this demonstration and I will go in my saw the fire a solidifying modifier and just change the thickness to something a bit smaller like this okay and now I will jump inside the shader enter so I'll click on my sphere click on my tuned material and then I jump inside my node group by pressing tab so this is the node group that so this is a shader that we've built in the last tutorial and we'll start adding more stuff to it so I want to create a new frame that will rename by going into the item tab here I'll rename it outline so whatever new node that we create that's related to our outline we'll place it here to keep things organized and the first two notes that I want are a so I'll press shift a click and create a layer weight it also works if you use a renown node but I'm going to use later weight for this tutorial and then I'll create a color ramp node oops not vertex color ramp so there you go place it to my outline frame and I'll connect the just make some space here so I'll connect the for now effect to the factor and whenever in general you want to see sort of preview what you're doing in the shader editor you can always just bring this group output here and plug whatever you want and you'll see what you're doing so right now I can see what I'm the values I'm changing on this color ramp so I want to climb the values to something very sharp that will look like the outline that we add with this all defy modifiers so I'll place these two values very close together and invert it so that the black portion is outside and okay so there you go and then I want to be able to easily change the size of these of the South lines so I create a new note that's going to be a math node and I'll change this to power either by clicking on it but you can press P to go faster and then if you change this value and you might notice it's going to change superfast so you wanna man you might want to press shift to change it by very smooth like smaller increments and so you can change the size of it here and the reason we want to be able to change the size is because we want to multiply it with the intensity of our light and the cool thing is since we're doing this inside the shader editor we can actually access the light intensity it's this red channel here because you remember our light is well our key light is casting this red color so if i duplicate this power node and change it to multiply I will take this red channel that's being cast by my light apply it here and I'll give it a value of let's say 12 and then I'll plug this in to my power so now if I move my light around and the further I push it you see the the smaller or the bigger line will be so it's restarting to be more dynamic like like we want so so you can change the the thicker part with this value here and you can change the thinner part with our solid five modifier because it still works together so you have this nice thick and thin effect the tax actually being influenced by by our light source so it's pretty nice if you want to come this over our our previous material what you need to do is um add a mix RGB node and plug it here at the end and we want to use this black and white preview here as our factor and we'll mix we'll use it to drive the black color of our outline and mix it with the result of your previous shader so now you have this color here that you can change to whatever color you want and and then you have the previous shader that we add underneath so that's pretty cool so it looks great on the sphere but it'd be great if we could test it on something a bit high resolution because facing ratio will always work very well in sphere but sometimes on things that are a bit more blocky the result is not always the best so let me hide the sphere and bring up this skull object here that's actually the helmet of her character Fang so how cool is that so I'll use this dinosaur element to show you some problems that you might encounter so as I move my light here on the side you see that you see how this black section here appears very fast and does it look like an outline and this is because this is a sort of an angular face on our model and it it looks a bit weird and might want to be able to tweak it a bit locally so the way we could do that is true painting a texture to tell just this region to calm down a bit and just reduce the outline so I will press shift 8 and create an image texture and I'll place it into my outline group here so this will be the mask that we'll be painting and then we want to add this value to our multiply because remember the higher value is and the smaller the the line will be so we want to add a value that we paint to this 15 value or whatever value we put here the thing is when we paint we're only going to be able to paint to a max of one because we'll be painting it black and white texture so we might want to have a node that multiplies the result of whatever we paint with a higher value so maybe four so whatever we paint instead of being one will be four and we'll be able to change this if we need to and then we want to add this value that we'll be painting to this 12 value that we have here that's being multiplied with remember with our red shadow from our diffuse psdf so I will not apply this duplicate it I mean and then change this to add and so I will add this four value to our twelve value and then I'll plug it here so painted image multiplied by something higher added to our our general thick outline that we want and then this is multiplied by the light and this will drive the size of it for now effect so all that's left to do is to paint the texture so let me find an angle that looks a bit weird like this so I will create a new texture by pressing on new and rename this skull mask and then if I go to texture paint click on em to bring up the tool panel and then you have skull to skull mask and then I can take your white color and sort of paint on this area here and as you can see right away I can just sort of fix fix the problem it's not going to be perfect but the cool thing is that I can really just change this part if I if I want to now so I can affect the thick outline wherever I want on the model in general and then if I feel like it like this outline here is too much where I painted I can just change this particular area and I can paint wherever I wanted my models so that's I think that's pretty neat so we might want to add our background lights now so you have your backlight and as you can see if you move the light now you have this very thin outline here that you can control with your solid defy modifier can make it sort of non-existent if you want to or just have a bit of an edge here and then if you move it to the other side it's gonna be super thick on this side and super thin on the side so pretty cool and sometimes you want your backlight to be underneath your outline and sometimes you want to have it on top so if ever you want to have it on top the only thing you need to do is to switch these two nodes here so this add node as you can see is what's being added for my from my backlight so right now it's being comped behind my outline I'm adding my on my outline on top so if I switch the order so I'll just plug this here my factor like this here you go there you go okay so now as you can see as my back light goes over my outline it will go over it which is pretty nice and the last thing we might want to do is add some parameters like we did before in the last tutorial to control things from outside the node group and inside the material and said so one thing we might want to be able to control is the color of my outline so I'll use my group and put to create a new parameter and then I'll rename it outline color so now I can control the color of my outline here and then I'll duplicate my group input and put one into my outline and so I'll create an attribute for call this outline - so this is the value of what will paint that would be removed and then this will be our general outline size and we want to input for our texture so I'll delete this texture for now and plug from my group input where I add my texture previously now I'll call this outline mask and then if I leave this note loop and go outside by pressing tab you have this outline masked thing I can plug things in - and then I'll bring up my image texture that I had previously my skull mask and I'll plug it here into my of my mask so that way I can reuse this node group for multiple materials and I'll be able to control things differently for each material and plug any texture that I want from here so as you can see I can control the size of my outline here and the size of the problematic area [Music] with this with this value here and change it color and everything so I hope you've learned a few things and I just want to say thank you to the 300 people that subscribe to our channel really appreciate it and I'm happy to see that if you're enjoying the things that we're making so I'm looking forward to doing the next tutorials let us know if you have any questions in the comments and I'll see you next time
Info
Channel: Lightning Boy Studio
Views: 234,423
Rating: undefined out of 5
Keywords: Dinomancers, Lightning Boy Studio, Le Gouffre by, le gouffre by lightning boy studio, David Forest Lightning Boy Studio, Official Lightning Boy Studio, npr Blender, Npr Blender 2.8, blender 2.8 npr shader, NPR blender 2.8, Npr blender, blender npr tutorial, Dinomancers Tutorial, Lightning Boy Studio Thomas Chretien, Lightning Boy Studio Carl Beauchemin, Free Toon Shader Tutorial, Best toon shader tutorial, Toon outline tutorial, Blender toon outline tutorial
Id: hp4V-9oFmnM
Channel Id: undefined
Length: 19min 20sec (1160 seconds)
Published: Tue Feb 04 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.