Math for Game Devs [2022, part 3] • Matrix4x4 & Cross Product

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
um he didn't want to be there he cuddled for a while and then he ran away I'm calling this part three I'm taking a radical departure from our previous names got naming scheme so this is part three because once they're up on YouTube they will have no concept of days or time and so we're naming them after the the stream index not the days um okay all right let's see are we are you all here uh I need to Ping students uh there we go please react to to that message if you are present me okay uh all right what are we what's what's happening um I should open my notes go okay I think we're ready um I just need to arrange some windows um there we go something like that and then we're going to talk about the funny cross product uh soon we have one more thing one thing in between us and the cross product uh is arranging all of my windows because it's getting a little a little messy okay all right okay where's my tablet pen there is oh actually did you get some water I'm sorry I just I I need water what hello oh I forgot about the cat ears that was a real close call oh my God I wouldn't have been able to do math I forgot about this um okay okay all right all of my Meandering now before I start in YouTube that's going to show up as a comment in chat where someone is like lecture starts here that's that's what I've caused now with all of this Okay so [Music] um we've been talking about doing this type of transformation where we have something in one space and then we transform it to another space or between coordinate systems and the um generally in games you almost never do it this way if you want to do like a full transformation from one coordinate system to another you generally use something a little bit more advanced than just these Elementary methods that we were using here um and that is to use something called transformation matrices and I'm sure you might remember matrices from school um I never had them in school but some people do um so matrices so matrices is just a different way of storing numbers in math like we have our vectors where we have some you know XYZ values and we sometimes write them like this right and so this is kind of a container for three numbers right um but there are other containers we can write them in different ways so sometimes you write things in an object called a matrix so usually you have these brackets like this so this is a matrix and maybe we can store a vector in a matrix so we're going to have our X Y and Z components we can write them as a column Matrix like this and so this is called if you write a vector in this format this is called a column vector and it is a column Matrix because it has it has one column and then three rows right but you can make matrices that have any number of of columns and rows so you can have a matrix that you can have a two by two Matrix and maybe have some some values in there maybe have um 0 1 2 and 3. so this is also a matrix so this is four numbers that we're storing in this Matrix um and so so again matrices are just a way to store numbers and manipulate them now there are a lot of rules about how we multiply matrices together so matrix multiplication is a a special type of multiplication that is quite different from just multiplying numbers directly um but in in games we generally mostly deal with a specific type of Matrix so there's a type of Matrix that will encapsulate and do this type of transformation that we're doing up here and so we're going to talk about transformation matrices our matrices quite similar to arrays uh basically yeah you can store matrices in an array like in your code if you want to so so yeah they're very similar um one thing that that is a little bit different is that if you have a matrix like this um this is not the same thing as a row Matrix um so if this is your Matrix um these are not equivalent but if they're arrays you would kind of consider them to be the same thing because arrays don't have an orientation right um but so so this is a column Matrix and this is a row Matrix um just one thing to keep in mind if you're making that comparison um all right uh maybe I'll keep that just that's a little little souvenir just so we don't lose that I'm gonna scoot it over there okay um and so there's lots of multiplication rules for how you multiply matrices and how they interact with each other and whatnot um if you are um so for example if you have a row Matrix um uh isn't that the same uh yes but that's a two-dimensional array so yes in that case it would be the same but they still have special multiplication rules so um so it's a little bit misleading to call them a race but you can certainly store them in arrays but let's say you have a a vector so usually we have the we have a vector that we just name a right so we have a um and then maybe we want to do the dot product with B so this is how you would write the dot product generally right so a dot b but we can actually write the dot product in Matrix form um and so if we write the a vector we can do a x as the the first element in the Matrix and then a Y and then a Z sorry my handwriting is awful um so this is a row Matrix we can multiply that by a column Matrix that contains multiplication you just omit the symbol you don't write anything in between um and so then this would be a column Matrix using B so b b x b y and b z uh so if you multiply these two matrices this is actually the same thing as the dot product because of the multiplication rules in um in how matrices multiply together um these actually result in a single value that is equivalent to the dot product so so this is the same thing we're not going to go too far into exactly how you do matrix multiplication mostly because it actually doesn't really matter but one way you can sort of think about it is that if you take this whole column Vector it's kind of like you're taking it and rotating it and placing it on top and then you're multiplying this by this and this by this and this by this and then adding them all up uh which is exactly what the dot product does right um there are many ways you can visualize that um there's a it's got a nice visualization thing um I think it's this website yeah so if you if you want to multiply these matrices together let's reduce that a little bit so if you multiply them it's kind of like you're taking all of the elements and like multiplying each element and then summing them up so it's kind of like each thing is a DOT product with every row so it's going to do a DOT product with all of them and then you end up with the final Matrix um so if you want this website if you just want to play around with matrices there you go [Music] um in in either case the um this is very useful um especially when dealing with uh transformations um because let's move that aside there's a very very useful type of Matrix we can use called a transformation matrix so if you let's let's first imagine a coordinate space so we have some some axes right here here's our this is 3D now we're jumping into 3D uh so if you you have some some transform in unity that transform has a position right and so there's a um position vector from the origin to where your transform is right but then you also have the basis vectors so you have the x-axis and then you have the y-axis and then you have the z-axis if we're in 3D so this one is pointing away from us imagine that it does so this is our this fully describes the position and orientation of the transform right um but usually you don't actually store this in these three or four separate vectors um like you don't actually generally have like a position Vector a right Vector a a forward vector and an up Vector uh quite often you store all of that in a matrix and usually you would store that in a four by four Matrix sometimes you would store it in a three by four Matrix but the 4x4 is a little bit more General okay so we're going to talk about the Matrix 4x4 this is also a data type in unity so you can you can use this type in UD and do stuff with it um and so uh why not three by three uh we'll get to that in a moment so in a 4x4 Matrix so that means we have um 16 elements I don't know how to count you might have to change the size of this um so if we have a matrix we can actually store this information in that Matrix and so the way that this is generally generally stored is the if you take the x-axis you can store the x-axis as a column Vector in the First Column of The Matrix um so you would because because every Vector has three components right every Vector has an X Y and Z component um and so the X Direction here this vector is stored here and so we have X the X component of the X Direction and then we have the Y component and then the Z component and at the end we usually have zero I'm going to talk about that later so we're actually storing the direction like this Vector we can store that as a column here and then we do the same thing for the other Vector other vectors so we have the um we have the um the up Vector here the y direction we can store that as well so the X component of the y y Vector the Y component um and the Z component and then zero um then we do the same thing the Z Direction that's this Vector right here so the X component of the Z Vector the Y component and the Z component and zero okay um and then so so now we've stored the entire information about the orientation of this object in this part of The Matrix it is actually possible to kind of cut this off um so we can if we do this then this is a three by three Matrix right um if you have orthonormal vectors like this as in they are orthogonal um to each other and they are normalized then this is actually a rotation Matrix you can use this Matrix to rotate objects and so if we multiply this by a vector like any vector in this case a column vector you know that Vector in and of itself has its own components if we multiply these together we will get another vector that is this Vector rotated by this space or this rotation so this is actually transforming from a world space Direction and then rotates it with the orientation of this object uh and so so this is often called a rotation Matrix because that's what it does what does orthogonal mean um orthogonal means that it's kind of like perpendicular right um so these two lines are parallel and these two lines are orthogonal right um Okay so and so so what this does is that it will take this vector and then effectively it rotates it um from this space so this has an orientation right like this fully describes the orientation of your transform and that then transforms it to our new Vector but transformed using this rotation um and so that's one part of uh one part of the Matrix 4x4 but this is just a three by three Matrix right so we're missing a few things but you can use three by three matrices matrices to do 3D rotations and this is done this is used a lot for many different types of transformations um so let's let's actually expand this a little I'm gonna move this to make room for one more thing um so if we want to store the full information of this transform then we're actually missing one thing we're missing the position right like we've stored all the information we need about the orientation of the object but we haven't stored the position of it so we need to do that as well um and so we're going to do that in the last column here I'm going to I'm going to try to fit position in here um so in this case that's going to be the position so it is um just the um so let's call it the P for position so the x coordinate the y coordinate and the Z coordinate so again x y z in this case are the components of this vector um okay why not W that's the standard um because these are not components of a vector usually W is the fourth component but this is not describing a component right um these are just names for the directions right now um Okay so so now we have a three by four Matrix which is really annoying that it's three by four and not four by three but for some reason everything is reversed and it sucks but this is a three by four Matrix I don't know why they put the Y count first but anyway um and so what's really cool about this Matrix um is that everything we did here to do the space transformation uh everything we did in unity with all of our DOT products and local to world and world to local um and even the like relative Vector stuff here and adding the position all of that can be done using a single matrix multiplication which I think is super cool it's kind of beautiful that it's even possible to encode all of that in a single Matrix and so if we want to transform a vector using this Matrix all we need to do is multiply it by by our the thing we want to transform so let's say we want to transform a vector v from local to world so then we have the X component of V and then we have the Y component and then we have the Z component then we need one more thing um the um when multiplying matrices the width of the left hand side has to match the height of the right hand side so we actually need to have one more thing down here so when we do this type of transformation um usually you would either have a value of zero here or a value of one and what that does is that if we have a value of zero you don't have to memorize all the matrix multiplication stuff but if this is zero long story short that's going to cancel out or multiply all of this by zero um and so if this is zero we're just transforming um as a rotation we're rotating it but we're not translating it uh but if we instead put a value of 1 here um then all of those will be multiplied by one um and so we don't really have any vectoring components here and so this is usually what you would call the W components and you kind of just slap it on because you need to to make the math work out and so if you add one here then this is actually a local to Royal transformation um with the way that we've set it up with these specific vectors and so this um is local to world um so the the vector v here is in local space so the last component is like a bull that defines if you translate or not yes exactly uh so this whole multiplication is just a matrix representation of the actual code we wrote for 3B right um kind of yeah except it's doing local to world not world to local but you can write local to World in terms of dot products as well uh which is effectively what this is doing right V is not drawn on the thing no we haven't drawn v um but if we have if we have a vector V um or I guess that's local to world so it should be a local Vector if we have a vector v here if we multiply that by The Matrix so this is in local space we're going to get the world space Vector here so we can call our V Prime um um okay so now it has a position and rotation if we make it a four by four we can add velocity yes uh no velocity is unrelated to this currently time and physics is not involved in this at all um so this is just a just a it describes a transformation basically um where we transform from local space and World space basically just the same thing we did here but we're writing it in a much more compact format right or XYZ basically Direction vectors for the local axis yes um so we have four vectors here right we have a position vector and then we have a vector for the y direction in World space and the Z Direction and The X Direction um so so this would be your transform dot up this would be transform.forward this would be transform dot right and so so these are the vectors that we have shoved in here and so this x-axis is this column right here so we take the components of this direction vector and just slap it in here and then we can build our matrix by putting our vectors in here as column vectors so each of these just plopping in that plopping in that and plopping in that and so forth um uh can we do the math I think that would make it more clear um yes we could I'm not sure if it would make things more clear but um so this position here the the fourth column is the position of this object so the origin of the object um is the last column here so that that's where the transform is located so this would be transform dot position um and XYZ components of the position um I didn't get the last column with zero and one uh if this is one uh we're transforming it taking position into account um so when we transformed here we usually have to do this first initial translation to make sure that it's um originating from the object itself um if you set it to one uh you will take position into account if you set it to zero um then what's going to happen is that the last column is not going to matter and effectively it's the same as doing a three by three Matrix multiplied by a column Vector with three components and so if we set this to zero it's gonna it's gonna transform just the orientation but not the offset because sometimes you just want to transform a direction vector or some other offset where the position doesn't really matter you just want to rotate something to be in the same space of something else so if position doesn't matter then you can just omit the last part either just use a three by three Matrix use this one or you can set the last one to zero if this is the Matrix you have if this is the only Matrix I have available right um okay uh how will the what will the result look like um it will be the I mean it's the same thing as we did here we just use a different method to get to that same result right um is there use cases for having W is a number between zero to one um I don't think so no I've never bumped into a use case for that um no not for this one I don't think I've seen that I'm sure there is a use case but I've never heard of it um the sometimes well depending on what you're doing you sometimes end up with a value here that matters uh but usually not in the context of just transforming vectors like this um so if you're if you're doing rendering you sometimes have a 4x4 Matrix which is what you usually use um where the last row has some some funky projection parameters and sometimes you get a value out of that in the fourth component that matters um and so so if you're doing rendering then the projection Matrix quite often has a last row where you get a a result where the W component um has a an important value if you want to do something like use it for a thing that's called a perspective divide which is messy and has to do with um homogeneous homogeneous I don't know the difference between those two words um coordinates uh what an 0.5 there just kind of for rotation and half of the distance uh basically yeah yeah I would multiply the position by 0.5 if you if you put a value 0.5 there and like I don't know what the use case for that is so um oh would the results be uh the result of this one would be a column vector I guess I can do this I don't know if you want me to write out everything but basically this would be a um a column Vector with three elements then this would be the rotated Vector so I'm calling it V Prime and so so the end result is a is a column Vector with three elements okay did that make sense so far we probably makes me get derivation flashbacks um oh yeah sometimes it's yeah um yeah it doesn't mean the derivative this time so don't worry about it um so this is basically multiplying two vectors uh it's a little bit more complicated than that effectively what's happening um so like it's doing a lot of things we can we can replicate it in this case um on this website right so we have a three by four Matrix and then we have this column Vector right um and so everything that's happening is this so it's taking this whole uh it flips this whole column Vector into a row and then what it's doing it's the dot product with the first row gives you a single number right and then it does the dot product between that and the next row we get the next number does a DOT product with the third row and we get the third number um and so that that's how matrix multiplication works but usually you don't do this manually usually you just like use the built-in functions for that um yeah so this is this is what's happening um it can be a little bit tricky to wrap your head around but okay did that make sense yes okay um could you give an example of what value for example X Y might have in your picture um it's gonna be complicated because they're orthonormal um so unless they're like perfectly aligned um but for instance there is something called the identity Matrix I don't know what happened here probably undid something so let's say that you have no rotation at all uh if there's no rotation and maybe no position either um so maybe you have then it's just going to be sitting at the origin with no orientation right that's just going to be at the default orientation that's where the x-axis the y-axis and the z-axis now these axes have coordinates in and of themselves right like the x-axis is a vector and it would have the values 1 0 0. the y coordinate would have the or the Y basis Vector would have the coordinate 0 1 0 because again y component is in the middle it's pointing directly up so this is the um the Y Direction and then for the Z direction we have 0 0 1 because the that's the last Z component and that is the direction it's pointing at so these are the values for a something that has no orientation at all but as soon as you start rotating this these are going to get really messy decimal values right um but so if you arrange this in The Matrix um then see let's just make a matrix again um so if you arrange these into the Matrix let's just try this one um then we would end up with the values 1 0 0. and then we would have zero one zero and then zero zero one right and if we include the position that would also be zero for all of them but if we just consider the rotation this would be like no rotation at all because there's there's nothing has been rotated here this is just kind of the the default state um this has a special name when you have ones in the diagonal and everything else is zero this is called the identity Matrix um so we can move that this is the okay so this is the identity matrix it's the Matrix that does nothing when you multiply with it um so if you multiply this by a vector v that is equal to V so it does nothing it is similar to um so so the word identity comes from the fact that it does nothing under a certain operation so for example if you have a if you want to multiply a number if you want if you have x times V or it's not a number I guess x times a um if you want this to equal a what is the value of x um and the value of x is the identity value so for multiplication uh the identity value is 1. so 1 times a equals a right um for addition if you want to have X X plus a equals a then X has to be zero right zero plus a equals a so 0 is the additive identity um and so and so what identity means is that it's the it's the value that does nothing under a certain operation uh so like some of you are mentioning quaternion dot identity um is a rotation that doesn't rotate at all it's just the default rotation right and so that's what identity means in this case it's just the whatever whatever does nothing basically um so that's where the word identity comes from and so and so these are the values uh it would have if it has no orientation uh does multiplying a vector by this means having a scaled space yes it does um so that's the last thing we haven't talked about in this yet and that is scale so in in unity we of course have the ability to scale things right if we create a Cube um then we can scale this one and we can store this scale value inside of a matrix too and the way that that usually works is that because we don't really have any more room to store the scale here but what we what we can do is that we can change the length of the basis vectors so if we make the x value if we make this twice as long then we've scaled it on the x-axis and so and this will actually take that into account automatically just by extending the length of this basis vectors we will automatically transform properly taking that scale into account um and so so the the way that rotation position and scale is stored is usually in this Matrix where it just stores the orientation as three vectors these vectors are then scaled by the scale of that object and then the position is stored in the last column and so so this Matrix fully describes um a transform or the state of a transform um so the x-axis basically holds only the X rotation as an x equals 3.500 uh no so none of these store angles angles are not involved here at all um so this x component is just a direction Vector right um the rotation and orientation of the whole system is just a side effect of the directions that these are pointing in right um and so so the x-axis in this case if we start rotating this upwards like around the z-axis then the value of this would start changing right like it would start like um let's start decreasing here so it'd be like 0.9 or something and then it would start increasing on the uh on the y-axis and then would still be zero on the z-axis um so this is if we start rotating it so maybe this would start rotating up like that um and so so everything we're storing here is again it's just the directions uh scaled by the scale of the object um so it's X just transform dot right or one zero zero uh it's transform dot right in this case so so for the local to World Matrix um these are the world space directions of this object that are stored in this Matrix uh can you use the identity Matrix for World rotation if you would need to know the general world's rotation compared to yours uh your rotation should already describe that comparison because the identity Matrix doesn't do anything right so that is already what your your personal rotation or orientation describes right uh weren't we setting our world X using transform.writes times local position X um yes we were it gives the same results we're just doing it in a different way and if we had scalar would be scale dot x times transformer.write um no so so transform so so it's similar to transform.write but it's scaled by it uh in this case um so so they're not exactly equivalent to transform.write and transformed by forward because those are actually I don't I don't know if Unity uh takes scale into account for those I don't know if a normalizes them automatically I kind of forgot because I rarely use like non-uniform scale in objects um I forget if it's normalized actually um okay all right um is transform.oiler angles calculated from the transformation matrix uh I believe so yes I don't know all of the technical details in how it's done in the transform component but it could be but that's usually how I think about it like the Euler angles are not stored in the object um unity's transforms uh I'm guessing they either store it in a matrix or they store orientation in a quaternion um it's either of the two but the point is that you can store all of that information in one Matrix and if you're in unity you actually have access to that Matrix um so you can type transform dot local to World Matrix and so this gives you the Matrix uh directly um okay any questions lots of typing I need to drink several people are typing uh could you give an example of where you would need this in Game Dev we use them all the time when transforming positions um and so um if we want to know where something is relative to something else we would generally use the Matrix or the built-in transformation functions to do this um so so for example Unity has this built in so transform dot transform point um this is the same as the Matrix times your vector or V Dot y v dot Z um and then with one as the W component um and so this is basically doing the matrix multiplication right and then there's another one transform.inverse transform point uh and that one is doing the opposite um so that one has the inverse Matrix and then then it multiplies the point there um then there's another one uh for for transform vector transform Vector uh does not take a position into account and so so these are basically uh the functions you would use generally when doing space Transformations if you want to go from from local to world you would use transform points if you want to go from world to local you would use inverse transform points um and this is basically the math that it's doing under the hood it's taken the local to World Matrix multiplying it by our vector and setting the last component to one because because we want to take position into account right so generally these are the function you would use when transforming from one space to another okay or actually specifically local and world uh okay let's see can Matrix be declared with any numbers like Matrix 4x3 instead of four by four um mathematically yes but Unity only has Matrix four by four in its default Library um yeah it has a has a few C sharp has a few other ones but but generally you would use Matrix four by four um okay um two questions can we program out local the world using matrices now uh yes we can um what are the built-in functions in the unity convert between local and worlds oh I already just talked about that so um this is the if you're if you're doing this in unity usually you would do it like this um if you actually have a transforms to do this with in some cases it can actually be good to not have game objects like lying around your scene if you just want like maybe you have a a character with a gun for instance um and so so um so let's say you have a character and they are holding a a weapon I don't know what guns look like this is this is a gun um and let's say they're holding this thing right and this gun um could possibly be a game object right it's it's it has a position it has an a X Direction it's a little bit illegal to use X's forward but that's okay and it has a y-axis um and then there is there's someone holding this gun right they're they're holding that um so if you want to for instance if you want to spawn a or if you want to raycast like you're doing a raycast to fire this weapon right um maybe you don't want to raycast from the inside of the gun right maybe you want to raycast at a specific offset um and so the barrel of the gun or like the end of it might have a local space offset right um and so the raycast is in World space but the offset to get to the the tip of the barrel is going to be in local space right so you could configure this offset in local space and then in order to get the recast spawn position to get this position in World space um you can use the transform function uh so in this case you would want to go from local to world because the offset is in local space and so then you would use transform dot transform points and then you pass in your local offset here um and then then you get that position in World space um sometimes people do this using like extra transforms like um you put an extra transform component here just put another one and then you use that to read your your world space position but there's a there's some overhead to use the um there's some computational overhead to have too many game objects in your scene because they have to recalculate every time you move something and so sometimes it's good to not use um uh extra game objects all the time um okay uh wait did I miss a question does someone delete a question oh where do we use the transform Vector method on a transform Vector is um effectively when you don't care about the position so for example um uh uh let's see um maybe you want to calculate like like a simple thing would be like you want a Direction but in a different space um like um what's a good example um I mean I mean you can have uh let's say maybe maybe maybe you have some sort of spaceship um this is a spaceship as you can see um looks like this is going to turn into some Among Us thing um so so if you have a spaceship your spaceship obviously has some sort of position uh it has a Direction Let's just use X and Y in this case because it's easier that way so we have the X Direction and we have the Y Direction um and maybe you want to know what direction this is moving in relative to some other thing so maybe have another spaceship here that is just Square this is this is just a square spaceship this is the maybe these are the evil ones who knows um so maybe you want to know like uh what is the direction to some other thing in local space right um so the let's say this is this ship um oh I actually Drew this with the wrong coordinate system oh geez oh no I'm sorry it's actually on the other side also a whole topic and I know itself um and so so if you want to know the direction from um from this ship to this ship um then you could just do a subtraction like this and whatnot um and then you have a world space um Vector if you if you take the world space position here in the world space position here right um but you might want this in local space um so that instead of having this in World space you would have this in local space coordinates so that you would know the exact like y direction and the exact like X Direction uh relative to this whoops relative to this ship right so maybe you want to use this as your coordinate system because then I don't know maybe you're making a game like FTL maybe you have like a whole crewmates running around in your ship and they're doing things and they want to know uh where is the enemy relative to our ship because in in their mind their coordinate system is just local to their ship and so this direction can be useful to know like what is the direction to that ship and it also would have to be normalized if we want to call it a Direction uh so let's make it a length one uh and so this is where you can use transform Vector for because we don't actually we just want to transform the direction from World space to local space but we don't want to transform the position right because if we do that then you know World space would have an origin somewhere here um and then the the vector from one to the other in World space here um would be like this Vector right here um and so if we transform taking position into account we would get this Vector pointing down there from the ship but we want the we just want to transform the direction so we just want this direction in local space and so we ignore the position of the object and so that's how you would use the transform Vector for and transform Vector is again the case where this is zero where you don't take position into account and so all you're doing is transforming the vector using the rotation part of the Matrix if the object is scaled it's also going to take scale into account but you usually don't scale objects or at the very least you usually don't transform using scaled objects um okay I hope that made sense um okay uh all right how are we doing on break timing oh yeah we should go on break uh oh what does m to the power of the power of power one I guess I meant negative one I think I there we go that means inverse uh so matrices are invertible um well not all of them but these are um and so if you have a local to World Matrix um what is my tools there we go if you have a local to World Matrix the inverse of that Matrix is going to be world to local so if you have a matrix m um then this is in this case there's going to be local to world and then the inverse usually denoted like this is a world to local uh inverting a matrix can be expensive and complicated um and so usually you don't do that by hand you kind of let computers do that for you um but but yeah so that's basically a way to to get the opposite of that Matrix um and the the inverse um again has the property of like if you um if you multiply a matrix by its inverse um you will get the identity Matrix in other words it's basically the zero of matrices right uh what does inverting a matrix mean though is it negative um no inverting a matrix is a more complicated action than that effectively what it does is that you kind of flip the order of this in other words it's going to pretend that your local space is the world space and then it expresses this the world space origin relative to this uh as if this is our world space Origins that's kind of what it's doing um and so it's kind of just flipping the script it's doing an opposite interpretation of the whole situation and so yeah and doing that is non-trivial um I don't remember exactly how you do it but we can we can look it up Matrix inverse there we go an invertible Matrix let's do Wikipedia all right there are many different ways of doing it which method do we want to use to let's see inversion of 4x4 matrices uh here you go here's how to invert 4x4 Matrix I don't enjoy doing that by hand and I've never done it by hand but you can do it by and if you want to um and so yes to answer your question you do need to calculate the determinants to get the inverse Matrix [Music] um yeah but not all matrices are invertible but all transformation matrices are invertible um okay I haven't talked about the last row I'm just going to do that before we go on break um so it says Matrix 4x4 right it doesn't say Matrix three by four so what is the last row um so this is mostly used just to cover almost all use cases in game development um the last row is rarely um rarely used in general if you're working with like game objects and unity this row doesn't matter you can just ignore it completely so for most cases this will have the values of zero zero 0 1. just like the identity Matrix remember that the diagonal the diagonal is one and everything else is zero and so this kind of fits into just the identity values so this means that it's not going to contribute um anything this basically disables that row and makes it kind of an effective right but what it does do is that it adds a fourth component to the result so the result is going to be a um a um four by one Matrix I always forget the order it makes me drives me insane um so this would be VX or the V Prime X the the rotated vector or the transform Vector I should say Z and then you get some number here in this case it's just going to be uh it's just going to be one um but usually you can just ignore that one but the the one use case where you actually use these numbers it's a little bit esoteric you don't have to remember it um it's when you make a projective Transformations um and so that is used in rendering there there are a lot of Matrix matrices that you juggle between I do need to drink water thanks you juggle between a lot of different matrices um like you have the model Matrix The View Matrix uh the projection Matrix and all of these things matter and so the projection Matrix have has different values here and that's usually used for like perspective transforms so if you have a perspective camera in unity that one is going to use a matrix that has different values here and that's going to basically create a skew transformation that transforms things in a in a very special projective way um yeah so so basically all of our Transformations that we've done so far um kind of only support a very special type of transformation where you go from one coordinate space to a space that's maybe rotated right like this is a a transformation we support or moving it or whatever the projective transformation allows you to skew it like this um and so that's why it's useful when you're doing like perspective rendering um so so this is kind of what the the last row allows you to do but in 99 of cases you can kind of just not care about that last row you generally don't really need it um unless you're like doing some experimental projections in your camera but in general you're not going to touch that um uh but one thing that might be useful is that when you have a 4x4 Matrix and you know that you don't have any like projective Transformations uh you can you can actually if there's a special function you can call to basically ignore the last row um so if we have a matrix here it actually has a built-in function called multiply point three by four so this one ignores the projective last row so this one is faster than a straight up multiply um okay all right uh we should go on break let's see uh yeah 10 minute break let's resume at 14 15. um does this look about right [Music] uh I don't know what your Rel dot transform is in that case um is that is that a different transform or relative objects um then all of the other ones should be the relative object as well all of these should come from the same transform um not different transforms uh and the I think that the one thing you might be missing is that all of the uh I think transform.right might have to be scaled um but I'm not sure about that but we can we can check I suppose if we just log transform.write um yeah it does not take scale into account um so you also have to be um you also have to include the scale in your diagram the way you're writing it there um yeah okay how can you get local to Royal if you don't take in a relative object all values will be the same uh oh wait sorry I'm I misunderstood your um your diagram I'm sorry no you ignore me I think this is uh let's see um so the the thing is that your Matrix on the left is a um local to World Matrix but the position in the column Vector is a world position um and so if you want to make a local to World transformation the position on your vector on the right should also be a local space position right okay sorry I misread it uh but yeah so it looks like transformer.right does not it looks like this one normalizes so it doesn't just use the Matrix directly um okay yeah we should we we're taking a break where break we're zooming at oh God caps resuming at what do we say 14 15. there we go okay all right okay oh God I lost the chat oh there it is how's YouTube chat doing uh when multiply a matrix with local Obsession does it automatically take it as a column Matrix uh yes I believe so so if you write if you have a vector here I guess it would have to be a vector four right [Music] um so you would have some vector what I can't type right now uh then you do local to World Matrix times Vector then I believe this will maybe this is actually not valid um does it not support this yeah okay I thought so um yeah so so this does the this interprets the vector as a column Matrix I believe yeah mm-hmm your video Embassy occurs maybe choose that that is the topic for the final paper we needed to write oh that's nice I'm happy you found it inspirational okay all right what's the main use for rotating vectors uh that's kind of like asking what's the use for rotating objects um you quite often need to rotate things in games um I don't know anytime you want to turn your character you have a a thing you want to look in a specific directions then maybe maybe you need need to rotate things um all right still haven't even started talking about rotations that's like a whole topic and I know itself do you have it for my current line shortcut and writer um I have format document but not format line I'm sure it's possible to set that up but I usually format the whole document every time I think I might have it on a custom shortcut so I don't know what the default is uh what if we make the Matrix with vectors that aren't perpendicular um then you will skew your space you will it's basically a sheer transformation um and so if you imagine if you imagine your space kind of like a kind of like a grid kind of like kind of sort of something like this uh and then you have your x-axis and you have your y-axis then if you have if you make them uh not orthogonal you're basically going to do this to your space like this is the transformation you're then doing you're skewing it like that doesn't it do it when you type the semicolon um if you have it set to from it when typing semicolon it does not yeah but it's a setting I forget if it's enabled by default um foreign component isn't used for skewing I think it's going to use the divide by Z when converting back from homogeneous coordinates um I mean it's both right what happens to math if circles become squares it's a weird question I guess it depends on what the nature of how they become squares is you know uh let's say if I were to only rotate an object 90 degrees along the y axis with the transform Matrix becomes something like this um okay okay okay here's the way that I tend to think about it so we have two spaces here two spaces I'm holding three-dimensional spaces then you can sort of try to reason about this right so let's see what was your use case so let's say uh this is our world space and then you have another thing and you want to rotate it 90 degrees along the y-axis okay let's do y up um so 90 degrees around the y-axis in unity would make this rotation um and so so let's see um would X be yes X would be zero zero negative one that's true uh and then y stays the same and Z points in yes yes that's correct you got it Eric that's that's how it would do these are very very useful when thinking about 3D rotation and orientation um which we should also talk about I haven't talked about that too much yet um I'll do that after the break [Music] where's part two it's on my YouTube channel um go to the latest videos and it's going to be the the part before this one um okay I'm very bad at taking breaks I feel like I'm like oh I need to go to the bathroom and then the time is up um if I wanted to try that rotation how would I write it here um which rotation the one that Eric was talking about oh yeah you would basically uh type it in right um so a rotation is just a three by three Matrix um so you so if you want to ignore a position you don't need the last column uh but you could you could add it if you want to but then the the last component of your vector has to be zero here if you want to make sure to ignore the position right um so this could be like any value right um as for your rotation then you would just put it put the numbers in that area code right so that was zero one zero and then negative one zero zero um yeah and then you can do the whole thing and then um oh sorry I'm not showing it on stream look there we go uh so you basically punch in the numbers right that area code and then for your vector um you said zero in the last one if you don't one position to be taken into account um and then that's what you get and so now you've now you've rotated this Vector um around that axis uh those are positions right so this is one position this column uh it represents the the origin of the object that you might want to transform to and from um but in this case we're ignoring that column because we set the last W component to zero if you just want to do the rotation um and so if you just want to do the rotation you can also just omit that entirely so it's equivalent to doing the three by three Matrix um so so this would be the rotation Matrix right um yeah damn it a cat has been chewing on this it's all beaten up now oh no okay um are we ready to resume or how are you how are y'all feeling am I ready to resume is it supposed to be negative two if it's a rotation uh yeah like negative two is just the result of the fact that this one is two right um so because it's a 90 degree rotation it's similar to just um flipping a few coordinates and negating some of them so what happened here is that it flipped these two and then negated uh this one right and so the two there is just because that's the coordinate that we gave it if we give it the coordinates like 23 um then it's going to say 23 right um is the W in quaternions used to offset the position of the object in local space based on the new rotation no quaternions are very different from this um so no uh we're going to get into quaternions as well a little bit at least how to use them but um what would 180 degrees look like uh 108 degrees around the y-axis um so I guess that would be um 180 degree rotation would be negative one um and then one and then Z would be negative one this would be 180 degree rotation I believe so this should just um negate one of the components I think um or or two of them oh yeah two of them um yeah um all right okay let's let's let's continue um do you wanna do you want to see what it would look like if we used matrices um to do these transformations um it's very straightforward I guess it doesn't really add that much but um but basically we're going to do something like this right um so if we want to do oh yeah I should ping that we are resuming um there we go react show me your presence okay cool um neat all right so it's a little bit wonky because here we're doing just um just a 2d transformation but Matrix 4x4 has a port for like 3D projective Transformations uh so it's kind of like uh we're kind of doing a huge operation using tiny values but that's okay um and so if we want to do this using Vector threes let's do that conversion first so let's just change to Vector three and we don't have to do that and then we can change these don't need these two anymore uh and then we need the z-axis on both of these uh so Z and for what okay um oh yeah we need to include the Z components all right so now we just turn this these into 3D Transformations instead of just 2D um so the way you would do this uh using the matrices uh so instead of let's start with local to Worlds so instead of doing this whole thing um the um effectively you would do transform dot transform transform points and then you pass in local um this is the the short answer and this is kind of the what you use in practice um when you don't want to do things manually right um so this is what you're going to use for the most part in your games whenever you're transforming things which is basically just kind of unnecessary to even have this function right so you would call this usually but if you want to do this using matrices um you can do return transform dot local to World Matrix dot multiply 0.3 by four then you pass local in there um so this is the cheap way of doing it where you're skipping the last row uh because this is a four by four Matrix but because transforms don't have any projective transformations in other words it never uses this last row oops this last row um so we can call this special function called multiply point three by four if we want to do a cheaper transformation and again this takes scale into account which we didn't do here so this is actually using scale uh we can also do it using like the the Fuller multiplication just straight up multiplying it by our um by our Vector right but here we need to keep in mind that the uh there's no W component and this is actually going to type cast it to a vector 4. um and so this one is going to automatically set the W components to zero so we might want to do make a new Vector four or we pass in local X local y local Z and then one if we want to transform it as a point right um yeah so this would this would do a full Matrix transformation um as a point as in in other words it's taking uh the position of the object in two accounts um yeah and so so these are these three are basically three different ways of doing pretty much the same thing um so they're just using various various ways of getting there um one big advantage of using matrices is that you don't have to have a transform in order to use a matrix sometimes you're transforming to and from different spaces where you don't have any game objects you just have a an orientation or a position somewhere that you want to transform to and from and so you would basically use either of these three in practice use the first one almost in almost all cases if you have a transform because this the the easiest function to call um okay and then world to local is effectively the same thing except instead of using the local the world Matrix you use the world to local Matrix um so if you want to do it the quick when you quick and easy way you would use the inverse transform points so then world to local is the inverse one uh or you can do it manually you can do transform Dot World to local Matrix multiply that by your um and then multiply that with a three by four multiplication with worlds so you can do that too so it's exactly the same thing here you can use any of these uh they all effectively do the same thing in this case um but yeah so so these are these are the options there are many options uh to pick from um okay uh uh all right so that's basically how you would do it in this case you can also construct a matrix kind of manually so you can make a matrix 4x4 um either you can if you're feeling spicy you can just like input The Columns directly but there's also a helper function called Matrix uh 4x4 uh dot TRS and so this one takes a translation a rotation and a scale so you can construct a matrix using using that so you can you can give it a position maybe you want to place it at this position and then you want to want to use a specific rotation in that case you would use a quaternion and then maybe you want to give it a scale as a you would give it some scale here um and so so this gives you a a matrix that effectively acts like a transform without having ever having created a transform game object right because game objects are heavy you never want to like instantiate game objects just to calculate something and then delete it that's very expensive um so quite often if you just want to do the mathematical operation of transforming between spaces um usually you would do that using this Matrix type um and this one this one also doesn't like allocate or create garbage or any of that stuff and so it's very very cheap to do this um yeah so that's that's ways you can use matrices very useful think of it as a transform without a game object sort of um okay so that's how you would do the that's how you would do these functions in many different ways um okay how much time do we have today I actually forgot what we put on the calendar um oh not too long okay oh geez add Jesus this is going to be it's gonna be tight maybe it's okay maybe we got this um all right just need to drink some water any questions about matrices before we move on Dead Silence silence all quiet in the library oh no that's either very good or very bad everyone is like I didn't get any of that and then I'm like oh no ah jeez some typing not at the moment uh would it be available tomorrow for help with assignments um technically no practically I'm probably going to be a little bit present but I'm not going to be able to do like um joining for calls and whatnot but I'm not technically scheduled to be present but usually I will be a little bit present every now and then um okay I need to drink more watering so dehydrated lots of typing uh any situations where it's better to build matrices you're self-title these Transformations or is it generally the case where you trust unity's built-in methods uh yeah anytime you don't have a game object um I would recommend using matrices directly um so uh for example um I'm just going to pull out a use case that I've had um let's say that you are making a game just purely hypothetically not that anyone would do this let's say you're making a game that has like splines so in this case uh this would be like a bezier curve right that's the starting point has an end point and then it has the smooth shape um along the spline right so in terms of game objects maybe you just have a game object at the the end and at the start uh but let's say you want to get a coordinate space at an arbitrary point along this thing right so in this case um you might maybe you want an x-axis and a y-axis at a specific point on the spline right um and then maybe you want to use these coordinates to generate a mesh maybe you want to generate like a some sort of railroad mesh or something like that right that means that you're going to need to calculate the you're going to need to go from local space uh coordinates that Define the profile of this Railway to World space coordinates to generate the mesh right um and so so in this case um when you sample the curve ideally you would get a matrix out of this you get a matrix here and then you transform maybe like 10 different vertices here along this profile and then you do the same thing for the next part so for the next segment you get another Matrix representing the orientation of that point in the curve and then you use that Matrix to transform a lot of things from local to world and so forth until you've built an entire mesh that goes all the way to the end in this case using a game object is just going to be wasteful and kind of weird because then you're gonna have to like move the game object in between every generation and whatnot I'm just kind of clunky and strange because it's kind of just a temporary placeholder and so instead of using a game object you can just use the transform or the um instead of using the transform you would use a matrix so then you would construct a matrix from the values you get out of the sampling the curve and then you can just use that flowstorm reference yes I'm surprised any of you have even heard of flow's term but yes I used it in my game plus arm um the 3D modeling programs use matrices for making meshes out of splines most likely yeah I'm not entirely sure how you would do it otherwise I mean you can do it using the manual way that we did it here where you're kind of you're kind of doing a matrix multiplication um but we're just not calling it that right um I could show you my use case if you're interested in seeing my game but I don't want to go too much of a on a tangent but I can show it if you want to um if not I'll just continue with the lecture um someone asked another question earlier about a rendering that I could also talk a little bit about in the game um okay okay I only got one response I don't know I don't know I'll try not to go too far on a tangent about that does it even compile I'm not sure we're already in overtime we're not in overtime right now uh we have one and a half hours left um there's not that much more content for the assignments no so I think we do have time um okay this is this is a game that I've been working on for way too long um 12 years ago I was a student at future games and I started working on this game when I was at future games and then since then I've scrapped the entire project and Rewritten it from scratch uh three times I think um and it's it's not even near finished but um and I also have to launch steam because I've hard-coded Steamworks into into the game it actually doesn't work if you're not running steam because I'm a professional um okay there we go okay um this actually do we have audio uh I don't know if we're gonna get audio we'll we'll see what happens uh okay there we go this is a game that I've been working on called flowstorm uh audio is muted and we do have audio good um okay this is this is a game that I'm working on it's a little rocket ship game and it looks like this it's like a little racing game ow I died anyway so this game um has a level editor so if I go to here create a new thing and this level editor is based on bezier curves so you can kind of create your own levels like this um so these curvy sections are 3D meshes uh so if we go into the scene View you can see that these are meshes um and so if when I generate these meshes they are generated along the Curve uh but at each point in the curve um I need to sample multiple vertices right like these vertices along this whole Edge all the way around here like this whole section all of the vertices here they have to transform using the same Matrix and so it's just easier to make a matrix and then transform using that rather than juggling game objects right um and then yeah and so so then that's that's how it's done and so all of this is procedurally generated stuff it's a lot of polygons how is the performance so good uh it's not that many polygons compared to most games like it's a very minimalistic game and so this is this is fine in this case um and yeah so so this uh if we put it side by side so we can look at this directly and so if I modify this one you can see that it updates the mesh and so this is all done using using this type of Matrix transformation um yeah and uh when we were talking about the dot products I mentioned the audio for when you're hitting the ground at a specific um had a specific velocity and so I do that in this game and so if you consider the impact sound when you hit the ground that was pretty loud right but if we're not moving very quickly or at a very shallow angle it's not as loud like this is pretty quiet and so the impact sound is much louder if you hit hard but if you don't hit very hard it's much much weaker uh and even even if you're moving fast it's not going to be loud so yeah so that's where I use the dot products I use the dot products with the impact normal um and the velocity of the ship and so by then I can calculate the what I think the volume should be given those parameters and that's all using the dot products um yeah I also use a DOT product for the pitch of the audio um so so for example if you you do have audio right you can hear the game I'm not sure if you can actually hear the game but you should be able to hear the game um okay does this sound is this louder than my voice I don't know if it's impossible to hear me it's good okay it's audible so you can at least hear something I hope um so the um I also use a DOT product for the audio for the for the engine so if you listen to the audio you can you can hear the changes pitch when you accelerate right but not only does it change pitch when you accelerate but that acceleration is also relative to the direction you're already moving in and so if you listen to it if I start moving and then I changed Direction so it's kind of I do the dot product between the current velocity and the direction you're accelerating in um and so you get this more Dynamic Sound where um if you're moving perpendicular it's kind of like you're starting over accelerating and so it sounds way more interesting right um also my lighting system is a little bit work in progress as you can see I'm not using not using unity's lighting here I'm kind of doing my own thing um you can hear the audio there and so if I start moving perpendicular it pitches down again and so what you're hearing the pitch of the sound is actually not the speed of the ship the pitch of the sound is the speed of the ship in the direction you're pointing and again that's the dot product you take the velocity project it onto your direction and then then that's that's the value you get out of the dot product you get the speed in your direction that's the pitch with some like uh range remapping and whatnot um the dying is so satisfying I don't know it's just a stock sound of a plate shattering or something um or check out the dot product for the Collision to decide if it's destroyed or not uh no that's just uh you always get destroyed on collision it's a very it's a very mean game but you could use the dot product to figure out the impact Force yeah um but yeah you can you can die just by touching you don't have to you don't have to move quickly at all um but yeah so let's that's the game uh and that's how it works and then have this whole lighting system have a little underwater um underwater lights uh so this is kind of like a custom render pipeline I don't really use the unity surrender pipeline for this um and so I kind of made my own thing for better or worse but um can we play test it um I mean I guess but it's kind of broken you really want to I can get you a build um but yeah anyway that's that's the that's the game um all right there we go that was all I wanted to talk about when it came to philsterm uh use cases imagine that um all right let's see what do we got next oh yeah we have we have two things um [Music] so when we talk about coordinates in general um I've sort of been assuming a lot of things um and so there's one thing that you should keep in mind whenever we talk about coordinates in 3D and that is that um shit's complicated uh it's not very straightforward these things because all of the different applications use different conventions for how they determine what should be up in your coordinate system and whether or not it should be left-handed or right-handed um and so so here's a chart I made a while back if you if you want to know which is using which um it gets complicated sometimes you import models from Maya into unity and then all of a sudden your things are mirrored um or you're importing from blender and then they're not only mirrored but they're rotated as well um and so so this can get a little bit complicated um and so so some of the sometimes you make assumptions about what axis refers to what there are a few things that you never make assumptions about though um and so so one of the things that is always consistent um is that if you consider the vectors you have X you have y and you have Z right um you might notice that I'm using colors for these right the colors are always corresponding to RGB no matter what application you're using they will be corresponding to you know X is red Y is green Z is blue every application follows this so that's consistent all over all of your applications uh what's not consistent is which of these it considers to be up it's also not consistent whether or not it's left-handed or right-handed um and so the difference between left hand and right-handed is that you can sort of you can sort of use your hand to create this coordinate system so if you imagine your thumb is the x-axis then you can just go in order of your fingers x y z right um and so you can kind of create your own little little Gizmo like this right um and so so if you if you have a left-handed coordinate system then your left hand would be able to do this uh when forming your thing so this is a left-handed coordinate system um if you have a right-handed coordinate system uh then you would do it with your right hand instead and these are actually mirror images of each other um and so you can't directly convert from a left-handed system to a right-handed system uh it's a little bit complicated how that works um but yeah so so looking at this chart Unity is Left-Handed and it has decided that Y is up um but for example unreal has a different uh up Direction and real says that Z is up I think unreal also uses X as forward if I remember correctly Unity uses Z as forward um so there's a lot of assumptions made in what we call up and what we call forward and what we call right and left and back and so forth um so it's a good thing to keep in mind because sometimes it's different um Okay so um so Unity is a left-handed used as a left-handed coordinate system and in World space the y-axis is up good thing to keep in mind um all right as of now that we're equipped with this this cursed knowledge we are ready to learn about the cross products um I don't know where to put the cross product okay um and so the cross product between two vectors so we have a vector a uh is written with an X like this and so this is the cross product um and then that would um and that that is distinct from the dot product because a DOT product uses this dot symbol um and so that's another product um all right so this is a DOT and this is the cross products okay so the cross product is actually a a very strange type of operation the cross product kind of mostly only really works in 3D and 70 I believe and so it's kind of a strange operation generally if you do things in other dimensions you use a different operator but in three dimensions it just happens to work out to be this useful thing that we use sometimes and so the cross product um a quick way to describe the cross products is that it gives you a vector that is perpendicular to both A and B and so what that means is that if you imagine a 3D space um here we go this is a this is a terrible grid um here we have a a grid it's beautiful I hope you like it um okay so if you have have this Grid it's a coordinate system so if you have a vector a here enter a no sorry we're going to do this oh no that's fine Vector a um and then we have a vector B I'm just gonna draw it there uh call it B then the cross products will give us a vector that is perpendicular to both of them and so this is the results of the cross product we get a vector out of the cross product so we can call that c and so um this is equal to C um and the direction that this one is pointing depends on the coordinate system that you're using um so if you're using a left-handed coordinate system um then then this would Point upwards if you're using a right-handed one it would point in this direction and so the the result of the cross product the way that we visually interpret that result depends on the handedness of your coordinate system but the point is that it gives you a perpendicular vector and so if you have your coordinate system you know how we talked about um here how we had these three basis vectors right uh let's uh maybe maybe shorten this one again so we don't have a cursed space um and so if you take the cross products between X and Y you get Z and so that's a very useful concept um so now we can kind of kind of go from a 2d space to a 3D space like automatically right so the cross products or actually we should just write it as X across um cross y equals Z um so A cross B equals negative B cross a yes um so if you flip these two so if you use b instead of a and a instead of B uh then you get a vector pointing the other direction um and so like someone said that um a cross B equals negative B cross um a and so unlike the dot product the order matters for the cross product and this property is called it's anti-commutative um so commutativity is the property that you can swap the components or the the order of operations um but for the cross product you can't do that it doesn't give you the same results in fact it gives you the exact opposite results and that's why it's called anti-communitive regular numbers are commutative um because like five five times two is the same thing as two times five right uh but that property doesn't hold here um and so numbers just regular multiplication with numbers is commutative but the cross product is anti-communitive um very important to remember especially if you just got things wrong and you just want to flip it to the other side you can just flip the components or the input to that function and it's going to flip um how do we know which result we're getting um so this is where you can use the left hand rule if you're using a left-handed coordinate system so um if you can if you use your hand I should probably switch camera um if you use your hand uh you can use your thumb as the first component in the cross product and then your index finger as the second component and then the middle finger is going to be the result of the cross product and so you have a b c so a b results and that is going to follow the same rule as for x y and z and so the cross product between my thumb and my index finger is going to be the middle finger if I change so that they're not perfectly perpendicular my index finger or middle finger will actually shrink the closer they are to each other um and so I can actually show you a visualization of this um [Music] worst gang sign it's not west side or east side anymore it's it's a right side and left side um where's Mike why how did you find my own tweet faster than I could William I hate you I mean I don't but thanks anyway here's the visualization of the the cross products um and so um I don't know if I can zoom in more on this um yeah so this is doing the cross product between A and B and C is the result of the cross product uh the number here is showing the length of that vector and so we can see that it has a similar kind of vibe as the dot product when the vectors are normalized where you kind of get these values from you know zero to one and you can use that to measure certain things right um yeah so so this is what the cross product does the cross product between the red one and the green one gives you this blue Vector one thing to keep in mind if they are pointing in the exact opposite directions or exactly the same direction in other words if a and b are parallel the cross product is zero um yeah so that's that's what the cross product does so it's very useful anytime you have two vectors and you want to get a perpendicular Vector to that Vector you can use the cross product to do that um okay um all right I hope that makes sense so so that's what the cross product is used for you can you can get a third perpendicular Vector to your first two vectors um to clean this up is it empty really your empty Photoshop but you bookmarked all of my math visualizations jeez didn't think anyone used that page um okay that's the cross product um and so um Maybe we should use this in in unity show a little use case are the tweets made with shapes uh most of them yes this one I believe so yeah um all right how are we doing on time okay oh we should do our last break right final break and then um okay uh is it left hand rule for cross product University universally no the left-hand rule is specifically for left-handed coordinate systems um and so so which rule you're using depends entirely on which application you're using um and what's kind of fascinating is that the math for calculating the dot or the cross products is actually the same regardless of if it's left-handed or right-handed the math is exactly the same but the way it's visualized depends on a lot of assumptions and so the math doesn't really care about left or right-handedness but when you show it on screen that's when it's going to start to matter um and we actually didn't talk about how to do the cross products um it's a little bit a little bit messy but uh but yeah I can write it out if you want to but it's pretty long um but it basically uh oh geez I always forget it's a the Y component of a multiplied by the Z component of b um and then you subtract the Z component of a I multiply that by the Y component of b so this gives you the first number and then you basically continue like that so it's the Z component of a um uh it's the X component and then it's a uh X I believe and then a y uh and then we have B X b y uh b z and finally b x okay so this if we write it as a column vector this is the results of the cross product if you want to calculate it manually which I have never done because it's kind of a mess um so this is how you how you do the cross products um so it's basically this okay um all right and so the math for this is the same regardless of left-handed or right-handed it just doesn't matter um okay we should do break until 15 10. so we're resuming at 15 10. oh yeah my um my math visualization website doesn't work in Firefox because there's some sort of course security setting that works differently in Firefox um that makes it so that it can't embed tweets using Twitter's own integration thing um it's just weird um I don't know I I'm I can't be bothered fixing it I'm sorry uh all right so we're on break so we're gonna resume in a bit um okay and then the cross product is is a strange one uh but it's useful but it's strange um we're gonna get into get into a use case for this uh after the the break I should probably go to the bathroom while I want to break um so the the thing about how mathematical formulas were discovered um one thing that I find super fascinating about math is that vectors are a pretty modern concept um like quaternions predate vectors even though quaternions are like way more complicated in our view because we're so used to dealing with vectors um but but like quaternions came before and they were like Supernatural for a long time um which I think is kind of weird um this whole thing about coordinate systems and vectors and Dot products and whatnot is pretty modern it's kind of weird why are quaternions somehow more the more advanced archaic ones because they had a very very strong focus on algebra and not a very strong focus on like spatial relationships in Virtual Worlds and so I feel like it's probably like a use case difference all right let's see how are we doing on break time okay a little bit um any questions thoughts I was kind of hoping we would have time to go through trigonometry today but we don't um I believe unless we speed around trigonometry but I I don't want to do that okay that has YouTube chat doing his YouTube chat doing okay talking about Firefox quaternius have one of those Mysteries of the world um yeah it's a um it is a mystery uh experiment with the cross method on Android gizmos is there a certain function to use or do you do three separate floats of oh um you you would generally use a built-in function so there is a vector3. cross so that gives you the cross product between your vectors so that's what you would use generally to calculate um will we talk about how to use time.deltatime correctly uh yes wait did the stream die uh did it just die for Anton oh it's back okay we're good uh yes we're going to talk about frame rate Independence yeah so yes we're gonna do that um [Music] okay it was offer a little bit strange can't believe you matched your cat ears with your hair that's so cool I mean your ears generally match the color of yourself right so I don't know that's just kind of how how nature works right okay all right I think we're ready we're ready to continue uh presence check um it's being weird on your end too that's strange uh I don't know what to do about that so I guess I'll just continue as normal and if it keeps getting like an unwatchable let me know if it's like cutting out important stuff um yeah I don't know if it's on my end or if it's on YouTube's end or I'm not sure yeah hopefully the VOD will work the um status looks fine on my end YouTube says everything's fine uh okay you're all you're all here good okay um I wish we had a little bit more time to talk about rotations I think we can maybe do it a little bit today um you know what let's do a little bit of rotations we haven't even talked about angles yet but maybe that's okay um or no that gets into trigonometry hmm I don't know let's do a use case for the cross product because we just talked about the cross products um just making sure I didn't miss any questions I've forgotten a lot of math from high school that's why I'm going through all of this because you tend to um okay wait is there a two minute delay that would not be good uh uh okay someone type bananas in chat quickly now as fast as you can just to test the stream delay go for it okay yeah that's not two minutes um and now we just confused the hell out of whoever's on a longer delay um Okay cool so it seems fine in general um all right so let's see I guess we should just clean up this whole thing a little bit uh okay you're gonna reset the page everything's up to up to speed all right so many bananas in chat geez all right um so I'm bringing back our little little terrain situation here but excuse me um all right um let's actually bring some lights into the scene because that's kind of hard to see 3D geometry um create light directional light perfect that's too intense let's let's reduce this a little bit there we go okay so I'm just creating a rough approximation of a Terrain right now because I I don't know how to use the unity's terrain tool because I never make Terrain in unity uh and so so we're just gonna not use that so we're making a very fluffy cloudy cartoony terrain here let me determine some some cubes because because why not all right because now we're doing 3D stuff and it gets a little bit more complicated now um and so let's say that you are um let's say that you're playing a game like uh OverWatch I presume some of you have played OverWatch many of you familiar with it or maybe Team Fortress 2 that also works uh in both of these games there is a class that has the ability to place uh turrets on the ground like little um automated robots that can fire at people right like little little guns that they can place on the floor um and so let's let's imagine this being the turret we can create a child object here uh I'm doing some doing some some turret guns these are guns just imagine that these are little pew pew guns um and so guns there we go um actually the orientation of this is terrible um need to fix the orientation let's fix the scale too there we go create a child objects I know how to click don't judge my clicking me we did it uh this is a little turret if you are uh playing a game like um like OverWatch or um or Team Fortress 2 like any game where you have a character that can place a little automated turret somewhere um maybe the Turret only has a limited angle it can like uh fire in right maybe it can only turn a certain amount like maybe it can't turn all the way back right and so the direction you place the turret in matters a lot right um but what if the surface you're placing the turret on what if that surface is rotated um and now you want to place a turret on that surface but what orientation do you pick for this turret because when you're aiming on the floor you probably want to pick some smart rotation for this turret but what should that orientation be is kind of the question right and this is a a use case for the cross products because now we have a set of vectors that we want something to be perpendicular to but we also want to constrain this to another Direction and so this is I'm going to show you a little use case for this um let's just change the the pivot point to this one uh to be on the ground there we go there we go okay so now we have this little turret placement problem um and so let's let's solve this let's see if we can we can work it out so if we create a game object we're going to do a similar thing as we did before of kind of like the the laser where we have a game object that shoots a beam and that's going to represent the direction the player is looking um we could we could make it so that we use the camera when hitting play mode but that seems like it's annoying um I guess we could use the camera directly um let's do that I think instead of an empty game object um where is the camera there we go so here's our our player camera the Beautiful so this is going to shoot a laser to to place the object okay let's remove the colliders from the turrets to not interfere with our recasting all right I'm going to add a script to this so this is going to be called the turret Placer come on Ryder I believe in you I'm going to keep using our trusty Andre gizmas it's so nice I don't like having to press play all right so now we're gonna raycast from the center of the camera so the center of the camera is basically going to be where the player is looking right that's that's where you generally place a Crosshair in an FPS game um and so when you activate the turret you want to place the turret where you're looking and so we're going to use that to get information about the surface we're going to raycast through the middle and hit the surface as we've done this before um so physics Dot ratecast uh and the origin is going to be I guess we can set up array um rats uh transferent opposition transform dot forward so for what is the z-axis uh cameras have the z-axis forward good thing to remember um so forward is going to be the direction of the Ring and then we're going to raycast and then we want to get information about that so we need the raycast hit yeah I'm sorry I deleted the rat all right okay so um now we need to figure out how do we want to place this turret we can start pretty basic uh to just like let's just put the turrets at the position um then we're going to need a reference to the turrets so that's a transform uh turret um we're also going to need to make sure that we have it assigned otherwise we don't want to do anything um okay let's recompile select our little turret and then we're assigning that there all right so now we're gonna do a turret.transform DOT position equals um the uh hit dot points so we're just moving it to that location now this is kind of the first step to doing this kind of kind of algorithm right so there we go we have a turret uh maybe we can do do split view for this really valid so now we if we look around you can see that the the turret is sort of adapting to wherever we're looking so now we kind of have a first step this is getting close to what we want but obviously it's not perfect um because it's not not looking the direction that we want it to look right um but if we wanted to look the direction that we are looking in um we kind of run into run into a little bit of a problem um so if we make it just look directly in the same direction as the camera it's going to look into the ground right and we generally don't want it to do that we wanted to be aligned with the ground but in this case it's just not going to be aligned at all right um and so if we set the rotation as well so it was a turrets dot um oh I guess the turret is already a transform so turret dot rotation um we haven't talked too much about rotations yet uh but long story short one way you can uh one way you can create this create rotations is using the quaternion class and there is a quaternion class or quaternion function called look rotation um and so so we can just set it directly based off of some direction we're looking right um and then um let's see so we can use the direction of the rate that's what we wanted to use right so Ray dot Direction didn't we discuss something similar yesterday projection planes uh yes this is related to that okay so we recompile and see what happens so now we've set the turrets to use the same pointing in the same direction as the camera obviously this is not really what we want either because now it's not flush to the ground we want it to be aligned with the ground not like pointing down into it like if we're looking down like this we still wanted to point forward right okay and so this is where the dot product or sorry the cross product has a very good use case um so um we can start reasoning about our problem on paper as usual because that is a very good place to start okay it's a little bit complicated to do this in 3D though um trying to think of how I want to draw this um we could possibly do it sort of in 2D um so let's say you have some surface and you have your your camera or an eye looking somewhere in um and you want to place a turret at this location um and so what we want to find is that we want to find the directions that would make sense for this object would be a vector that is pointing forward like this this is kind of what we want right we don't want it to point um into the terrain we don't want it to be completely flat we wanted to point along the terrain right so this is going to be our forward vector or our Z Vector so we want to find that somehow right um okay so what other information do we have about the the surface we hit uh well we have the normal direction right and the normal Direction that's practically that's what we want to be our up Vector right like this is the direction we want to be the turret should be pointing up at right uh so this is our y vector um but then uh we're still left with the problem of what orientation do we want around y um because again in a on a 3D surface um if this is you know some sort of surface then the rotation around y could be anything like we can't just align with the normal we also have to decide somehow which direction this should point at because we want the turret to point forward right um okay and so what we can do here is that we can actually utilize the cross product uh between the direction we're looking at so this camera has a direction right um and so if we take the cross product between the direction we're looking at and the normal of the surface we actually get the x-axis for this let's see z y then X would point to where the camera I suppose so then we would get the x-axis because the um because the x-axis now that we get from the cross product um between the kind of the The View vector or the camera vector because it's perpendicular to the normal it's guaranteed to always point along the surface because the the normal direction is always 90 degrees off and because the cross product gives us a vector that is perpendicular to both of them it has to necessarily be along the surface itself um so that is usually called tangent to the surface so if you if you imagine a a 3D surface um that was a very extreme angle if you imagine a 3D surface like this uh the usually what we call the normal Vector is pointing directly out from the surface that's a normal and then a vector that is pointing along the surface is called a tangent um and there are an infinite number of tangents you can pick any any Vector pointing along this circle right here and those are all tangent to the surface right um so the cross product will give us a a tangent Vector based off of our viewing direction right and so we can use this to get um yeah to start constructing a coordinate space right um yeah and so in some cases you have a canonical tangent a tangent that we've defined to be the tangent in that case you also have another Vector that is perpendicular to both of those um and that's called a bi-tangent um mostly shows up in rendering um if you're if you're into that um oh wait this is the wrong way around this is a right-handed coordinate system I'm sorry I messed up I don't know how to erase this now I have to erase the entire word oh no um I think right yeah there we go okay all right anyway um so we can we can start here in order to construct the orientation for our turret um okay what's a buy tangent again the by tangent is the cross product between the tangent and the normal and it is perpendicular to both of them and so it's it's kind of the the coordinate system the basis vectors of the coordinate system that we usually call tangent space foreign though yes but sometimes you have a canonical tangent so that we that we kind of name the primary tangent and if you have that then you also have a bi tangent um so again in rendering this comes up a lot if you're doing normal mapping you need the concept of a tangent and a by tangent Direction um yeah so if you're using normal Maps this is a thing so the buy tangent is a tangent in in and of itself as well it's just that it has a special name if we have a canonical tangent um okay so the new forward we want would be the by tangent of the normal tangent uh that might be the case I actually haven't thought through this problem too much uh so that might be true um I'm kind of busy just putting out all the information um so let's let's draw them let's let's do some let's let's do some some math um okay so first off we might want to draw the normal so um okay let's use draw ring this time um so we're going to do hit dot position or point and then we're going to do hit dot normal I also want to draw the line from the camera to the point we hit um so draw a line between um let's see the script is on the camera so transformed our position I guess we should do array dot origin and then hit dot points okay um okay let's color these by the axes that we want for the turn so we're gonna make this one green because we want we do know that we want the y-axis to be pointing directly out of the surface right and so we we have one of our axes uh down already so that's hit.normal uh so we can actually just type that out so we we can do Vector three um y-axis and we'll set that to hit.normal and then we can draw our y-axis there and then we want to draw that one let's set that one to White all right um there we go we can see that it's hitting the surface and then we get the the green line is the normal there right uh so if we move this you can see that the green line is changing hopefully um so we're moving this along the sphere just like we did with the laser we're getting this information about the the direction uh out from the surface itself um and so now what we can do is that if we do the cross product between the direction we're looking in we're a little bit rotated now um ah jeez oh no uh if we do the cross product between I don't know how to fix my rotation there we go Euler angles I don't like this um so now if we do the cross product we actually get a tangent to that um attendant to both the direction we're looking at um and the or something that's perpendicular to our look Direction and the normal um so let's let's do that uh so Vector three um isn't that would actually will actually give us our x-axis so vector3 dot cross so we're going to do the cross product uh and let's see I need to think now so if we again use a left hand rule to figure out which direction it should go uh we want to want it to point right um and so if the a input is that the look Direction uh then let's see so this is the look Direction This is the y-axis um then we're going to get a pointing left so we want to do it the the other way around so we want to do normal cross look direction should give us the x-axis here um so hit dot normal um and then we have the um the y-axis which in this case is the normal two but also keep in mind that the um no wait sorry not the y-axis uh where are we going to do the cross product between um the ray Direction sorry the direction of the Ring I think was that the order no we'll stay the way around y-axis and then the direction of the Ring um I think uh yeah okay and so let's draw that as well returned it's a new color let's draw draw the x-axis first just to stay keep things in order all right there we go so now we have an x-axis here there's one more thing we need to take care of though before we move on um if I rotate this one so that it's a very shallow angle you can see that it's very short right so this is not normalized the the cross product makes it shorter the more similar the look Direction and The up Vector is to each other um and so we need to normalize this and so we can use the property Dot normalized um so now if we make this shallow and then if we recompile you should see this one changing length there we go okay so now we have some sort of x-axis so the one thing we're missing now is the forward direction we have our upper direction we have our right direction uh but we don't have forward um but like I mentioned before if you have uh uh it's summer here if you have two perpendicular axes and they're normalized then if you just do the cross product between X and Y you get the Z Direction and so we're just missing that one cross product um and so um we get our z-axis which is forward by doing the um by doing some typos so we do the cross products um between the x-axis and the y-axis and then since both of them are normalized we should we should not have to normalize it if they're already orthonormal as in their orthogonal and normalized the cross product is also going to have the length of one so this should give us the z-axis so let's see if that works and there we go you can see that we have built a little coordinate space now uh but we need to apply it to the turret because the turret doesn't use it at all right now uh we probably want the turrets to you know actually use that orientation um and so we can use our our trusty look rotation again but now we can supply the forward and up vectors directly because now we know the z-axis and then the up Direction in this case is going to be the y-axis uh you don't really have to know too much about quaternions uh you can sort of just know that this function gives you an orientation given a forward Direction and an up Direction um so now we should have a turret that is reasonably uh oriented um except it off it's offset by 90 degrees because uh did I use the wrong ones maybe it's the wrong order oh yeah I put the x-axis should be the z-axis so Z and Y for the look rotation okay there we go uh we got our turret and so now if we move this around you can see we're getting a way more reasonable um way more reasonable placement for this right like it's kind of pointing forward but it's still aligned with the surface which is really important for us to do right um yeah and then we we have some roll that keeps happening um yeah and so so this is just one way you can you can start doing these types of alignment things um all right and that's kind of what the what the cross product is often used for uh this process um I believe is called orthonormalized uh orthonormalization uh I think it's the gram Schmidt orthonormalization something like that you can Google it and you'll find something along these lines if you want to want a mathematical definition of it um would you have to do a special case for when the incoming Direction and the normal are parallel um yeah so it kind of depends on how you code this there there's not really just one answer for how you should Orient this um like for example you could make it Orient to the camera up Vector instead um because you can see that it's sort of slightly off kilter if we wanted to point more directly forward right um so you might want to point more like this so then you have to align to different vectors but but yeah quite often you do have to special case once you start looking too far down because then you get pretty strange results right um yeah um yep all right I think that might be yeah that's about all we have time for today um so we should think about kubernet use projection planes here um you could probably if you want to um I think that would work too if you want um I would just solve it with cross products instead but you can do it the other way around as well uh all right so I think we need to figure out some assignments um I actually don't really know what assignments to give now oh no usually the turret is the assignment um they're the same thing implemented differently um I mean quite often you can get to the same result using different methods um that doesn't mean that they themselves are the same thing um so usually there's many different ways of solving this like again there's not one right answer for how we want to do this type of thing like for instance one thing we might want to do is that maybe we want the forward Vector to be um maybe we want the forward Vector to be aligned with the up Vector of the camera for instance like there's a lot of stuff we can do here to improve this right can you show the code again um if your turret keeps teleporting uh you might have colliders on your turret because then the ray is going to hit the turret itself and it's going to like go close to the camera and then it's going to jump forward again and then go close to the camera and then jump for a bit so be sure to be sure to remove colliders uh no the you don't have to turn in any of the assignments uh they are all they are all optional uh and so you you don't have to do any of them you can just be lazy and do literally nothing but if you want to learn then the the assignments are designed for you to learn right um as I would encourage you to do it because it's useful to know these things um so so yeah and feel free to like do things together with other people uh just make sure that you are kind of on the same level so that you're not don't team up with someone who just knows the answer because then you're not going to learn anything team up with someone who's about on the same level as you so then you can try to figure things out together so feel free to do that like whatever whatever format you think you will learn best in um and copying from someone who's already solved the problem will not make you learn anything um just things to consider um what do I do if I get completely stuck tomorrow uh then it's over you just you're you're um but yeah talk to classmates uh try to figure things out step by step um so always good to talk to everyone uh and share information and learn together that's kind of kind of something you should do in school you know um okay all right do I come up with assignments after the stream or do I try to do it live for I only have like 15 minutes ah jeez the turret was going to be the assignments and so now I need to do something else oh God I can feel the pressure um I think usually the turret is my Kent canned example that I pop open hmm portal gun uh no maybe make a person standing upright but it tries to face away from a specific object um that could work yeah um um well there are two assignments I want to do one should be related to matrices and space transformation and the other one should be related to um yeah I think I think we can just make a more advanced turret um yeah I think that's what we're gonna do um and so yeah I think I'll do this uh off stream um and so I will give you the assignment as soon as I figured out a good assignment I don't want to like do this live um and uh let's see yeah I'll just do the the assignments offline and I will send it to you as soon as they're ready um oh and I guess if you're on YouTube uh then the assignments will be in the comments whenever they are done um and so you know they won't be I won't be sending them to you privately because I don't know you if you are on YouTube so you know um isn't it already facing away not really uh technically I have a bit of a subpar solution here right like if you look at this you can see that it's kind of rotating to the side generally you don't want that to happen um and so it's kind of an incomplete solution uh and so if you want a proper solution there's more work to be done and other things to um use the cross product with and so so I think I think maybe the maybe the the first part of the assignment could be to recreate this turret and then do a few things to fix it up I think we can also do some Matrix related stuff related to this turret uh like getting local positions of it um like deciding the projectile spawn locations using uh local offsets and matrices I think that would be a good one um yeah and so I think I think something like that will be the assignment but again I will send it to you students later if you are on YouTube watching this after the fact fact it's going to be in the comments um and so yeah I think that's all we have time for basically I guess we have 10 more minutes I don't know what to do during these 10 minutes now I thought we had less time left um okay are there any questions uh uh about anything we talked about today elevator music I'd you know I wish but I would get a copyright strike that's why I usually don't stream on YouTube because YouTube is vicious with copyright strikes and twitch is not and so but I don't do music during my lectures so that's why I'm here backflips uh I don't know how to do backflips I'm sorry uh thank you for an amazing lecture thank you I'm glad you appreciate my scribbles did you write out the actual formula for the cross product uh yes here's the formula uh the top one is the X component so it's x y z so I'm writing this in the column Matrix format um how different is using the Matrix functions compared to for example just changing an object's transformed opposition or rotation um I mean they're they're used for different purposes right and so I don't really know how to compare them um like if you already have a transform that you want to move then you should use the you should set transformed opposition and rotation and whatnot right but if you don't have a game object and you don't have a transform but you want a coordinate system somewhere in space you would use the Matrix type instead right so they have different use cases uh unrelated question but will you visit us on site Stockholm during any of these days uh I usually don't plan for visits um but with the the previous class I uh we've gone for lunch a few times and I mean I live in Stockholm so it's very easy if all of you want to head out for lunch someday you can just I think just just let me know and we can we can have lunch um uh rip the north yeah I'm sorry don't go taking a train all the way down here that would make me feel very I would get like imposter syndrome and feel bad for not not justifying a trip so you're not missing much um all right people are typing I should drink water when is the next lecture uh on Friday at nine your permits are taking so long um what kind of permits oh are you like not in the Stockholm or a resident permit right yep okay all right um International students gotcha uh um okay all right well if there are no more no more questions or thoughts I could turn to YouTube chat see if they have any thoughts or questions before I leave um yeah and then I'm gonna enjoy my post-lecture headache that I got that I get every time which kind of sucks I don't know why I always get a headache afterwards I think it's because I'm talking so much I almost never talk unless I'm doing these like very long streams where I'd like talk constantly okay all right um when can we expect to have the assignments ready um at the very least tomorrow morning um maybe tonight depending on factors um I might be very tired because I was very sleep deprived this morning so I might have to take a nap I might get a very strong headache that I sometimes get after lectures and so it might happen tonight but um I will try to get it done tonight but uh at the very least it should be available tomorrow morning um because the tomorrow is a dedicated day to work on the assignments and you're also free to work on the previous assignments uh even though you've seen the answers already maybe you forgot the answers and then you can do them again and try to try to figure it out because again it's just it's just for learning and getting used to using these things right um important questions will you know cat ears bonus assignment again this time uh yes I can I can try to figure out an advanced assignment for the for the cat ears um the truth that is an important question it's a good motivator good I'm glad it works that's it's actually better than for the previous students I usually use the um my twitch Channel points to redeem the cat years and the students can only do it if they've been watching the channel for long enough um so usually it happened like at the end of the streams but but this is a good motivator it gets you it gets you gets you wanting to solve the problems you know like we say it's a use case it actually leads to an important result an important desired result that's why we solve problems right okay all right any last questions before I escape to YouTube and then Escape into not streaming sleep well yeah I will I'll try to not nap today I need to get my sleeping schedule in order [Music] um okay cool uh yeah thank you all thank you all so much uh I hope this was this was educational and you learned something today um and uh so yeah I think that's it uh thanks for joining no more crucial information feel free to tune out and leave um and and yeah I'll stick around for a little bit if you have any like remaining questions and I'm gonna read YouTube chat for a bit uh otherwise the next lecture is going to be Friday at nine um between you're gonna have an assignments I'll get you the assignment at the very latest tomorrow at lunch I should definitely have it ready ideally I would have it ready um in a few hours but depending on what happens and how how garbage I feel um I might not get it ready in time um but it will be available for tomorrow to work on um which is the important part uh but yeah thank you all so much for for joining uh and I will continue on Friday uh okay YouTube chat now YouTube chat is going to start existing um uh have you read a book called 3D math primer for graphics and game developments uh I don't think so no no I don't have um the thing is I don't I don't read books like there's a lot of people who ask about books but I just I just don't read books for anything that I learn um so I'm sorry I don't have any I don't I don't have any advice um in terms of reading um will you rename this to part two uh no this is going to be this is part three and then the previous one is going to be part two right I think I named the previous one part two maybe I didn't maybe I called it part one okay I'll have to fix that oh yeah it's called like part one assignments Solutions or something I'll I'll fix the titles it's fine um um oh yeah so in terms of assignments I'm not going to grade them I think uh someone you might get separate assignments from Crystal um but I'm not the one responsible for that and so I generally I actually just don't know um what the plan is there um so I think crystal is gonna do your assignments okay do you have any book recommendations no um all right foreign excuse me um guessing there's no more questions from YouTube chat um oh someone asked how to join the class um you you have to like apply to Future games which is like a two-year education so it's not just a one-off class uh that you can kind of join easily or long term or short term it's a long-term thing um when will the Shader course be um I forget I think it's in my calendar somewhere it's not too far off I think it's in a few weeks uh I don't think I even marked that in my calendar but it's at some point it will will happen um have you thought about the video production value maxing out more if you had a big Photoshop notes down for these lectures what not that would be a pretty good reference um I don't know what you mean by maxing out more as opposed to what hmm wait two weeks of math and then shaders I don't think I have hold on I need you to check my DMs now no the Shader chorus is in December yeah you have shaders on the 12th of December yeah that's your shaded course according to my calendar and what Chester told me um I believe oh data structures and algorithms this next right okay okay cool yeah I'm gonna do your Shader course we're going to learn how to do pixels and vertices [Music] yes I'm gonna I'm gonna do your Shader course that's that's planned so yes it sounds like you appreciate that fact all right [Music] um okay set in the last things before I leave someone asked how how old they are I don't know how old you are okay all right I think that's it thank you all so much for joining I hope this was useful I hope you learned a thing or two um sorry for not interacting with all of you on YouTube um this is again primarily for my students at future games and so I'm kind of not not very actively reading YouTube chat only a little bit but don't don't tell that to my students um and uh yeah uh feel free to feel free to join my discard server if you want um if you want to hang out with other game developers uh then then you can go to my discard here um and and uh uh if you want to support me financially for doing the things that I do doing like public education stuff and like educational videos and that kind of stuff uh feel free to support me on patreon um you you might also if you support me on patreon you're going to be in the credits of my next video on splines which is um which is almost done I've been working on the splines video for about a year now um so I hope you will like it it's been a an extremely long journey just to get this one video done um but but yeah if you want to support my extremely long videos uh feel free to go to patreon um it is it is like my my most my half of my income is from patreon so a lot of a lot of you guys are supporting me which I very much appreciate um all right um otherwise uh thank you all for joining I don't think you have anything else I want to plug because it's hard because I don't have my buttons that I have on Twitch um but uh but thank you thank you all for joining um and I will I will see you all next time oh next stream like this is gonna be on Friday uh 9 00 a.m CEST if you want to join for that I'm going to put up a thing on YouTube as well if you want to pre notif notification enable this that stream so all right thanks for joining uh and I will see you all next time bye
Info
Channel: Freya Holmér
Views: 103,907
Rating: undefined out of 5
Keywords: Acegikmo, Freya Holmér, Freya, Holmér, Twitch, Unity, Unity3d, math, vectors, dot product, scalars, numbers, mathematics
Id: gVgN5SU6BrA
Channel Id: undefined
Length: 186min 44sec (11204 seconds)
Published: Wed Oct 26 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.