Create a Reveal Effect in Blender Geometry Nodes using Linear Falloff

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi there this is mama casasola merkley within tagma with a new geometry nodes tutorial today i want to show you how to implement a linear falloff inside of geometry nodes to use it with an instancing setup to create a particle-like reveal effect let's get started by first deleting everything that we have in our scene as we won't need it now we need a geometry to put our instances on and for that i downloaded the geometry this hand here from scan the world that is called hand of the genius of liberty you will find the link in the description let's bring it in by importing a wavefront object as i converted the stl that i downloaded to obj import and it will bring in the hand geometry it's a little off-center so let's center it by moving it along the y-axis and after that centering the pivot by going to object set origin origin to 3d cursor which puts the pivot here great so we want to put instances on this hand to do this we need a new viewport let's create one and let's switch this one over to geometry node editor and with the hand selected press new and call this note 3 reveal like so the first note that we will need is point point distribute to put a lot of points on the surface of our hand let's switch this from random to poisson disk as we want to have points that are not intersecting and increase the density to say 10 000 for now that gives quite some points but now we can increase this distance min value to 0.03 or something to have a decent packing here but at the moment we are looking at dummy geometry let's change that by introducing a new cube and using that as the instance geometry by going back to our hand and then creating a point instance node put it directly after the point distribute and select the cube here that gives large cubes on the hand so let's go to the cube enter edit mode and scale the cube down quite a bit let's see even more until we see the individual cubes on the hand something like this is good now we have a lot of cubes on our hand now we want to implement linear falloff let's quickly think about how we can do that to define a linear falloff we need a line in 3d space so let's say we have a point here and we have a point there and between these two points we have a line in 3d and now we want to project the position of all these instances onto this line then we can tell where on the line these instances lie and we can calculate a percentage and this percentage can be used as a weight say we want to know the weight for this instance we just form a vector between the starting point of our falloff line and this instance and then project it down onto the line that gives a location on the line if we then compare the length of the entire line to this segment here we have the percentage the weight and we can do this with this instance say and we create another vector to here and project it down and then we have this location and another weight so that is a principle but how can we project one vector onto another vector we can do that by using something that is called the dot product dot product and the dot product is defined like this if you have two vectors a and b a dot b the dot product will be the length of a times the length of b times the cosine of theta the angle between the two vectors so what does that mean well if you think about high school you probably talked about trigonometry where you had a circle and inside of the circle you had a triangle and the triangle had three sides and these were called hypotenuse opposite side and adjacent side there is this nice mnemonic called soca toa to remember the trigonometric functions car stands for cosine so cosine cosine of the angle between these two lines theta in my case cosine theta is defined as adjacent over hypotenuse and that means that a is cosine of theta times h so if i want to know how long age projected to this line here is i just have to calculate h times the cosine of theta and that is exactly what's happening here you have the first vector length a then you take the vector length b and multiply it with cosine of theta so you get the projection of b onto a and then you multiply it with a that means the dot product gives you the length of a multiplied with the length of b projected to a we can use this to make our falloff work so let me quickly get rid of my annotations here like that now let's implement this let's implement the linear falloff the first thing we want to do is to create a line in 3d and for this we need two points so let's create a novel an empty plane axis that is a starting point of our line and then let's just duplicate this second empty and move it along the x-axis to create the endpoint of our line so now we have two empties let's call the first one a it's a starting point and the second one b it's the endpoint now i want b to move with a so let's parent it to a like this by shift dragging and now if i move a you see b is following and with b selected i can define how long my line is and i can orient this line in 3d space however i like like so so we want to use these two objects to define our line we will need them inside of this node graph and we can just drag them in so take them and drag them in that gives two object info nodes outputting the location of these two points or these two empties and to create a line between the two i want to do a vector subtraction remember the tip first rule and create a vector vector math node and set it to subtract subtract so we want to subtract a from b because we want the vector to point to b now we formed a three-dimensional line that is the first step the second step is that we need a vector from the starting point of our line to each and every instance that we have here for that we cannot use a vector math node instead we have to use an attribute node and we want to create an attribute vector math so let's put this attribute vector mass after the point distribute before the point instance and let's use the position of all these points on the surface and we want to calculate something with a vector and we want to do a subtraction we want to subtract our a object from the position of each of these points and that gives the vector to these points so let's call this project location project lock like so new attributes storing the vector from this point to the instances now that we have these two vectors we can do the dot product so for that we need another attribute vector math so duplicate this one and set it to dot product and put it here and now we want to do a dot product between this project location and our 3d line and this calculation will return a float and this float will be the weight we can directly look at this weight by scaling our instances using this weight for that we can put down a point scale put it here after this node switch it over to attribute and let's use the weight here that we just calculated and you see it is working from the get-go so we get a nice scaling effect linear scaling effect starting here at the first object and then propagating along this line but we skipped the comparison part so how do we calculate the value to compare two think about it when should the weight be 1 well the weight should be 1 if the vector that we are projecting to b is exactly the same vector as a so why don't we just duplicate this node and set it to dot product 2 and do the dot product of this vector with itself that gives the length squared and that is exactly what we are comparing against because that is a maximum that this dot product here can return so now that we have that we just have to divide this weight by this dot product and we will get the percentage let's create a new node attribute math in this case because now we are dealing with float quantities put it here and set it to divide and now we want to divide this weight by a float and this float is the result of this dot product here and we just write it to weight again like so and you see that changes this quite a bit because now we are reaching one at this point and not earlier as before very nice and now we can go in and move this around and you see we can define how far this falloff reaches but as you see after this point the instances are still increasing in size so we want to do one last scene we want to clamp this so as soon as the weight reaches one it should stay a one and if it is smaller than zero it should be zero for that we can use the new attribute clamp node put it here directly after that again we want to read weight and we want to write to weight clamping the values between zero and one and now you see here at this point you are reaching one and after that everything stays at one so now you can precisely control your falloff and it not only works as long as this line is horizontal you can rotate this and it will still work because the points are projected to this line three-dimensionally so now we have a falloff effect that we can use to reveal the hand it's just that it's not looking very interesting at the moment to make it look better let's remap the falloff so let's go to our node graph and let's use an attribute color ramp node that can be used to remap values and we want to remap our weight before we use it for our point scale so put this ramp node directly before the point scale and we want to use weight and we want to write to weight because this should be a remapping only now you can use these knobs to define how the falloff behaves as you can see let me move the fall of a little bit so that we have a larger area here like so and now you can use these knots let's first go to our cube and make it a little larger like so so that is our one size now we can use this ramp to remap everything to our liking now we defined by using this ramp let the instances start at scale zero then increase quite a bit and then go back to 0.5 or something 0.15 let's make this a little bit bigger but now you have perfect control over what's happening here as you can see sorry wrong object so if you move your photos now you see first stuff is scaling up and then it's scaling down again which looks a lot more interesting than before this is looking nice but they are only scaling it would be good if they would change their location and not only scale up now that we have this weight attribute we not only can use it to scale them we can use it for whatever we want to so why don't we just introduce some transformations the problem with using the weight the second time is that after this color ramp the weight already got remapped and what if we wanted to use a second color ramp for the transformation well let's just use a different attribute name here so let's name this weight scar for weight scale and then of course we have to use weight scale here inside of this node and it's still working and that means that after the scaling we can introduce more stuff and we can read the initial weight value that was not altered by this color ramp let's duplicate this color ramp and put it here again we will read the initial weight but this time we want to transform it into something that is called weight location and now we want to move these instances along their normals for this let's introduce an attribute vector mass and we want to multiply the normal of the points by this weight location to scale the normal like so and this will output a vector so let's create a new attribute called dist so the normal gets multiplied by weight location and then new vector is formed called displacement and now we can use this with a point translate node point translate like so switch this over to attribute and use the disk attributes that we just created and you see it is working now everything is just transformed and this looks funny because we just use this color ramp that we defined earlier so let's go down to zero here now everything is just back there and let's create a different ramp that starts transformed and then goes to zero very quickly and that gives the impression as if these cubes would start in mid-air and then join the surface like so and to have more control over what exactly is happening let's introduce one more node this node is the new attribute map range node so let's create an attribute map range and put this attribute map range directly after the color ramp before this displacement vector creation and the attribute map range should remap the weight location attribute to the weighty location attribute because this color wrap is outputting values between 0 and 1 and now we can directly say what these values should be after the transformation so let's say minus 0.1 to 0.1 or something let's see what that gives and that gives a nice effect where the stuff is starting smaller and then going outwards but we can of course reverse the effect if we go to 0.1 and then minus 0.1 like so and now it's opposite but to make them end up on the surface we now have to change this last knot here to 0.5 to give it a value of 0.5 and they will end up on the surface so now they are starting outwards and then they are going into the surface in the negative and then outwards again so now we have a nice effect revealing this hand making them bigger and then smaller again if you have a close look though we have a little problem and that is that the cubes are placed on the surface of the hand by using the pivot so the middle of the cube is placed on the surface of the hand and that makes the hand look fatter than it actually is so let's change that by changing the pivot of this cube go to the cube then up here to options and say effect only origins and now you can move the origin by using the handles down to this bottom face that means that the bottom face is now aligned with the surface and that gives our hand a lot more definition turn this off again now we have a nice effect with good definition of the hand but it's still looking quite linear so let's introduce some noise to warp this border here to make it more organic how can we do that well inside of geometry nodes we can use textures and one of these textures is a noise to reuse a texture inside of geometry nodes create a new attribute sample texture node and put it directly after the very first node this node works like this it needs a texture so let's create one and let's call it gn noise because we are intending to sample a noise then it needs a mapping and the mapping tells the node where to sample this texture and as we are intending to use a three-dimensional noise we want to use position to sample the noise and then the output goes into a vector attribute and we want to call this attribute noise so now to define the noise going down here to the textures and switch the type of the texture to clouds and now very important switch it over from grayscale to color because we are interested in a three-dimensional noise that should be different in the three components of the vectors that is what color gives you but color is positive only the values are between 0 and 1 and we need a three-dimensional symmetric noise so let's transform this noise by using an attribute vector math directly after the noise that will read the noise and then multiply the noise by a vector and then output this to noise again and the vector is two so we multiply everything by two and then we duplicate this node and now we subtract one from it like so one and that now created a symmetric noise that goes into the negatives that is what we want and now we want to add this noise to the positions of our instances or to the positions of the points that are distributed but only for this calculation of the dot product so we only want to alter their positions when they are used here in this calculation now create another vector math node and put it here after this point distribute here we want to read the position and then we want to add the noise to the position noise and all of this does not go into noise but into position again and you see now the noise is transforming our points and this is the point position that we want to use for the dot product but for the dot product only so let's use a different attribute name instead of using position let's use position 2. so they are staying where they are but now we can use position 2 here instead of position for the dot product and that means the dot product sees a noisy cloud and thus creates a noisy edge so now we have a noisy edge here looking a lot more organic but it's hard to see due to the scaling let's quickly go over there and for now mute the displacement and with the scaling let's go down with this maximum value to the middle like so and now you see that the edge is not linear anymore instead it is noisy and of course you can anytime go into this noise texture and for example change the scaling to exactly tell the effect how it should look so let's do something like this let's see what this gives very organic and interesting and now of course you can reactivate the translate and that gives our reveal effect as you can see and now it's time to play with the settings as everything is procedural that is why we use geometry nodes in the first place so let's see what blender is capable of instead of using ten thousand instances let's use forty thousand and that works but at the moment they are all filtered out by this distance value so 0.01 will create a lot more instances now they are too big so let's go to our cube enter edit mode and scale them down to make them smaller now that we have more of them yeah even more like so and now you have very many cubes let me make the 3d viewport bigger and let's see how the effect looks and i think the effect looks nice very organic so the last thing we have to do is to animate this for that move the falloff to the front until everything is gone like so now go to the transformations of the null and set a keyframe by pressing i and now let's move the playhead to 250 move our falloff linearly through the space until everything is revealed like so and i again and we have a animation so if i now press play it will slowly start to reveal this hand and because we define the effect like this it looks as if we would use particles although everything is deterministic and nothing is simulated and that is how you can create a particle like reveal effect with geometry nodes so now it's up to you to light this beautifully and render it out and that concludes the tutorial about creating a linear falloff particle reveal effect with geometry notes in blender i hope you learned something and thanks for listening if you like what we are doing please consider becoming a patreon for supporting us and for access to more in-depth courses on topics like volume techniques or pdg or vellum and more to everybody who is already supporting us thank you so much without your continuous support and timer would not be possible
Info
Channel: Entagma
Views: 87,791
Rating: undefined out of 5
Keywords:
Id: cKDC5YE-26k
Channel Id: undefined
Length: 21min 21sec (1281 seconds)
Published: Mon May 17 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.