[Blender 3.1] Eye Rig SLOW AND HARD tutorial (30 minutes)(geometry nodes)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
easy eyeball tutorial 90 seconds blender eye tutorial easy simple fast nope we're gonna do it the most complicated way possible but the result is that we're going to be able to completely change the size of the pupil such as the iris can completely disappear or that the whole eye can completely disappear you'll be able to change the iris depth the iris size uh the iris to turn it into a slit you'll be able to change the size of the cornea the depth of the cornea and everything and in the end you just end up with a single object and all the controls will be inside the modifier so pretty clean as well let's hop right into it this is blender 3.1 better i'm just going to spawn in a uv sphere and in edit mode with all points selected i'll just rotate them 90 degrees on my x-axis and i will then delete all of these front-facing faces and then i'll select this edge loop i'll click right-click extrude edges then i'll press s 0.001 and that will essentially get all of these words to be super close to the center but not quite overlapping at zero and i'll right click again and click extrude edges but this time i won't move them at all i just want this next set of edges completely overlapping the first i need to select all of them so i'll hop on to the other side and press shift z and with one i'll select all of these words make sure i have increment snapped with absolute grip snap so that i can put them back at the one meter mark this is important okay then in my joint node setup which might look different from yours i just need to make sure i have a geometry node editor open i'll click new to actually get the geometry nodes and let's just look at this eyeball from this side like this from my orthographic view with alt and middle mouse button and if i was to draw that i would get this cross-section representation if i just take the top point for example its position is relative to the object origin which is currently in the center of the sphere right and its position would be something like 0.01 like that's the z-axis and it would we can think of it as a vector that's starting from the center of the eyeball so it would go up like this just a solid vector let's talk a little bit about cross product of two vectors so if i'm looking at a flat plane with two vectors that are on the plane and are perpendicular to each other then the cross product of these two vectors would be another vector that is facing me essentially going towards the screen or if i see this in the 3d view these would be the two initial vectors the third one would be poking up just like that so if i take this vector and then a vector that is pointing away from my iris remember this is my iris right here like on this side this is where we did all of those deletions because it's going to be our iris in the future then if i take the cross product of these two vectors this would be another vector that is facing me and then what i can do is i can rotate this vector which is just the position using this new vector as the axis of rotation essentially rotating it this way just like that to anywhere in this case if i want to rotate it all the way it would be over here and that would be a 90 degree rotation and this works for any point so point over here we just get this again going all the way or as much as we want over here and in 3d space for example a vector over here would probably rotate just like that arc the way we wanted to so let's go ahead and do that with a little bit of vector math so vector math node set that to cross product and what we want to use is our position because as we said that is basically our vector while over here we're just going to set y to minus 1 because that is the away facing vector i don't think i wrote that down but basically minus 1 on the y so i'll take the cross product of this vector and then i'll plug that in through a vector rotate as the axis right and then the vector i'm going to be rotating is this position yet again and to actually move these things i will use a set position node but i will plug the result into position now if i change this angle you're going to see that outwards are indeed moving in a sphere however they are moving the same amount and i don't want that basically i want words that are over here very close to move very little well words that are very far to move more essentially i just need their length but not just like the straight length between them but rather the length of this arc right here we can call that s for example and how am i going to get the length of this arc well if i hop over to wikipedia circular segment you see that this s we can actually get it if we scroll back down a little bit s is equal to theta times the radius not theta is just this angle right here that is theta while the radius is one so we don't really have to worry about it because when you multiply by one nothing really changes and radius is one because as you can see we have a unit sphere right here all the points are exactly one meter away so how am i going to get this angle well in order to get this angle i would need to use the dot product so what is a dot product between two vectors if i have two vectors that are the same length and are perpendicular to one another they have a dot product of zero if they are away from one another that's dot product of minus one and if they are facing one another overlapping right here that's a dot product of one so a minus one over here one zero and as you can already see uh this dot product actually has the angle between these vectors somehow like embedded into it uh but how are we actually going to get this angle well for that we just need to google.product2angle and you're going to see right here on this image that it is simply the arc cosine of the dot product divided by the magnitude of the two vectors multiplied now the magnitude is just their length and as i said all points are one meter away so this just cancels out because they're both one and then that means that i just need to get the arc cosine of the dot product so let's go ahead and do that in other words what i would need to get is another vector map set that to dot product and i'm going to get the dot product of the position and again this backwards facing vector and then this is what is going to be driving my angle however i do also want to pass that in through a arc cosine remember that so get arc cosine and then another math node in order for me to actually control this value and now you see whenever this value is one the eyeball is completely gone when it's zero the iris is completely gone and we can control that i'll hold shift to move it more smoothly there we go so that's basically the movement of our pupil done i'll leave this to something like 0.5 and let's talk about the iris currently the aries is moving along with our pupil i don't really want that so i'll just have to mask it out from this movement now remember the iris is currently the only edge if i reduce this quite a bit imagine this is the iris currently the iris is overlapping with this last edge remember how we did that extrusion in the end and the iris is the only edge that only has one face connected to it so i can use that property to mask it out if i get the edge neighbors node which actually gives me the face count connected to each edge i'll just plug this in through a matte node where i will say okay every face that is greater than every edge that has more than one face which is all of these except the iris is what's get effect getting affected by the set position and if i do that now you see that our iris is back essentially you can see that right how it pops out before it was overlapping with these edges and now if i start to move this uh once again my pupil you can see that the iris is staying input or what's about to become the artist and at this point you can just get a group input and plug this value for the pupil outside and if i click it and right here i can set a minimum and a maximum value i go into my modifiers you can see that when the value is one it disappears when the value is zero it's right there so i will just call this pupil size and that's exactly what it is going to control so about the iris well to move the iris it's not that complicated it's just another set position node and remember this mask is for the iris uh but it gives me currently all other points so i just need to flip it and to flip that i will just use a boolean mat set to not which exactly flips a zero to one value uh to make it one to zero so now i can test this out if i move this on y you can see my iris is indeed moving uh however i just the first thing let's talk about scaling because currently the iris is a bunch of points that are in a circle that are very close together in order to basically i want to move them all outwards and currently if i really zoom in you will see that their position is already sort of in the way we want if this is my eyeball right and over here are the points of the iris well their position relative to the object origin is just a a bunch of vectors that are going like this right but if i flatten these vectors on the y axis then certainly uh they're going to become uh if i flatten these vectors out they will suddenly become like this in other words bulging out in every direction in a circle or if i'm looking at from the front they would really be going in every direction so we need to flatten this on the y-axis and to do that i'll just take their position plug that to a vector map node which i will just set to multiply and set these to one and flatten the y axis to zero all right so then if i just plug this into the offset you see that they flinch a little bit that's because we want to normalize these vectors currently i've flattened them but their size is very tiny and if i normalize a vector what that means is if you have two vectors with different sizes one is too big one is too small like zero five and one point five then once i normalize them they will keep their direction but they will both have the same magnitude also called length sometimes uh one and i want to do that so i'll just duplicate this node and set it to normalize and then if i zoom out although what i need to normalize is them after they have been flattened you will see that now they go out one meter away exactly and that is great and i why i might want to control for that so if i can just scale it right that would help me however i actually want to move the x and the y independently so to fix that i will just use a separate x y z which will take this vector and separate it into three components and then i will use a combine x y z which i will plug the x in directly the z indirectly and the y out just set to zero and what this means now is if i plug this into offset and i just scaled this vector after the normalize with another scale node and now we can see how this is going to be our control for the size of the address so i'll just get a group input plug that out call this bad boy iris size and i want this to go from zero to one and you can see how one is a one meter size of the rs0 completely overlapping all right and for the y that would be just this y right so i'll just plug that out directly and i will call it iris depth and now i have a control for the depth of the iris for the size of the iris and for the slit of the iris what we actually need to do is just multiply this x because the x as you can see over here goes like that so that is just the math note set to multiply if i set it to zero that would completely close that slit and one you can see gives us this kind of opposite effect so i would also plug this over here and i would call it iris slip which again zero to one and whenever it is one well currently it's flipped so i would just pass it to a math node in order to flip it back uh by subtracting it from one that will flip the zero to one value and now when it's zero no slit when it's one we have that iris slip at this point we're actually done with the majority of the work i now have a control for the slit i'll probably disable that i have a control for the size of the pupil such that i can make it completely disappear if i so wanted to and the control for the depth of the iris so i'll just set this up to look semi-normal so probably push it out like this i'll give it a pretty big area so you can see what's happening so let's talk about the cornea uh how is the cornea actually gonna work it's not too complicated for the cornea i'm going to go into edit mode and then i'm just going to shift a to spawn in an icosphere with a pretty high resolution something like 4 and this is going to effectively be our cornea now i do want to mask this cornea away from both of these transformations and i can do that using the mesh island now the mesh island actually gives me unique number for every connected series of faces basically and i know the ico sphere which is going to be my cornea is a separate mesh from the rest of my eyeball so what i'm going to do is the islet index starts from zero so i can straight up use that as a zero and one for my cornea and for the rest of my eye and i just need to combine it with this rule over here using a boolean math so i'll just get a open out of mullion a boolean math let's first try to get it right over here however i will just plug in the island index okay see it's flipped i'm actually moving the icosphere so in order to flip it back i will have to pass that through a knot and now i am changing the size of my pupil but the soon to be cornea isn't moving so how do i actually make this cornea go out a little bit because i know now that this straight up gives me a selection for the cornea what i can do is just a set position that uses this cornea selection which is just the island index i can test that out you can see that only moves our cornea i'm going to use the y position of the cornea as the map for the movement so get position and real quickly separate x y z and then combine x y z again plug this in and what i really care about is the y so currently the y goes from minus one to one so i'll just do a map range where i will take this y value that comes in from minus one to one and i'm going to use it to push on the y again okay so if i plug that into the offset what i should see is first of all everything moves up but if i bring in this minimum value we're mapping from uh you'll see that we're sort of changing how far the pushing starts okay and then if i bring this to maximum value that would be the strength of our push essentially giving us a cornea all right for a different result you can also go to smoother steps you can see how that affects the shape of the cornea i don't know which one looks like a more realistic cornea so i'll just keep it on linear for now uh and the problem is the corner is currently overlapping with the rest of my eyeball so i'll just do another set position where i will move all the faces um away which just move which just means uh moving them in relation to their position on the object axis because remember the where did all my drones go to yeah remember the position of the pawns is already a vector that is going in the direction we would need if you want to push these corner parts away so i will just use the island index as the selection once again and i will just move them on the position you can see how that blows it up and what i would just need to do is vector map to scale this bad boy down so zero would be like that and i'll go to the front front view press shift z and move it out as much as i feel looks good something like that of course you want the control for these things so again grab a group input uh i will get this to maximum well first of all the from minimum which is sort of the cornea size and also this two maximum which is the cornea push so how do we set up the materials well in order to if i just give the default material right now this would probably be applied to all the faces uh but to make things easier i'll just have this be the iris material which currently is applied to our faces and i'll make it something that we can tear it apart like red if i go into my shader preview there we go then if i go into edit mode and i'll just select all of the or disable the modifier quickly and i will make sure to select all of the ico sphere points with l i can straight up go into the materials and give them another material i'll assign it to them right now and we will call this cornea which would just be white with like maximum transparency maximum transmission minimum roughness just like that we definitely want if we're going to be using ev to have uh screen space reflections and i will assign this to the corner you can see it now if i have a press h i will hide that and then what i'm going to do is i'm going to select all of these faces on the outside which are basically the faces of our i think it's called the sclera why can't i select these there you go so if i add another material assign this and just call it sclera and then just make sure that this is a material that doesn't have any transmission if i go into edit mode then alt h to unhide everything if i just enable the modifier definitely want to give it a shade smooth for everything uh how to actually see inside the eyeball i would need to go into the ev and go into screen space reflections turn these on also turn on refractions and now we can see that we're basically there either is depth a little bit rather the iris size however it looks like two of these words i missed i didn't apply the correct material to so i'll fix that by disabling this selecting all these pressing hide and i know that these words are just the ones over here so face back shift z to select all the words that are here and then i will assign the red material again i hope this works there we go the rest of this tutorial is really just making sure the materials look good so in my shader editor i have my arrows selected i'm just going to use an image texture so i will link these textures in the description they're very great textures uh just plug this into base color uh you can see ah uvs i totally forgot to talk about uvs so if you actually select all of these points that are currently well first of all let me disable the modifier so if i have all these points at the center selected remember shift z drag from the other side uh if i just go into my uv editor and i press from the front well looking at them from the front with orthographic so out middle mouse button i press u for uvs and i just do front project i'll get all of them right here sort of in a circle i'll just uh select edges so don't press two alt left click to select one of these edge loops and then just extrude out until we can sort of see it until it sort of encompasses one meter and then i'll select all of them and go to uv back islands to make sure we're using the entirety of the space uh and you can also extrude these ones in the middle if in fact you definitely want to do that so i'll just go to the middle and i'll start extruding until we get something sort of like an eye if i re-enable the modifier i need to just enable the shader editor and then i'll just eyeball i get it eyeball this until we can sort of see everything correctly this looks fine to me see now we have our eyeball what really bothers me sometimes is the cornea so i want to wait to kind of hide that sometimes because it can mess me up in order to hit that i'll just go into my geonod setup and i'll just use a delete geometry where i'll just delete the sclera which is just remember our island index number so definitely these spaces right here uh however i don't want to always have it deleted so i would just use a switch i'll plug that into here this would be one of the situations and now i can turn it on and off and if i get a group input i would be able to control that from my modifier as well so sclera i would probably say hide sk i keep calling it the sclera but it's the cornea so hide cornea there we go i'm not saying that my uvs at the edges don't seem to be aligning that nicely so i'm gonna move this up a little bit more cartoonish eyes have this dark outline here i will reproduce that now basically just get your texture coordinates and if i take the uv coordinates and pass them through a vector map which is set to distance this will give me the distance from the center point because remember if i go to my uv coordinates this is the coordinates i'll get so point here we actually have a vector going like this and the length of this vector is what i'll get with the length well at this point we have a much larger vector so basically we'll end up with values going from zero to ever greater numbers the further we go from the center however the uvs actually start from over here from the corner so this point would be zero five i'll pump that through a vector map i hope i'm not wrong about this i think i did have to add 0.5 to them we'll see and then to this distance i would just do map range and i'll plug it in and i will mix rgb right here mix rgb just like that with this being the driver of the mix and i'm going to mix with the color black okay so when i start playing around with this minimum value or rather maybe it needs to be subtract oh distance my bad ah this needs to be length length length we get the length not the distance i keep making those up okay now you see since i subtracted 0.5 i think we're getting the effect we want where i can change the minimum value and it's sort of giving this darker edge which we can control the sharpness of you can control where it starts from so i would play around with this that's sort of going to be our edge for the eyeball and for the color of the eyeball it is just another mix node this time we'll set this one to multiply and maximum factor and this color right here we can pick to be whatever we want so there we go that's pretty much our eyeball and we can also use this map as a normal map so put plug that into a bump um or rather we'll be using it as a height map so plug this into the height and make sure color space is non-color and then plug that into normals the distance i would probably be too high because it is indeed the distance from uh it thinks it's one meter now basically i want to kind of reduce that quite a bit that looks fine if i enable the square it should look even more convincing play around with this of course play around with the map i'm really dialing this up as i go depending on what i'm trying to achieve and that would be most of it however you see that we're now seeing inside our eyeball i'll click this clear so i can move into this clear material and then i just want these faces which are reversed to look black so that is simply a mix shader and what i'm going to use over here is the geometry node which can give me back faces so a value of one for faces that are back i will just plug this in and for the second shader i'll just leave it blank and you can see how now we have darkness in the middle all right and i guess if you want to be extra you can also add some material to the sclera because i do believe it has proper uvs so that would be another image texture uh let's see if i download this one there it is and i will just set this to the base color give it a second to shade and it is reversed so i'll press ctrl t this is a feature of node wrangler it just gives you this setup and i guess i will just scale it on y until it is minus one i guess it basically just need to stretch it and then also move it on the y if i really want to move them further up and there we go now they're going way out way out in fact more than i would like so maybe 0.1 something like this so one thing you will notice is that over here this edge can get a bit sharp you can just bevel that afterwards with an angle just change the amount at least two subdivisions i mean segments and you can just soften that up to your heart's content which also have the shading in this area so that's one thing you can do uh and overall you can just subdivide the whole thing afterwards just ctrl 1 to add a subdivision level if you want to get things to be really smooth and yeah i guess this is basically it this is your entire irig i think it looks pretty convincing i mean if you want to be super fancy about it go ahead and add even more detail like a bump map for these veins you will find the bump map for these veins on the link i'll give you to these textures and you can really get into it uh what's important and what i really like personally is that audi you just have a single object all right and all of your controls for it are in the modifiers tab and you know the finishing touch is of course just an empty or a bone uh that you're just gonna have to give it a damp track constraint just like this guy right here and you're basically good to go very simple so yeah definitely play around with this tell me what you think about it because it is a pretty powerful technique i believe very good eye to make the ios completely disappear you just need to set the pupil size to zero but also the iris size and iris depth to zero and you can see how that helps out the reason this is happening is because i still have shade smooth here you can fix that by adding auto smooth and there we go now you can make the eye completely disappear you can make the cornea disappear or rather just set the push to zero so that's pretty cool i think that that's interesting and really have fun with it if you set it up once you're basically good to go for a lot of ice setups and yep thank you for watching i will have this file up on gumroad you can definitely download it there for free or you can toss some money my way i won't mind and yeah bye
Info
Channel: MaxEdge
Views: 53,514
Rating: undefined out of 5
Keywords:
Id: 3TxZBbq8BMA
Channel Id: undefined
Length: 28min 28sec (1708 seconds)
Published: Thu Feb 10 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.