How DOT PRODUCT works in Blender - Geometry Nodes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today going to learn how to use dot product in Geometry nodes and I we show you some examples so let's see so here I have a simple setup with two simple vectors we have the blue Vector where here I can move it is just a simple point with an sphere as instance connected with a curved line to this position and to the center of the wall and the same with the red Vector so we can visualize better these two vectors now what I want is to bring dot product and see what is so let's bring Vector math and leave it here and select dot product first of all I want you to notice something look at the output it says value it's great that means that is a number of load however if we select something else for example this you see is a vector or any normal Vector operation we always get a vector except if we select do product so what it give you is not a vector it's a simple float number a simple value now let's connect this here and this here and now let's try to visualize this value with a text so let's convert this value to a string remember a string is a text and now let's convert the string to curve string to curve and let's connect it here so now in theory here we have the number it says one but let's give some mesh so let's add field curve and we can see one what I want is to move it here so let's add transform I'm going to do a group of these I'm going to select all these and this one and press control G so I can work better here and what I want is to move to rotate this number so 90° and I want to center it and I want to move it here so I'm going to move this axis and what I want is to show more decimals so I'm going to click twice okay I'm going to press tab to go out so this is just to conver this value to a text that's all now we can see the dot product between these two vectors and we see this number so let's try to move this and see and see which numbers we get more or less so you can see that depends what we do we get a random number that we don't understand what does I mean right however we can say that now it's negative okay so to work better I recommend you to normalize both Vector so at Vector math and select normalize this is going to conare this Vector to a scale of one and you have to do the same with this one why because doing this it doesn't matter if you move one really far away that always will get more or less the same number for example if I try to push this one you will see that now it doesn't say something like three point Etc if I mute this you will notice that the number is really high so always try to add normalize before the product so we have this and now what does it mean that basically the product when you use two vectors normalized really important it give you a value between minus one and positive one so whatever we change here always we'll get this range of numbers so why is useful to use the product the product is useful to know the relation between two vectors it tells you how similar two normalized vectors are I repeat how similar they are and it's really easy I will show you I'm going to select 0 0 and leave this one here and this one for example here and here so the important thing you have to know is three things when the angle between two vectors is less than 90° then this number is going to be positive now when the angle is higher than 90° then this number is going to be negative and when the angle is exactly 90° then is zero I repeat if this is less than 90° is a positive number if it's more than 90° for example 120 is negative and if the angle is perfectly 90° then this value is zero so let's check it for example if I select this in 90° so one value and this zero you can check that now this is perfectly 90° so equal Z and if I move this in this axis so this is less than 90° always is positive however if I move it in the other direction so now it's more than 90° is higher then the value is negative and remember always the range is between minus one and positive one so as you can see I can move this in any direction remember it's normalized then now for example is giving almost one that always is going to give a number between this and this one and if you want to get exactly one then what we have to do so as you can see when both vectors have opposite directions and the angle is perfectly 180° then the value is minus one however if we match the direction this will be the opposite will be perfectly one because we have 0 degre now I'm going to use two enties to control these two vectors so it will be much easier to move the vectors and see how this number change so here I have the 2s to control the blue one and this one so remember when they are not really similar in the directions is basically negative when they are really similar in the directions so more or less are facing in the same direction they are not but this is telling you how similar they are so that's why when they match almost it give you one now when they match perfectly it tells you it's perfectly similar they are aligned and if they are opposite then it tells you with minus one so more or less like now by the way here you have a gift that show you this relation with that product and two vectors so basically the product is a number of a relation between two vectors and now you are thinking okay but what I can do with this number well you can use this number to create Roots so depends if two vectors are really similar or not you can decide to do an action for example let's bring a cube here so let's create a cube and connect it in J and now what I want is to scale this Cube based in the number so let's add transform and what I want I'm going to move this here is to get this number remember this is just a text but the important thing is this value and I can connect it here so now if we move these vectors you will notice that the scale is changing what is happening basically is just sending this number to the scale of the three axis so right now when the vectors are align the scale is one it's giving one one one in the three axis almost one and when this is for example remember 90° almost 90° that means that the scale is zero so that's why disappear and if we move it in the other direction the scale is inverted minus one so it's reversed if you don't want to reverse said when they are opposite what we can do is to adhere and map range and if we add a map range we are defining this range from zero to one so we are deleting the minus one that means that now when it's in the range of negative it doesn't work however when we start being positive so in this range the minimum start increasing to maximum one if you want to increase the scale then you it increase this value this is like the maximum scale that it can achieve in this range so for example I can say five so what I'm saying right now is that when the number is one the scale is five let's see another example for example let's do a simple selection now I'm deleting this Cube but what I can say is only delated for example when this is matching or they opposite so let's connect this here and now if we move this it's going only to theate when it's higher than zero so let's check it why because remember selections always is a Boolean that means that always select what is higher than zero so if the number is higher than zero then it applies the delay geometry however if you want to control this what we can do is at here a math and select compare or greater than so now what we're saying for example let's check it let's move this we are saying only delate it when it's greater than 0.5 so this is like a filter right we get this value and this is only selecting only applying the delay geometry when this number is higher greater than 0.5 so in this range it's been delayed however when we cross the threshold wh it appears because now is less than this number so we are creating a simple rule if you want to pide so show it now and delet it when they are not really similar then we have to select less than so now we are saying the late the geometry when is less than this number so after this or we could Define for example zero so if this number is less than zero Delight it if not appear so you can see you can apply this to any selection okay now I'm going to show you a better example because maybe you are thinking okay but I'm not going to use most of the time two vectors to do that product so show me something more interesting because I see that some people use it for example in simulation nodes and all this so let's delete this Cube at an ecosphere let's go to here and add more subd divisions and I'm going to delete one vector for example this one let's delete this and one empty I'm going to stay only with one empty so the important thing is this empty okay this line is just to see the line from this position to the center of the wall and now what I want is to get the normals of this object why the normals I'm going to WR all this because remember the normals are the lines perpendicular to every face right every face have a normal so these normals are directions are line from the center so we can compare this position for example with this normal so this angle so let's see it look I'm going to use this empty and now call the normal of this geometry nodes that will be the normal of this icosphere by the way when we use a normal we don't have to normalize it because a normal it's already an a scale of one so we can delete this now as you can see the text disappear why because now it's using the information of all the normals so we don't have only two vectors now we have a lot of vectors and it's impossible that this note that is showing one text do you remember show now hundreds of text so that's why this appeared and it show it in Red so now this doesn't work this text only works with one value not with hundreds of values so a tip when you see this type of lines with Dash that means that is more than one value and this note only works with one value that's why now it's useless so I'm going to WR this and what is happening right now is that this position this line is being compared with all the vectors and remember we're applying going to move this here if you want we're applying at the leg geometry remember we have an ecosphere okay I'm applying this note and I'm making a selection based in the the product of this position and all the normals of the iOS sphere and is delighting only this part Y and if I move this look at this always what is in front what is a line similar is being show but what is in the opposite direction is being delay why for the same rule that I explained you before because now we are saying delate the geometry so all the geometry of the ecosphere the faces edges points Etc when the V with the normal are less than zero remember dhere have a lot of normals so I'm going to draw these normals the ones that are being delayed now these ones disappear because the angle is higher than 90° so if it's higher than 90° remember when was 90° was Zero when was higher than 90 deges was negative for example here will be I don't know Min 0.8 and for example here will beus one right so with this rule we are saying a every normal compare with this position that the dot product is less than zero so all this range deleted that's why the behavior is this because it's comparing in real time with the normals of this object but also we can change this if you want to make it smaller then let's increase this number so for example let's say that every normal that the comparison is less than Z 9 delated so now it's only showing almost the normals that are really really really similar to this position and we can decrease and show more and if we select remember until minus one or more then we are saying don't delay anything or we can do the opposite greater than so now it's deleting all the faces that the normals are really similar to this vector and I can say for example delate everything that is higher than zero and this you can apply in any selection for example let's delete this and apply a set material and let's select a material for example blue and now let's connect it here and it's the same now we saying only show the material in the faces that the normal is higher than zero so we created this a and I can reduce this range by the way if we add most of Divisions we have more resolution so as you can see it have a lot of uses I could be one hour explain you a lot of examples but don't worry I will do more tutorials where you will see some uses of this do product at least you know how it works so I hope you learned something new and if you like this video give a like subscribe and you can Don this project and many more on my Paton and see you in the next video
Info
Channel: Xan 3D
Views: 1,238
Rating: undefined out of 5
Keywords: Blender tutorial, Dot Product Geometry Nodes, What is Dot Product?
Id: re6GYS2bMSE
Channel Id: undefined
Length: 19min 0sec (1140 seconds)
Published: Tue Jun 04 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.