Grasshopper - Visualising Data for optimising a Simulation (in Kangaroo)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys in this tutorial we're gonna take a look at how we can use data visualization methods in grass up to sort of inform us of what of what is actually going on with our with our geometry or our structure or something do us a better understanding of in this case a kangaroo simulation so I'm just going to get the simulation off and restart it so we can see that's sort of going on so what this sort of does is this um this mesh has a whole lot of um hot spots on it if you will that I've got assigned a deflection value to all these blue areas where we should be in the most deflection and the red areas of where we're not getting as much and this mesh is slowly gonna sort of fold on itself but then inflate into the most stable version of itself and that's what we're gonna create alright so I'm gonna pause the simulation and dive into a new document so we're gonna start with a normal sphere as well as a mesh sphere X now I'm might be wondering what this mesh spear X's and we'll get to that in a sec good math throw down a slider with a maximum value of 100 here plug in my radius values and in order to understand what this mesh is I'm also going to drop down a ordinary mesh here with the same radius so this the ordinary mesh fear has I guess lines of latitude and longitude if you will to to bring a real-world metaphor and to explain that you know it's it's it's got it's sort of directional axes the vertical and the horizontal which means that we get I wrote a loop of triangles at the top and at the bottom mesh sphere X Remedies this by creating a completely quadrangular and the way it does this is loosely based on the catwalk luck subdivision method if we bring in a mesh box and actually I'll bring in a center box as well and give it an X Y & Z size I'll get into my mesh box and then just assign some divisions with an ordinary slider so my x y and z okay so if I plug this mesh box in with no divisions across the surface into my captain clock you should start to notice something very interesting if I just previous mishiro set this number of divisions to 3 and plug it in so as you subdivide a a box it will tend towards the sphere and that's because of the way the kettle clocks and division works it um it's the the shape tends towards a spline along any sort of edge loop and the Sun yes this turns a box into a sphere which is a very common method in other modeling programs but luckily we don't actually need to do this myth and to create the mesh sphere like this in grasshopper because we've got any component which does it already and in fact it probably does a little bit better than the kettle Clark subdivision because we have control over the number of divisions in each direction whereas with the kettle clock it has to be ordered have to be either 2 4 8 16 or so on and so forth alright so I might just sit this - what 18 metal diff now and what I'm gonna do cuz I'm going to pop 2d and I'm going to create a region so I'm going to create a rectangle and I'm gonna give that rectangle maximum value of one so it's gonna this is rectangle is basically going to be a my zero to one space for this pop 2d so that when I evaluate my surface at these coordinates and reprioritize it it will give me a point distribution along the entire surface whereas I could sort of lower this to give me only points in like the lower quadrant or I could take as much of the sphere as I want if I wanted to localize it that's that's sort of why I prefer to just doing a simple pop jeah while it might sort of give you the same roughly the same result you know this this this has that extra layer layer of control built into it so I'm going to set that back up to one I'm going to turn this to an integer slider with maximum value of a hundred and this is gonna be my number of points in the collection and somewhere around maybe sixteen will do and then I'm also gonna set a seed value the seed value is just or basically is just a new generation so every seed is completely unique and you can set this value as high as you want or as low as you want I'm just looking for something with reasonably um spread out points across the surface I'm quite liking that one at the moment so I'm gonna stay with that okay so now what I'm gonna do actually let me just quickly set up you can guru simulation so we have kangaroo physics we have a force object which as usual is gonna be Springs that goes into my four subjects my geometry actually instead of plugging in the mesh here to weld these vertices beforehand and this is sort of just the pre-emptive method in case the mesh did decide to do anything frumpy while passing through kangaroo this should remedy that now preview these off and I'm also gonna expect my mesh output on this side I'm going to plug in a button and I'm going to plug in a timer and set my timer to 20 milliseconds disable it and okay now we can know we can continue sitting at the simulation so like we always do for our Springs we need in weaverbird edges we've a bit messages to be more specific and this goes into my connection and so now what I do want to do is I want to sort of drive the length of these edges based on their proximity to each of these points so what I'm gonna do oops I'll keep those on for now I'm going to do a distance between each of these points and I need to expect some points from these edges so what I'm going to do is I'm going to do an evaluate curve and administer the parameter to 0.5 and I'm also going to reaper and rise the code for good measure so now when I plug the listen won't work straight off the bat will just give me a whole list of values which is why I need to graph this input so that I get actually want to graph the other input so that I get how many is that 3888 lists each with 16 items and then I can preview these off and I only want the smallest distance from each of this list from each of these lists basically it's gonna give me the point of the value at its closest which we say it's closest reference point I'm gonna ignore all the race so that I'm just sorting this list and using a list item to pull out the smallest value and make small space again all right and now that we have that we can flatten this input and we can do a rematch so we're going to remap these numbers based on each bounce so I'm gonna plug those in like so and now we've got what we should need for our data visualization so I'm gonna grab a gradient and this remap is gonna be my parameter value now good thing about a remapping this to a zero to one REE domain means that I don't need to plug anything into my lower and upper limit because those are already fixed to zero and one I'm just gonna change the gradient type to this one okay because to me it's pretty simple to understand blues your upper red Zia raise your level very simple all right and so now we can reset the simulation so that we've got fish feeding through I can also preview off these edges and we can set up a visualization on this side so I'm going to copy and paste these components here and I'm gonna get any geometry preview a custom preview sorry and I'm gonna preview all of these points so this is now tilt now this is giving me a deflection value but you could you might be picking up on the fact that this is well actually you might not because I haven't explained this but me what I do want is I want the most deflection at these points here and blue is gonna be my greatest deflection so what I'm gonna do is I'm gonna create an expression in this expression you know what we might still want this result so I'll work it in as well what we're gonna do to say is if x equals true then we're gonna say 1 give it an x value other than will return x otherwise we'll return 1 minus 6 so once again for a conditional statement if open parentheses our condition and then if the condition is true and if the condition is false so if X is true actually I want if Y is true and my Y value is going to be this boolean over here and so now I can plug this in here and if I flip this around you can see we're flipping that value so now what I want to do with this is I want this to control my on my spring length so I'm going to grab a multiplier and I'm go I also need a list from a curve length component and so this multiplier is just going to sit over here I'm gonna plug my length in and I'm also gonna plug my multiplier in so now this is driving our simulation if I hit this button we can now see we get into these sort of moments where it's more expanded out our width we're getting a greater expansion we can see we're getting the corresponding blue value and getting the title result that's we live great sort of getting into these yellow red yellow orange and red regions alright so next thing I'm gonna do is I'm gonna bring in a new a new four subject one that we haven't worked with them this one is Mitch pressure nimesh pressure is actually a cluster it's a it's a custom component that has been prevalent Iker when he created kangaroo so that you don't need to use the actual pressure component it just makes it a little bit easier to use don't do necessarily I mean you should have this but if you haven't done if you haven't installed if you haven't dropped the user objects that came with kangaroo into the correct folder which is the swanee a user objects and we can see we should have mesh pressure right there if you haven't dropped those into this file then you will not have mesh pressure so just make sure you do that if you don't let's just quickly take a look at what this actually is so I'm this is these are all old components for grasshopper from a couple of versions ago but they all have parallels now so this decomposing mesh is around you construct mesh this Versys component is deconstruct face and then we have our list item we also have the pressure component that we just saw and that's what our cluster does it just just extracts the relevant information to use this pressure component so I could so I don't need this I need this I plugged my mission here and then this force object you know be added into my forces I'm gonna reset the simulation it's still not going to work because I need to flatten my forces very important to remember that and then we're gonna reset simulation and let's see what happens so there we go we're starting to get started to get a result of sorts but we can because we're we're focusing on data visualization we're gonna look at how we can further modify this and so what I am going to do is I'm gonna grab a quick graph and if I just plug this in here you'll see okay it's giving me whole list of whole list of values which is not incredibly helpful at this stage somebody's gonna sort the list and then plug it in and there we go we get this nice I don't know what shape this curve is it could be it could be a modified Bezier curve let's go with it but um it's sort of peaks and then flattens out in the middle and then spikes again okay so we can do is we can create an expression to modify the shape of this so this expression is going to be X to the open parentheses 1 over Y and what this is gonna allow me to do is to skew my values one way or the other actually sorry not x times we want X to the power of 1 over Y so you can see at 1 we get this exact same curve but if I if I reduce this value we can start to sort of flatten out the shape of this graph which if we if we connect these in here and then mate reconnect this we can sort of control we can use this function here to control the range of influence of our of each of our reference points so if I wanted to have wider influence I'd drag this up if I don't want it to have shallower influence I'd drag it down so we can get it to be very very shallow if we want you can see it's only affecting what's that the nearest six points or so at this level if I bring it back up to one it's got much much wider control and now okay what I also might want to do is let me just insert a boolean and yes we can make this expression a little a little more interesting you know we can we can skew it one we could skew it either towards this bottom corner or towards this top corner we're gonna say if open parentheses if Z equals true that's our true condition and then our false condition is going to be X to the Y what this is actually doing I should also add this this works this works quite well with um values between zero and one because if you raise if you raise a number to let's say to zero if you were to raise X to zero point five that is that is actually exactly the same as taking the square root and so if we square root values less than one then we tend to UM then we tend to see it will actually not if we just square root values we tend to see more shift towards the lower side which is why the Sun this graph actually works it's um it's shifting these lower values a lot more than it is the higher values and then if we flip this the other way and actually I'm sorry I was doing it to one over Y so if we did one over 0.5 that is that is squaring the value yes that's now squaring the value whereas if we set this to false this is X to the X to the 1/2 is square rooting it and you can see so now now it's got a really huge area of influence there is almost no almost no red values visible on this mission it's all being influenced by the structure all right so that's that's how the quick rough can help us I'm gonna set this back the other way because I do like it when we've got this really shallow influence and I'm gonna reset it and what I might also want to do at this stage is working a cutoff value so I'm going to create a new expression and what I'm gonna do okay we can sort of um if I do play through this the simulation we can see we get a lot of sort of contraction right here with these values being raised to a power really they're really becoming absolutely miniscule and so what I do want to do is I want to work in a cut-off value so I'm gonna say if X is less than Y Y is gonna be my threshold then we're gonna return Z Z is gonna be some arbitrary number probably one but doesn't necessarily need to be one so by returning one it is going to ensure that the spring remains edit initial length otherwise if it is if it is greater than this threshold then we wanted to sort of explode out we want it to grow quite a bit larger so I'm going to say u times X and then I'm going to close the parentheses off so we need X Y Z u Y is a threshold Z is replacement and then so that's one and then U is a multiplier so I might just sit this three for now and we'll see how that works all right so I haven't plugged it in yet I'm not gonna plug it into my visualization just because we asked youing that top top list of results so it's uh it's gonna influence those in a way that I don't necessarily want the visualization to to do so I'll just plug that in reset my simulation okay and so now we immediately see that our pressure is set way too high or maybe not way too high but it is higher than it should be so it's currently 15 I think salsa's to a maximum value of 20 and maybe I'll make it nine point two one six and we'll see how that goes okay it's expanding and there we go sort of equalizes and then kind of contract a bit so let me see what I can now do with this simulation I can expand these but that's you know that looks like it's going to break it again I mean pause the simulation let me increase the pressure slightly reset the simulation okay so obviously we cannot set this value to live to go back to the three reset and it looks like our pressure once again is too high so this is all pretty delicate I suppose it worked around nine so we'll keep it at nine and see what happens okay there we go so it is working it's all in order and we're getting these nice sort of pockets or hotspots data I might want a few more so let me just increase this count to do maybe 25 there we go okay so now we've been using this to visualize points what we could also do is we could use it to visualize the actual mesh so I'm gonna turn this off and I'm gonna grab my English actually I'm going to reconstruct it firstly on this base mesh over here so well data is sort of formatted wrongly at the moment because it's um we're driving the process based on the UM on the edges and so in order to color a mesh we need to color the mesh vertices and so what I do need to do so I need to deconstruct this mesh over here and then what I'm gonna use is a closest points component and so from each of these points I'm going to graph this and this search for the all closest points because um basically every single age or every single vertex says fur has four edges around it and each and if we turn on this evaluation over here you can see this vertex needs to reference the four closest points so I'm going to plug in this value here and that's gonna take a little bit of time to load but we only need to sort of fetch this data once because now that we've got our closest point data we also have this index number so we can use a list item and we can list item out of this color we can take from that index number and then it's going to give us four values which I'm going to average and then I'm going to flatten this turn off my list item and I'm gonna get mesh colors going on this so I'm gonna plug my mission here and I'm going to plug my mesh colors in and there we go we now have the corresponding data visible on our new mesh and I might just apply a cap more collects subdivision on here to smooth out my colors a little bit do this slightly better result so there we go if we reset the simulation you can see exactly how it works and there we go all those all those nice little hotspots and mapped onto our shape and we have control over let's see the the influence that pops up quite nicely we could expand it or contractors oh well that looks like that's gonna break my mesh so I will just reset simulation again what else do we have control we could flip this boolean so that it's doing the exact opposite and we'll have sort of only a few regions of that actual sort of popping of the geometry because everywhere else is in close proximity to an attractor point we have control over a mesh pressure well we have very delicate control over that we could also flip the way this okay and that's okay that breaks the simulation so there's a lot of things you need to sort of tinker with to get this right but in the end there is a lot of cool stuff you can do and we can use like I said we can use this to sort of informal exactly's going on with our visualization and if you wanted to at the end of it you could actually bake this mesh out with colors although I should note coloured meshes can only be rendered in Rhino render not v-ray presently I believe that is a feature coming in or I know six or if you wanted you could export this as a I believe a VRML file bullets coloured mesh and then when I save it I need to make sure that I'm using version 2.0 and I'm exporting vertex colors and so then when I export this I could bring this into another program like 3ds max and i'd have access to my vertex color information all right so that's been a run down a sort of data visualization for simulation optimized in grasshopper and kangaroo cup you enjoyed it
Info
Channel: Daniel Christev
Views: 15,705
Rating: 4.9266057 out of 5
Keywords: yt:quality=high, grasshopper, tutorial, mesh, visualisation, data, simulation, optimisation, optimization, kangaroo, color driven
Id: ln3Hm7Os2Zw
Channel Id: undefined
Length: 30min 57sec (1857 seconds)
Published: Mon Mar 14 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.