Animating Faces with a 2D Texture in Blender

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Applause] [Music] hey everyone today I wanted to share how I create different facial expressions for my characters using just a 2d texture like this one you can see a similar technique used in games like Animal Crossing or some of the earlier 3D Pokémon titles I'll briefly go over how I create these textures before moving back to blender and showing how to control and animate them so let's get started I'm using the same character that I made in my previous video and to start we're going to create a new material for the face so selecting the head I'm adding a new material slot duplicating our character material and just naming it face we'll then need to assign our face to this new material so if we hop into edit mode select just our face area and making sure the new material is highlighted we'll hit assign we won't notice any difference as it's still using the character texture but we'll be creating a new one for the face before that I'm just applying the mirror modifier that was on the head as not having things mirrored will allow us a lot more freedom when drawing facial expressions so now I'll create our face texture I'm just keeping the resolution at 1K and then I'm making sure to apply this texture to our new face material I'm opening up the side panel with n and changing the image to a color grid for now to help measure out our UVS and I'll explain why that's important in a second you'll see in front view I unwrapped the face using the project from view option and that just gives us a nice flat UV of the face to draw our facial features on I now want to fit these UV these nicely in the middle of the eight squares at the top left of our grid you can make sure you've got things right in the middle by opening up the side menu and making sure the x coordinate is at 0.25 so I just wanted to quickly explain why having your UVS nicely measured out on the grid is important for this method taking our UV grid and subdividing it like so if we imagine our current UV coordinates in the top left as 0 0 we can now easily snap to these other areas in increments of25 and by adding texture to this you can begin to see how this method works now that we have our UV set up I'm changing the image type back to blank and saving our texture so that we can begin to edit it I'm also going to export the UV layout which you can find under the UV Tab and this will give you an image file of your UVS so that you can easily see where you're painting on them now for creating these textures I almost always use an outside painting program as it offers a lot more control compared to blender's default texture painting I'm using clip Studio paint as it's my personal preference but you can achieve the same thing with similar programs like Photoshop or crit which is is a great free option you'll see I've dropped in our blank face texture the UV layer that I exported and also just an image of the character so that I can grab some colors from it to help us out I make sure to enable a grid and I have its settings set to 256 pixels which is exactly a quarter of our texture size now with all that set up I'm ready to start painting I won't be going into too much detail here but as you can see doing this in a dedicated painting program gives you access to a lot of helpful things like layers and the ability to quickly draw in shapes like this the transform tools can help us make small adjustments if things aren't looking quite right [Music] if you want to see how things are looking on the model you can save the texture and back in blender hover over the image and hit alt R to reload it make sure to hide the UV layout layer here before you do this otherwise you'll see those wireframes in the [Music] texture when I'm happy with my first face texture I pop everything into a folder and make a copy of it with my selection tools sna to the grid I can easily select the area within those top two squares and move them down into the next two since I've split things vertically into four this will be exactly 256 pixels away and with that you can start to edit your next face and continue making new ones making sure they're positioned equally across the grid so I just made four different faces for now and if we hop into edit mode and begin to move our UVS while holding control to snap it to an increment you can start to see how this is going to work now let's see how to set things up within the Shader editor so that we can control this so over here in the shading tab you'll see that we already have our basic material set up we'll want to adjust the coordinates of our image texture and we can do that by using a mapping node if you have the free node Wrangler add-on enabled you can do that by selecting the texture and hitting contrl T and you'll see the values we want to animate here are the X and Y location we'll want to set up a location for each of our individual faces and we'll do that by adding in some combined XYZ nodes I have four different faces so I'll be adding four of these nodes since my texture is split vertically into four we're going to be using increments of 0.25 with our starting position of 0 0 the next one down will be .25 the next one.5 and the last one 75 if there are more faces on the right side of the texture we'll need to adjust the x value as well in this case to.5 plugging these into our location you'll see that we have a setting for for each individual face now we need to create a way to switch between these and we'll start by combining them all together using mix nodes make sure to set these to vector and plug our first location into the a socket and the second into B duplicate the mix node and plug the previous one into a and our third face texture into B and just repeat this for the others you'll see that we can now switch between these faces using these values ideally though we just want one value to be able to control all these and we can do that using some math nodes but don't worry it's not as scary as it sounds first we'll bring in a value node which will be our main control bring in a math node set it to greater than and change the threshold to one plug the output into the mix node and our value into the value so just as it sounds if our value is greater than one it will switch to the next texture we can then repeat this with some more greater than nodes and if we set their thresholds to two and then three as we adjust our value again we'll start to switch between all of our textures and and with that we have the basic functionality set up at this point you could start animating by just key framing this value and if that works for you that's great but I like to go one step further and give myself the ability to control this value within the character's rig itself using drivers and I'll show you how I set that up now so I'm going to add a new bone to the Armature with shift a and I'm going to bring it up next to the head and rotate it on its side I want to have the bones Z AIS facing up and if we enable axes under viewport display we'll see that it's pointing downwards and we can fix that just by changing the bones roll to zero I'm then just going to rename this bone to face select moving back to the shading tab I'm going to assign this new bone to its own collection just so we can hide the rest of the Armature for now so going back to our face material we want to control this value by moving our bone and we can do that by using drivers right click on the value and select add driver now if you've never used drivers before this might look a little intimidating but all we have to worry about is selecting the object we want to use which is our Armature and specifically the face select bone we then want to use the bone Zed location in local space now if we go into pose mode and move our bone up and down you'll see that it's working as intended although you'll notice we have to move the bone quite far to reach all of the faces we can fix that by making just a little adjustment in the driver right click to edit driver and under expression we'll want to multiply the variable by something like 10 and this will make the distance between our values much shorter now with all that working there's just one more optional thing I like to do Under The Bone constraints tab I like to add a limit location and check both the X and Y values and set it to local space this means no matter how you grab the bone it will only ever move up and down on the Zed AIS you can also include the Zed AIS in the limit location and give it a maximum value if you want it to only move within a certain range so the benefit to controlling it this way is you can now animate your character's facial expressions in the same way you would the rest of the character and to me it just feels a little more intuitive than going back into material and key framing a value there one last thing I wanted to share is if you wanted a little more control by having the ability to change both the eyes and the mouth separately you can do so quite easily first I'll create another material slot I'll duplicate our face material name this one mouth and our previous one to eyes we'll then of course need to assign just the mouth area to this new material to control this we'll just duplicate the select bone we made before rename it to Mouse select and and our previous one to iselect and making sure we're in the mouth material slot we can just edit our driver and change the bone to the new mouth select and just like that we have separate control for both the mouth and [Music] eyes thanks so much for making it to the end this of course isn't the only way to animate with 2D textures just my personal favorite method I'll link a few Alternatives in the description below thank you for watching and supporting I'll see you around [Music]
Info
Channel: lacruzo
Views: 73,490
Rating: undefined out of 5
Keywords:
Id: E96m9Z4iTcc
Channel Id: undefined
Length: 12min 52sec (772 seconds)
Published: Fri May 10 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.