Complex Roads in Houdini - Part 1: Solving Intersections

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys this is the first tutorial made by us da kine it is part 1 of a series diving into road creation using Houdini during this tutorial we will tackle the problems which arise when dealing with intersections without further ado let's jump into Photoshop to go over the basics let's start with describing our intersection initially we have three lines roads come together to form our intersection and then I'm gonna draw the geometry we are going to be creating so basically the geometry of the intersection itself and first divide it up because we don't really need the straight pieces at the ends and we don't care about the intersection itself for the straight pieces we will just be using a sweep we need two variables to create this intersection the length and the width so the lengths pretty easy it's basically the length of the intersection and width that's basically the width of the road with those we can now construct our final curve I'm gonna color that in green and that's basically the outer edge of the intersection now we will be creating our test geometry lays down a few curve notes and put it together with a merge then go into your top view and let's draw some nice lines coming together after this we will be placing down a fuse this is just to make sure we have one nice intersection point that's what we want cleaning up your input is usually one of the bigger tasks out there here are a few tricks so we have a convert line this is going to create some loose primitives out of our geometry then place a poly path it's small note and that basically connects them again helps to create some clean curves and after that every sample depending on what kind of rows you want you might not want to do this but I'm gonna turn on subdivision curves to create a little bit more around curves when we look at the point numbers of our curve we can usually see some kind of direction right now they are all going basically well they're not all go into the curve so this one starts low and high and here it starts high and ends low and here it also starts hiding and slow it's usually not really what you want when dealing with these kind of intersections you want them all to go into the same direction and there might be issues with having multiple intersections so there's a fix for this first let's place a reverse mount this will be reversing the curse and then place a merge again now weave those together we are going to place down a curve and with the scarf we gonna put first you to zero and the second you to 0.5 and now we don't have we basically doubled our primitive number that's also place a fuse but what we know now is that the inner primitives of our intersection Oh point towards the same direction and that's important next up we want to select the intersection let's place down a pointer angle and how we are going to select our intersection is the following first we need to know the neighbor count of each point so make sure your pointer is also set to points you can always check if this is working by making an attribute out of it and as you can see it works and we can see it at our point zero has three neighbors which is correct and we don't really care there are more rows coming in so we're just gonna say if there are more than two neighbors then it's going to be an intersection and we're going to be declaring it using attributes now you can see that all the points at all at the value zero except the intersection point which is in a value of one and let's make an integer out of this now I want to promote this attribute to primitive so these entire primitives you can see over here all will be connecting to our one intersection so that works that's nice make sure you take the maximum value because that's what we want we want to know which birthdays are part of the intersection and all the other pieces are going to be zero now to make sure that we only select the intersection let's place at the link note delete by expression and delete all parameters which have an intersection ID of zero next up we will be selecting the length of our intersection was the red line you saw in the beginning of the video to do this refers me to measure our primitives to see what length they are at place down in measure notes make sure it's a two parameter and now you have a nice length value for each primitive place down at primitive wrangle and let's create our car fail you that's greatest prayer barometer produce and now you can see our custom car value we want to cut off our primitives so that the exact length which we want to have for our intersection there are a few problems when doing this we can place down a car mount and here you can immediately see that if we have only one value it's basically between 0 and 1 and it means or you're taking the entire curve or that part of the curve basically 1 divided by your car value that's not one we want to have a certain length and and this length has to be well probably sometimes it's different very primitive so how are we gonna do this well at first we can delete a car note because with the car note it's not that easy to carve each primitive with a different length so we're going to dive into vex for this place down another primitive Ringel I found this solution on our horse it's basically like a simple car which can use parameters with different values now you can see that our current value is basically the length which we need to put in that's our length attribute so let's change this one to point if you can see right now it's a little bit too large so let's kill this one down a little bit - - and this one - say 0.5 that's the beginning of our intersection we want to select the points we've just created so those are points five six and four an easy way to select these points it just just take the highest point numbers for each road segment there is let's blaze down a point right first we need to point limit and with the if-statement we are going to select all point numbers below this point limits and we will be removing those points now we have our segment points but first let's add some orientation attributes I'm going to be doing this using a poly frame if you don't know the public forum it's a very handy node which is just incredibly useful when trying to create orientation attributes or cleaning up your curve and let's set the tangent name to be and our normal as you can see my initial initial as you can see my initial curves have normals right now but the points I created as the outer second points those don't have normals so we need to be giving them some normals we will give them their normal of their neighbor so they have normals I also want to know where my original intersection point was so let's get that one get this off with the lead original place another delete note statistic points to lead non-selective and there is our initial intersection point not always certain if the points are radially sorted here so let's just add it in there where the segment points into the left one and then after that wire in the intersection point whenever you want to do a radial sort there's a nice little trick to do it in 2d first we need to know around which position we want to do a radio sort that's the point position of our intersection point second input position and there we go then we need to subtract this from the original points the original points position place effector two floats search for the arctangent wiring our x and z components and this is going to be our short film so place a bind export after this just plays a sort next set this two attributes short tell you as you can see we still have our with attribute and we will be using it right now let's down eight attribute promotes series front primitives to point now it gets a little bit abstract but don't worry it will all come together in the end we're going to divide this up into three segments one for each outer edge of the intersection plus down a for loop and make sure it runs over points you can see we have our first point selected but we also want to select the second point copy our a repeat begin make sure you set it to fetch input place down another point for you could also do this in wrangles really doesn't matter that much whatever you like press create metal import notes wire that one into the second input and the repeat again two into the first input from the metal note we can get a iteration value type in import detail attributes set it to second input we're going to add one we're going to add one value to our current point number place down a model oh and wiring the total amount of points let's down compare notes make sure this is such an integer so we have our total number of points which is tree we also have this looping around overall point separately and we're adding one because our total amounts of point is three and I want those to line up nicely then we have an iteration value which is pure iteration it's also going to change and basically this will give us a number which is one the moment we select the second point and we want it to be one when we are not selecting the second point so let's turn this to not equal lies in a flock get the current point number please down the remove point this error sometimes happens I'm pretty worried about it too much let's make sure we have this set to integer same as this one make sure you're selecting the iteration in your import detail note and if you place it on a murse now if you sit down Aamir's now you can see we're always selecting two points that is to single pass and if we go through this we keep selecting two points for each iteration which is exactly what we want let's make our intersection point grin there are two curves we're going to create one is the inside curve and one is a outside curve let's start with the inside because that's the easiest one place down a 24 let's make sure this one is set to detail rind emerges first input and let's create another sketch input note this one will get us our intersection point which is going to be our second input and dive in in here refers going to get a location of our intersection point we do this the same way as last time make sure it's at the second input as you can see it doesn't matter if you're using the open put two or you just budget usually it doesn't matter if you're using up input to record into file or just set input your second input doesn't really matter let's create a point where our intersection point is and let's place two constants which have the ID of our previous points now I want to create a primitive to do this type in a primitive let's order these nicely and place down tree at vertex notes and why are all those in and is one the order is important as you can see we now have a nice primitive let's call this inside curve let's place another detail hook make sure to set to detail and let's just call this outside wiring the same notes let's dive in there this one is going to be a little bit more tricky for this we're going to need the normals because what we want to do is to not use the original points the creator server would want to offset them 90 degrees away from their normal there's a nice little trick to get to that direction talking cross-product wiring the normal and make sure the second one is set to a up vector which is zero one zero it's already automatically does this for you which is nice if you write this into the normal if you wire this into the normal nothing will happen because we're still in in detail mode let's set it to points and now you can see we have a nice 90-degree angle that stretches around a few times so you can see the difference and let's get back to our detail mode now we want to select the normals of our two points so let's place them to confidence again 14.0 and 14.1 then we need to get the normals get attributes wire in the constant set attribute to normal first inputs it's a vector and we want to access an point attribute and doing this also for a second point then wire in this cross then wired into a cross-product let's copy this one as you saw we need to negate one which was let me get it real fast point number zero so we need to negate our direction from point number zero we need to get with let's type in get attributes wiring our point ID zero in this case let's type in with floats first input it's a point attribute is nice and we want to multiply this with our direction we want to do the same thing for our other points make sure your first in putting the victor and then the float so the outcome will also be a factor finally we need to get the position we need to get the original position of our points let's get the precision of powerpoints and Colette at these values together and let's add a point let's say two points as you can see one is not working as you can see one is not working and that it's because I forgot to gets a new normal and now it does work now to create our final point which contains both offsets and it contains the initial position of our intersection let's get attribute the position of our second input it's a vector it's the first point so we don't really need to bother about that one throw it in there together with our offsets don't mix those two around you want to use them now some of the multiplying because it's the direction multiplied with the width not with the added position of the initial point lays a point that has our final point position first remove our all points and we're gonna do the same thing as in the other notes at primitive at vertex and let's copy this one two times and there we go let's play submerge just for visualization this is the first core of our intersection next up we will be adding your V's if you don't really need your V then you're done way sooner you can skip the part let's delete the merge again and place down to resettles also we're going to place down a control mount just put it down now let's call it control edit parameter interface other floats call this resolution [Applause] got the parameter and let's throw it inside of this one and it rode into the resemble but first let's do a little bit of a cleanup lays down a party pass a sorts which sorts my verdicts order and a convert line right now it's very important that we have two primitives instead of one so when we do our resemble it does both of them separately and we keep our middle point let's rub down it a little bit in the developer higher resolution this one should be a division size not resolution for the other one lays down a pulley path just copy over the poly path from the source you don't need to convert line for this one that's actually important in the example of the outside curve you want to be sending it to a subdivision curve so you get to the right nice and round edge create a spare input I always like to use pair inputs because if you want to compare our system and you have all this low those channels going everywhere that's just really annoying so try to get used to when I'm making a lots of spare inputs so everything is compatible and throw in the first or sample and let's set this to a relative path they were not going to use the maximum length we're gonna use the magnums and maximum of segments endpoints putting down minus 1 because we have a spare input and it will give us the amount of points now we don't need the exact amount of points because at first you can see over here there's a double point over there so what we need to do is to subtract two points and now we have to correct segment amount place fuse after first resemble and now you can see 70 points eyes number of 16 and the same goes for the other curve interferes for sample note make sure you have this curve you attribute check down you can see the curve you attribute going from 0 to 1 again 0 to 1 although this is not exactly what I want I wanted to go from 0 to 1 and then then from 1 to 0 so let's fix that place down point fob don't place a few yet then place down in multiplied constants let's we multiply the total amount points by 0.5 keeping an integer number placed on compare wiring the current point number instead of two greater than or equal place down in bank notes and then if block out of our compare comes the condition and our bind becomes our purview attributes place down compliments one minus X and sine make place down and bind exports so it secure view again and wired a compliment into the divine export now we have our flow is going from 0 to 1 and from 1 to 0 without a fuse let's at RIT copy the curve you attribute to the other line from points two points attribute is curve you don't match the position and now he has another nice curvy attribute we have the you attribute but we don't have to see attribute yet based on the pointer angle set the curvy attributes to 1 so the curvy attribute for one or the inside curve and set it to zero the outside curve at this moment you want to merge them together again with an ADD node we're going to replace our curves delete term tree but keep the points and create a primitive by group close this one also one thing to make sure off if we go into our perspective viewport if you go into display options can remove back faces so you always know which side is facing up which is a very high nice thing to know for now I'm just going to ignore it place down a polyfill and finally it lost and delete primitive number zero now with clean-looking germ-free normals are not there yet so let's create our normals there we go so let's place a quick shade here you can see our here you can see it intersection you've just created look magically now to finalize the UVs place down a point hope we can bind get a curve you and also get the V attribute for the vector going expert letter to vector movie there's an attitude promotes four points to the courtesy UV lived on a fuse make sure you have your quadrilateral grit turned on let's have a look at those UVs right now they look a little bit mirrored also there's a little bit of distortion edging down except the find usually fixed this let's do diffuse opposite provides also make sure also make sure in your super fights that your quick creased weight is very high so we are not getting those weird Silver's in there and there you go these are mainly designed to tickle a certain amount of distortion I have multiple UV sets in another version which will be there in a later tutorial as you can see now we have a very fast intersection solver which also works in 3d alright guys that was part 1 of the series we hope you have learned something and if you enjoyed it make sure to follow us online for some more cool game dev stuff for now this was no Kai Bai Bai
Info
Channel: Dokai Tutorials
Views: 19,480
Rating: 4.977591 out of 5
Keywords: Sidefx, Unreal engine, Houdini, intersections, Houdini engine, crossroads, solver, HDA, HDAcreation, assetcreation
Id: bTlY9ahThdQ
Channel Id: undefined
Length: 28min 28sec (1708 seconds)
Published: Mon Sep 03 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.