Procedural Handrail in Geometry nodes - Blender tutorial ENG

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to my Channel today I'm going to show you how to create a fully procedural hander rail but in a different way than other YouTubers why because in this video you will see a different approach to the making of some aspects of this asset and then you will be able to reuse this procedural workflow in your project so let's get started I'm working with the blender version 4.0.1 you know that to create a handrail we can start with a Plane 2 m by 2 m on this we want to draw a curve so we need to start with a curve shift a curve busier tap to enter in edit mode we can scale it a little bit and we can select all these points press V to set the endle type to Vector because first of all we want to work on a straight line press seven to see from the top view shift Z to see the wireframe of our Network go to plus general geometry nodes press new to create a new modifier now first aspect of these workflow we want to create the primary columns on our Point based by three parts three pieces one the base the second the column and the third a sphere on the top of the column so to do this we can add in our group nodee input two attributes one is the height set the subtype to distance because you are working in a unit measure minimum from zero and then another integer value for the column resolution this is also from zero and this is a single value also the height is a single value because we don't want to use an array of value um based by a Vertex group or similar so we don't need this button here set the height to 1 M for example and a column resolution of four and and the minimum can be for example three and default 4 the height default 1,000 save the project now we can create the base the base is a simple Cube for example 50 mm by 8 mm you are free to export this information in a group input if you want to customize your workflow more than mine now we need to transform the geometry to shift a little bit the cube enable this neap to I suggest you to enable it we can shift Up by 4 mm so the half of the entire height of the base to have the base on the surface of our plane we can set the shading smooth off and this is our base so we can select this node control J F2 phase if I press shift control and click you can see it and to have a different way to see the result I exit with the tab from the edit of the control Point go to material property select a new Iron and we select a dark gray full metallic and medium roughness for now select this button to see the preview of your material but you can see anything because we need to set the material here so before the group output we can set the material here select the iron and Link the geometry here to the set material drop the viewer and this is the result now we need the column we can start with a simple plane but there are only four edges and because we have the column resolution we can use the curve Circle and we can create a curve line to have the base and the curve Circle will be the profile of our column we can use the height in a combine XYZ and in detail the Z component to link the end of the curved line so the line will start from zero to the height H to collapse then link this curve line to a curve to MH using this curve Circle as the profile also in this case set the smooth geometry to false and shift control and right drag here with the joint geometry we can see the result so the problem here is the radius of the curve Circle we can set for example 30 mm is too much 20 for example and four for the resolution but we can link directly the column Resolution Group input attribute in this socket but you can see uh a weird effect we need to rotate by 45° the column and to do this we can take this curve Circle add a set position take the position link this to a rotate Vector new socket set 45° and Link the vector to the position position and then link this output geometry to the profile curve and this is the final result and here we have the column select all these notes crl J F2 column remember to check the field caps here and finally we need to add a sphere so we can add a sphere UV sphere with a radius of 35 / by 2 mm and because we have the radius we don't want to have the sphere with the center here so you can see if I take these and link to the transform geometry I can create a combine XYZ to move up the sphere by the height itself of the group input but there is a problem because if I now set the smooth to on and Link these to the Joint geometry you can see the center point of the sphere is in a wrong position so we need to add the radius itself so to do this we we can add a simple value a constant but keep in mind this value is not in a unit measure so you need to divide the value by 1,000 because the default value is in meter so 0.0175 okay you see here the value divided by 1,000 link this to the radius and Link these to another mathematical operation to add the entire height of the column and now I can link these to the Z and the sphere now is in a correct position and I can adjust the radius as I want if I need a radius bigger H to collapse select all these nodes contrl J F2 sphere perfect now we need to instantiate this uh entire geometry on our point of the curves is very easy to do because we can use an instance on point here but not using these result as the points but the geometry of the group input as the input here and use this result as the geometry and voila and not only this we can use the tilting the curve tilt value linking it in a combine XYZ to link the rotation of each column in this way I can go in edit mode press n and changing the tilting of each point I can rotate each column as I want select all these nodes control jf2 primary columns shift Z to see the result now the second part we can enter in edit mode link these to 1,000 mm and these to zero to better understand the concept behind the profile that I'm going to show you now we needed to create the base profile here between the points so for this reason I will reset Vector to this point and extrude on the X with a distance of 1 M because I want to show you an important thing press seven to see from the top shift Z now if I want a profile here I can easily link and use a quadrilateral object with 330 mm by 8 mm for the height and I could use the group input geometry to create from the curve to mesh using this profile the entire result of my profile and this is what happens if I set smooth to off and it's obvious I need to transform here the geometry because I want to shift up a little bit by what by the height that I can add in a new attribute in the group input as the base profile height it's a distance from zero and default can be 100 millim it's a single value and I can link these to a combine XYZ on the Z axis to shift this geometry a little bit and Link this to the curve and then join it together with the columns with a simple shift control and right drag and this is the result shift Z to see the final shape I hide from moment the plane and I switch for a moment in this viewp shading method and now you will see a bad result if I take this point and I move it if I move it look what happens these you can see the stretching of our profile is not a good thing and if I move more you can see the bad result of the entire profile so we don't want this and I know there was a a user that helped me to solve this problem only for 90° and this is because blender calculates these using the radius of each point so if I take this point and multiply by the square root of two so in this case 1.414 you can see the correct profile of my entire shape but if I take this point and go more than 90° I always have a problem because I need to retake these radius and I need to multiply by itself twice or three time to get the correct shape and here we have two other problems because I have here an issue of the shape and I don't want this result in a physical object because it's not a good result and the second issue is that if I take this point and I extrude on the Y for example to have a third Point uh the radius of this point is shared with all these three profile and I Can't customize for each piece of profile the value of the radius so it's very difficult to solve this problem in this way so the method to solve this issue is to separate each segment of the curve so in this way you don't have the problem of the physical connecting context between all the points of the curve so I set one for my radius select these select one for my radius and instead of this approach we can select all these nodes press contrl G to create a group because we are going to create more than one profile for our handrail one to the base and one on on the top press seven we can drag the attribute where we need to sort in a good way height from zero and this is a distance tap to exit and this is the hand rail profile group node now to split the edges we need mesh and not curves so we need to take this curve and transform to curve to mesh then split edges and then recreate from a mesh to Curves and then link these to geometry and I don't have the issue of before if I take this point and I move it and if I take it and I move it now here we have another problem if you see the resolution of the shape of the curve we have the resolution preview of each segment so blender set these and divide each segment by this number only if you don't have the vector handle type for each control Point connected to each other so for example if I take these and set this point here I press shift Z to see the white frame select this point select this handle and I drag this to the X you can see this weird effect so blender will start to subdivide the mesh by this resolution preview and we have a problem here because we have two splitting edges that we don't want and to avoid these we need to calculate what edges have to be splitted now to simplify this problem I will drop this point here I will move this point here and here selecting this handle and move it a little bit here like this now you can see the bad result here in this part of the mesh and I have this problem because here if I press shift control and click we have three control points so one two and three but if I press control shift to the curve to mesh we have 15 so we have the subdivision of these by this value for the segment that are in a not Vector handle type so now we need to calculate the correct split Edge selection here to get one curve here and one curve here and to make easy the understanding of this approach I will link the meshed curve in a trim curve press shift control and click and if I decrease the end you can see these batter result here I don't want these I want to have one curve here and one curve here and to do this I need to ask if if each Edge from the output of this curve to mesh has the first point on an original control point of the curve and also the other vertex of the same Edge is on an original control point of the curve so this segment has these two things but these segments not so for these segments the result is false and for this reason all these edges are not splitted if I have here another segment in a linear way like this we have a check so here in this situation I want to have only three curves one two and three now to have this result I can save for each point of my mesh an attribute I can store it a Boolean attribute for each point calling it is final point and to calculate this result I need to take the original control points the three control points one here one here and one here convert to points not using the evaluated or length because otherwise we could have the same result here of the resolution preview but we want to use the count and what count the same amount of points that has the curve so if I take these and I go in the domain size I can select from the domain the curve and take the point count of the entire curve I can take these link these but keep in mind here we have 1 M and 1 M but if I take this piece and move a little bit near to these 500 on the Y you can see we have a 1 M and a half a meter here if I take this curve to point we don't have a perfectly aligned Point here you can see this point is not here okay I don't know why this is not because blender calculates a different distance from this new curved point recounted so for this reason we can reposition with a set position these points on the original position of the curve and to do this we can easily take these link in a sample index to get the vector for each point of the position for each index and in this way if I link these to the position I reposition these control point where they was now from these control points I can use a geometry proximity change these phase two points because we have points here and because we need to store the information inside each point of our mesh because we here we have a mesh for each point I want to ask me if the position of each point of the mesh is equal or near the position of the control points the original control points of the curve and if it is true I want to save this information with a True Value here in this new attribute stored and if I press the shift and click you can see in the spreadsheet I have the first point this point is final point the second point is in a final Point here you can see these okay next we have all these points of the mesh until the end the last points that you can see has the final Point checked now if I increase these to 64 the maximum of these resolution preview and I go to the end I have have the same result now that I have this information for each point I can add an edge vertices node where I can get the index of the start and the end point of each edge of the mesh and the position of them and with two sample index one here and a duplicated here linking this geometry this mesh here and here we can get the Boolean information stored before for the start index and the end index of each Edge and take the name attribute store before it's a Boolean and it is called is final point and Link the attribute in the value so I can get this information and if this is true and this is true I want the split of that edge now I move these and I will recap this workflow to better understand it I can link directly this here so this is the logic here we are saving the Boolean information for each point where the position of each point from the mesh not from the original control points so we have more than three points here in this output for each point I want to ask me if the position is equal or near the position from the original control points moved in a correct position by this sample index here and if it is true I save the information true for each point next because the split edges Works in a edge domain for each Edge I need to take this Boolean information for both the start and the end vertex of each Edge and if both of them are true this means I have a single segment from a control point to the other control point and I need to split that edge otherwise I don't want to split that edge and you can see this result because if I press shift control and click on the trim curve and now I decrease the end you can see the correct splitting of the curve now I have here one curve here and one curve here and this is very important because next we will resemble each of these curve with a static number of secondary columns to instantiate them inside these Curves in a correct way and also we want to have a correct handrail profile for each curve without the ugly result of before so now that I have this result here in a mesh to curve I can link here in the handrail profile link this to the join geometry I can drop this trim drop this viewer and you can see the correct profile on the curve without breaking between these edges okay shift Z and we can see the result here now we can set 100 for the height of the base of the profile I can duplicate this group input to link only the base profile height here and because we need not only the base profile but also the top Prof file on a different height it's obvious so I can move these notes a little bit change the position of some nodes select all these noes control J F2 prepare each segments for the splitting now we can create the top profile duplicating this handrail profile linking the same mesh but a different height so I can duplicate this group input and the height of this profile will be the entire height subtracting a new attribute that we can add here I can move down and move this down and rename it in top profile height it's a distance from zero we can set 10 mm for example and now we can subtract from the height this new top profile height that also has the single value and Link these to the height height link this to the Joint geometry and here we have the top profile we can select all these nodes contrl jf2 base profile select these three notes crl J F2 top profile save the project now one of the tricky part of this tutorial so the making of the secondary columns on our handrail so switch from the top shift Z to see the result here and you can see we have the mesh to curve so what would you do in this case so basically you would link this mesh to curve in a resample curve setting value here based by the length that I want to have so I can add a middle distance it's a distance from zero and this is a single value also this I can set 100 for example to have a secondary column each 100 mm with a middle resolution solution so it is an integer number four for example with a minimum of three and I can set four for example it's a single value I can add a group input and Link the middle distance here we could use a curve Circle linking the middle resolution 6 mm for the radius it's okay in this case I could create a curve line with a combine XYZ because I want to link the correct end point of these new cylinders of the secondary columns based by what based by the height subtract the base and subtracting the top profile because in this way I want to have columns from this point to this point not the end of the entire height but the height subtracting the top profile height 10 mm so in this way I can link this to the Z transform this curve to mesh using this curve Circle as the profile fi caps and then using these resample curve with an instance on point of this cylinder and then link this to the global joint geometry but there is a big problem here you can see we have the instances on the base original curves okay so not the profile so in this case with the base profile I shifted it on this base profile height so I need to make the same transformation before the resemble curve or after we can do before so we need a transform geometry here with another combine XYZ linking the base profile on the Z and linking this through the transform and we can have secondary columns but there is a big problem here this approach it's correct until you change the position of your points because here we have a perfect 1 M so a perfect multiplying value by the meter distance 10 10 by 100 okay and this is why this works and you have the correct position and the correct instances but if I change this position a little bit like this I don't have a perfect 100 between each of these instances you can see here I have have one instance near this line but going to the right we have always more space and I don't want this I want exactly 100 between these points so to solve this problem I thought a method like this you have a point here you have a point here and the trick is to divide the entire line by the single middle distance you you want between the points and in this way you get a number with an integer like a point B and this is the number of the elements we can get inside this length and I will use this rest dividing it by two and distributing here and here after the last point so in this way I can align in a cented way the group of the elements where there is the same distance between them in this case for example I will get Point here Point here here okay is not a perfect but you have here 100 100 100 and here you will have the rest divided by two half here and half here so to do this trick I will calculate this number of points then I will resemble the curve by this number of points and then because they start always from the initial position of the entire curve to the end I will shift the entire group by what by the half of the rest that I want to have here in this part and here in this part so I will move all the points a little bit using the known sample curve node so one step at a time I can't use this technique so for this reason I put this point for for example in this point 1,50 and here you you can see in a better way the wrong result of the distance between each point calculated by blender even if I chose the resample curve based by my length Okay my length my middle distance so first of all we need to start with the mees to curve for each curve because we have more than one curve here one here and one here and we need to calculate a different different amount of count to resemble the curve based by each curve we need to capture for each spline what the spline length so keep in mind this is not the spline parameter because this length works with points and this works in a spline domain so if you need to know the length of each spline you need to use this node and not this if you need to know the length of each point on the same curve where it is yes you can use this length of this spline parameter so if I press control shift and click twice you can see in my spreadsheet we have the length of each spline and now I can link this geometry to the transform geometry to have the previous shifting by the base profile uh so for this reason I can duplicate this link the base here in the Z press contrl h move it a little bit H and collapse a little bit I can drop all these notes here because it was the wrong approach contrl H I can drop this length because I need to resemble by the count now I can move these a little bit perfect as I said we need to take this length divide it by what by the attribute of the group input and in detail the middle distance so I'm dividing 150 by 100 now I need to add one because otherwise we would have a wrong number of the points from the start to the end I need to add one and use this to resemble the curve to show you the result of this resemble curve I can link these to a set radius and then curve to points and shift control and click now you can see the correct number of points not the position you can see that from this point and this point there is not 100 mm but more but I'm calculating here the correct number of the points that I want for each curve now I need to reposition these points in the correct position based by what based by the index of each point multiply it by the middle distance so if I take this resample curve and link to a set position move it a little bit I move it a little bit here take the index of each point and multiply it by the middle distance itself so 100 I'm sure to have zero shifting 100 shifting 200 shifting and so on but I need to use this length shifting okay this shifting of the position where on the curve itself so I I can't link these value on the position it's wrong because the points would change the position related to the curves and go on the general plane of the 3D space so I don't want this I want to remain inside the position of the curve with a simple curve node in this way I can use this sample curve in a length domain where I want to use this multiplication so I want the zero length the 100 length 200 length Etc so I can link this value here to get the correct position on the same curve and use this as the position of the set position node for each resampled curve point this is correct but there is problem I can't set zero index here because the object is one but inside I have two curves so I don't want to use the curve index zero for both of or more curves I need to use the index of each curve related to each point so if I take the index another time but in this case I link this in a evaluated domain and I change from point to spline and Link these to the curve index blender takes each point of this set position goes backward inside the sample curve and for each index goes in this direction to get the index of the spline of that point and because blender knows what spline is linked to each of the control point it can give you this information here now that I have these you can see the position of the points but as I said before I need to shift a little bit all these points by what by this value of the dividing between the length of the curve and middle distance with a truncate next we we are going to see the number in action I multiply this value by the middle distance to have the correct number of segment of the point that I need here without the the rest of the B now I need to subtract from the length of the curve this multiply to get the rest of B that I can divide by two and I can add initial length of each point here don't be scared I will describe all these in a moment and now I can link these result here in the length I can link these to the curve and this is the final result I press h a couple of time to have a better understanding of the workflow okay recap here we have 150 1.05 we divide these so we have 10.5 we add one we have 11.5 so here we have 11 points here we have 10 multiplied by 100 we have 1 100 mm so 0 . 1 out of the unit measure domain okay so we have 10 by 0.1 = 1 we subtract these from these so we have 0.05 delete them 0.025 that is the distance I can show you is the distance from here to here and from here to here in the middle we have the index of each point so zero for the first one 2 3 EX Etc multiplied by the middle distance so we have 0 then 0.1 0.2 Etc and then I shifted by this little value all these points and you can see the shifting of all these points now the correct result is not these because you can see in this curve two point I used this node but I was wrong because here we have another count way I should change this count to evaluate it to get the correct shifting points on the curve now you can see from each of these points we have always 100 mm but this part and this part it was a bit tricky but it works now I I dropped the viewer we can select all these notes Here we can move them a little bit because I want to select these notes press contrl J F two resample curve for secondary columns I can move these a little bit then I can duplicate these alt P to put it out of the frame link the same mle distance here select all these nodes control J F2 secondary columns shifting along the curves now I don't want the the first and the last point because my secondary columns will have a decoration in the center and this decoration can be bigger and can touch the primary columns width and to avoid these I can use a delete geometry node link these and select only the end point using the endpoint selection deleting the first and the last point of the curve I can drop these two Vector these two nodes select all these notes contrl J F2 delete extra points now we need the same resampled curve here but not only for the base profile but also for the top profile because we want to link and connect these points from the base and the top and you could ask me why are you doing this technique and you don't use um simple instantiating method because next as you saw in the intro I have have stairs and to have a good support of the stairs I can't instantiate a single object like the primary column that has one only height instantiate this and then manipulate the bottom side to move it up and down leaving the top as they are I want to have a flexible method to move these points up or down and then connect these points to the upper side to create my secondary columns now I need the top curve so I have the resample now I need another resample with the same amount of number here and you will understand why I don't use the same resample curve here for this job now I need to transform the geometry to shift with a combine XYZ this line by the group input attribute and by what the height subtract the base subtract the top as before linking this to the Z I have the same curve not here but here h h h crol h i can select all these nodes crl jf2 move the top curve on top now I can shift in the same way this new curve I can drop this set curve radius I don't use it I can select these two nodes duplicate them press alt p g to move and Link these here and these here then I will use the same result here for the length and the curve index I can move all this group to the right and insert these notes inside the same group here like this and again I can delete the extra geometry for this curve linking the same selection and now I have the two final curve that I can link together so let's create the column and the column needs to have the group input because we need the meter resolution so the resolution of the secondary columns I need to link these to a curve circle with a radius of 6 mm for example I need to fill this curve with the an angle I can link the bottom curve with an instance on point node linking this curve realize this instance while why because I want to extrude these faces along a position what position the position of the points of the top curve okay so I want to extrude the faces and go up and to do this I can link these to a sample index node setting the vector because I want to have the position based by the index of each control Point link these two attribute and use these to offset these extrude mesh but weight the position of the top is from zero so the entire position is to height I need to use this position and subtract the current position of this bottom profile otherwise you would have this result here you see a problem here because I was wrong in a little Point here in the secondary columns shifting along the curve so the shifting of the group of the points I set the index of each point but keep in mind this index in this context is the index of each point following all the curves and you don't want this you want to have the correct numbering of the point based on the curve where the point is so 0 1 2 3 but here for the second curve we need to restart from zero 1 2 3 Etc and not going over Okay so this index is wrong and the correct index is the spline parameter node as I said before in the first part of the tutorial and you will need of this Index this index here this is very important keep in mind we don't want to offset by the position itself of the top part because you get a double X shifting and and a double y shifting but you need to subtract from the point of the top the point of the actual position of the bottom point so if I do this I move the extruded faces from this position with an offset of this position here subtracting this position so this distance on the Z axis it's obvious because both of these points have the same X and y so I can select all these nodes here contrl J F2 secondary columns profile creation control J F2 calculate offset from bottom and top points and this is the secondary columns creation now we can create a declaration and instantiate it in the middle of these points so to have the middle points we can use the position of each of these curves mix them together with a mix node and get the correct position so we can take the top and Link these to a set position where we want to shift the position of these points a little bit by what by the bottom curve in a simple index node getting the correct Vector for each point of the position based by the index itself and mix in what mixing this value this Vector with the position of the top curve so this is the position of the points of the top curve and this is the position sampled in this node for the bottom curve and with this link I leave the factor 0.5 to get the middle point between these two points and Link these result in the set position I can select all these not modes control jf2 find middle points to put decorations Now to create a decoration we can use a simple curve line from for example minus 65 / 2 and 65 / by two to have the origin point in the center of this curve line then I can set the curve radius to 12 mm resample the curve with 32 points and here we have this line and then I can reset the curve radius using a float curve where we can set the value based by the spline parameter you remember we have the factor that goes from 0 to one for each curve okay so I have values from 0 to one in a linear ramp I put this ramp inside this float curve to have a personal shape of my decoration and then I want to have with a map range a minimum output of these decoration by the radius itself the starting radius because otherwise I would have zero width here and one width here and I I don't want this I want to have a minimum width and to do this I can use this node used as the decoration shape and pass these from 0 to one preap it to a minimum of the radius set here and a maximum of for example the double of this number for example 0.024 and Link these to the set radius and in this way now if I transform this curve to mesh using an obvious curve Circle I get this that is correct because I have 12 mm for the zero values here here out from this map range and then 24 I can change the shape as I need this is an example next I want to set the smooth on this shape and now I want to instantiate on these points this decoration so I can link these in an instance on points link these and this is the result now I can link these output to the main geometry drop the viewer I can can also link the secondary columns Creation in this geometry and this is the final result now you can see if I take this point and I move it on the x-axis you have always the Align and cented of the secondary columns inside the curve without issues also in this case where we have this handle type changed all works now we need to align what the rotation of these pieces along the profile so if I press seven and go here you can see the bad alignment of these four resolution profile so we need to go here inside the secondary columns profile creation so inside this instance on point and we need to calculate the correct rotation so to calculate this rotation as I remember from my previous tutorial of the rotation tips on curves that you can find here or in the link in the description we can take from these curve what the tangent the tangent of the curve use it in in a line UL to Vector in the vector because we want to rotate the object based by the actual rotation that is shared that is common for each of this piece you can see keep in mind next we are going to add a support for the stairs so we don't want to have the alignment down so we don't want to rotate in a wrong way we want only rotate on the X and Y plane of the 3D space so we don't want to uh have a column that rotate in this direction okay but only around and to do this we need to take this tangent and multiply the separated components by one for the X one for the Y and zero for the Zed and Link this to the vector now if I link this to the rotation I have a better rotation but again for the problem of our stairs we need to maintain what the Z axis up leaving the pivot on the x axis of the previous align you to Vector node now you can see if I press seven we have a misalignment of the rotation because we don't want to start with this rotation but we want to start with a 45 degre rotation and to do this we can rotate uler by 45° in a local space and then link these to the rotation and now we have the corate rotation and alignment along the curve we can select all these nodes contrl J F2 secondary columns rotation now we have almost finished but there is another last problem to solve that is this if I enable the plane and set a material like a checker texture like this entering edit mode with the tab to for edges selection extrude Z - 200 extrude x 2 40 and again here we have a little stair now I take my point here I delete it I select these I move a little bit here I snap it on the face of object I extrude these snapping only the plane with the x and z and you can see this problem here you can notice this bad result these touching and overlapping between these two meshes and I want to avoid these and to avoid these I need another and last attribute in my group input that I can call in cleaned offset it's a sub type of distance from zero what I want to do I want to offset these points of this profile by this value maintaining the rest of the workflow and to do this is I need to go here in this resample curve for secondary columns and before the resample curve of the bottom curve I need to add here a set position and this is why I didn't use this resample curve for the transform geometry of the top curve because between this node and this node I need here a set position for shift these points so I need to detect these points in some way and the way is this for each of these point I want to ask me if the first and the last point of the entire curve are at the same Z position I repeat it for each point of all the curves I get the position of the first point of the curve the position of the last point of the curve I calculate the distance in the Z Direction and if this distance is greater or not equal to zero I have a theorical stair and detecting this I can add the value of the inclined offset or zero instead to my points so I can move all these my first columns creation primary columns creation from this point to this point of the setup I can move this a little bit I can also move the top profile and the base profile a little bit like this now for each point I need the position of the first point so I can add a sample index twice because we need the position of the first and last point we can leave the float type here because we need only the Z component so we can add the position separate it in the X Y and Z and Link only the Z component here H now we need to get the index of the first point of of each curve to do this I remember you that if if I have two curves with some point these are the indexes of the index node so the spline parameter can give me the index inside each node 0 1 2 3 4 0 1 2 3 and 4 and look what happens if I subtract from this Index this index 0 - 0 is 0 1 - 1 is 0 0 0 0 0 5 - 0 is 5 6 - 1 is 5 5 5 and five and in this way for each point okay evaluated for each point of each curve I can get the correct and the common first point of the curve in which the point is so for all these group of points the common first index is zero and for this group The Common point is five in this way I can subtract from this Index this index select all these nodes control jf2 first point of each curve and Link these to the index of the first simple index because I want to get the Z of the first and the Z of the last so for the last it's very easy to do because if you insert the spline length you can get the point count of each curve so if I add from these results the number of the point of the same curve where the point stays I get this result add the point count and for example here we have five points okay five here and five here I change for a moment this curve to have 10 five and five another time now we have here five points and here six points and I can add five to all these zeros getting five that is the first index of the next curve you can see here and if I subtract one from this result I can get for all these points four four four four and four and if I go here and I have five five five five5 five and I add six for all of them and subtract one I have 10 10 10 10 10 10 and 10 so I got the last index of each curve for each point and now I can link these to the index I can select all these nodes control jf2 last point of each curve now I can subtract this Z value of the point with the other Z value and if this is not equal to zero I have a true value in switch that can I use to set a float number and this number will be the inclined offset if true zero instead now I can add a set position node here and Link these in a combine XYZ linking the Z components link these to what to the offset not to the position it's important because I want to maintain that the base distance that I had before link the previous transform geometry and Link this result for the base curve that I want to resemble now I can select all these nodes contrl J F2 calculate in cleaned base profile offset okay now to see the result we need to link what the curve so we can start to link this curve here and the same curve here and now if I go to the layout this is the example I can increase these and have this result keep in mind we need a little adjustment for the bottom profile and to do this we need to go in the geometry nodes and we need to use this combine XYZ to set the position also for the creation of this base profile so after this point so not for the top profile but only for the base profile we need to set a position here and in the offset we need to link the same result of this combine XYZ so I can link these together and move the position in the offset and voila to better understand the layout I remove these group notes before it's more readable this is the top and this is the base and now if I go again in the layout you can see the correct shifting of my inclined offset here and now I can move the height as I want the base profile I can move it maintaining the correct inclined offset I can move the top profile and keep in mind the middle distance go in the geometry nodes open the group input go in the middle distance and because in every setup in every languages of this world you need always to limit values that can be used in a mathematical dividing operations so in this case you can see here we have a divider that can be done with zero values so don't leave minimum value like this in this case I can set 20 mm for example I can go into layout and I can decrease the minimum distance for example 50 and I have always the cented decoration and secondary columns I can increase or decrease the middle distance I can EXT R along the Y these select all these points select this handle and move it on the X and I can have the correct alignment along the curve of my secondary columns uh last tip that I want to show you is this go in the geometry nodes press seven shift Z to see the wireframe if I set a middle distance of 300 I have the correct number of my secondary columns but is in a better position on my profile why this because I used for the shifting along the curves using the sample curve node what curve the resample curve that has only few segments in it so instead of using the resample curve use the curve before the resampling in this way I have more points on the curve so link these to the sample curve or the top the same method we need to link the curve before the re simple curve but keep in mind we have here a transform geometry so we don't want to lose this information passing through these sample curve so we need to maintain these transform geometry linked to the sample curve here but resample it after and only in this point of the workflow so we needed to move these here link these transform geometry here this output in the resample and this value in the set position in this way I can use the same transformate geometry in the sample curve then I resemble it and use to reposition the new resembl uh points in the correct position on the curve like this now it's all correct and the result is more consistent even if I increase or decrease the number of my middle distance if you want to use this workflow as an asset you can easily go in the geometry notes rename it in the hand rail maker maker be sure to save the file in one of the paths set in the asset libraries of your preferences and make sure to have the modifier selected here in the nodes type here in the properties make sure to have this check here to use it as the modifier and and right click on these and Mark as asset save the project and voila you will have in your asset browser the new hand rail maker thank you guys for watching this big tutorial I hope you will find some new tips and new Knowledge from it you can download this project from my gambro page if you like what I'm doing please subscribe to my channel don't forget to check the Bell icon to get all the notification of my videos thank you always for your support and see you to the next tutorial [Music] bye
Info
Channel: Andrea Ciani
Views: 3,006
Rating: undefined out of 5
Keywords: andrea, ciani, geometry nodes, blender, tutorial, procedural, geo nodes, proceduralism, handrail, handrails, banister, balauster, banisters, balausters, railing, asset, assets
Id: r8h5ySlNmOg
Channel Id: undefined
Length: 62min 33sec (3753 seconds)
Published: Thu Dec 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.