Houdini Algorithmic Live #076 - Hard Surfacing

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello so is this on live okay so sorry that i'm a little bit late it's around 10 p.m in japan time i would like to start this week's tutorial live for when uh houdini so let me know this if this is on live this is a weekly houdini tutorial live uh called as well gonna make life and this is the 76 episode and the topic for today is to implement a hot surfacing process procedurally using houdini which is pretty similar to what you get using a mesh sharpened side effects labs node but with more customizable parameters and probably a desirable output so this is one of the output you get out of one of the parameters from a verbal toy test geometry if you try to get a similar result i mean if you try to get a result out of a mesh sharpen node from labs let's see what you can what you get out of this node now this node is pretty fast so since it seems like it's using opencl inside though on the result you get doesn't always look better in terms of the final result for example if i use curved nest i mean you get the similar result but it's a bit hard to control with these small number of parameters what you get for an output so in my implementation you have several parameters that you can control with the output for the shapes i think it's a bit more easier to you can get what you need as a final visuals in terms of the the sharpen edges if you need more edges you can reduce the number of curvature blur if you want to have more round the edges or roundy surfaces with less edges you can increase these numbers you get these results and so on now i'm gonna tell you how you can i'll show you uh okay and the wireframe looks like these pretty similar to what you get and with these mesh sharpen edges so i guess uh the main process you do in terms of the this hard surface is pretty similar to what you do in mesh shopping but a little different inside the process i guess okay so hopefully you find this going to be interesting so let's see how i can implement from scratch all right let me first set the background to dark and prepare some geometries uh the easiest geometry to test out initially is a pig head so let me try with the pickaxe first oops let me create a geometry node and any suggestion is welcome if you have any like ideas or anything to make it more optimizable or anything all right so first thing first i am going to delete all the vert uvs and material informations from geometry to make it more usable or a bit be able to recognize the sharpie sharpness so i'm going to use the attribute delete node to remove those informations texture some material right these let me also save this somewhere hard surfacing okay so the way i started in order to try to implement this process is by looking at the the mesh sharpen node and see how this thing works now obviously this is using a curvature to [Music] one of the curvature types to sharpen the edges and let's see if i choose the curvedness and if i control these uh iterations i can see that the edges it it's not remeshing during the process but it's shifting the position of the edges toward a higher curvature i mean the eye can see that these edges are shifting into word to the higher edges and as a result it's creating a really sharpened edges and it doesn't always work [Music] great when you have less number of vertices so in in order for this one to works i i guess you need more vertices so maybe having subdivisions a lot makes it a little better for these for this process to work looks like a mouse okay so now that i know that a little hint how i could implement myself a hard surfacing or mesh sharpen implementation let's see if i can do it myself okay i'm gonna go without subdivide for now and first thing first i can calculate the curvature for each point point for curvature now probably i could use any kind of curvatures but let's see let's visualize these curvatures and see which one looks preferable in terms of the sharpness or hot surfacing okay so these are the craftness type gaussian type mean type or principle type now i i am guessing that either principle mean more or curvedness could be usable and in terms of the curvedness i can use these red parts to be a hard edges or sharp edges for a principle world mean i probably could use these blue uh colored parts or probably these red one as well as the hot edge heart as well in terms of the gaussian doesn't really look great in terms of to be able to make it as a hard edges or sharp edges so probably using mean principle or curvature and i am guessing maybe the curvature is more more suitable in terms of this uh mesh sharpening because i can clearly see that the red part should be a should uh will have a really high curvature like these parts and these parts in it doesn't really care about if this is a convex shape or concave shape it just shows off the result based on the the absolute number absolute value of the curvature so i guess i can just use this one the most um pretty very uh probably the simplest way to curve to estimate the curvature okay so let's say i want to use this type curvature with the curvedness if you want i think you can also change this later so let's just assume that i want this one now next thing i would like to do is to since uh based on the geometry the curvature might looks really um wiggly maybe sometimes too dirty because the geometry has a number of bumps so i am going to add a attribute blur to similar smoothing out the curvature a little bit not the point but instead of the point blurring i'm going to blur the curvature okay and let's try to visualize its output see how it looks like i'm going to use the color node to visualize the curvature to see how it updated okay so let's see from blue one to red one and let's see this output so previously the curvature and looks like these and if i use this attribute blur you can smoothen out the curvature positions and pretty much gather all these hard curvature into a desirable positions like these and more curvature iterations you have i mean more blurring iterations you have the more you can smoothen out these curvatures okay and the next thing i like to do i'm gonna keep the blur iteration one for now and one next thing i like to do is to check out the actual curvature values to see what's the minimum what's the maximum because i have to change these attributes to something else in order to move these points okay so the curvature if i look at the curvature currently the minimum is zero [Music] the maximum is 2.6 so it's not always in between zero to one that's fine because we can just clamp it if it's high enough i mean too high okay so let's see and the next thing i like to do is to get the direction where each of the point should move based on the curvature so as as it is doing in mesh sharpen node we want to move this point toward the higher curvature direction and in order to determine which point goes to which direction based on the curvature in this case if i make this color at this point should always want to go toward these higher curvature directions these points should always want to go to this direction because there is a higher curvature from this point to this point and so on okay and in order to determine those directions you can use a another measure node to measure in this case a gradient of specific attributes so make this point for this measure and change the measure type to gradient and in terms instead of using p as a source attribute i'm going to use the curvature to estimate the gradient direction and as a result you can see you'll be able to create this directional value for each point which goes toward a higher curvature value now you can have this gradient value you can use this one this directional value to move the point toward the curvature to higher curvature to sharpen the edges okay looks good isn't it now let's also check the amount of a distance for each gradient now each gradient is not normalized but it's actually based on the curvature value so i am going to try to show the the the lengths or the size of these vectors for each point let me try to pass that information as new attribute f grad size is equal to the length of gradient and let's show up show this information up with the marker create size and let me also increase the font okay so looking at these values together with these direction you can see that more when the point is closer to the higher curvature you have higher numbers in terms of the the length of the directional value and if it's far from the higher curvatures you have small number in terms of the gradient size but in our case we want to flip this information if you if it's far from the higher curvature i mean if it's far if it's in on top of the a low curvature value meaning if it's close to flat surface you want to move um farther toward the higher curvature value and if the point is already close nearly close to the higher curvatures then you just want to move the point with the small distance so when the curvature is smaller i mean when the size of the gradient is smaller then you want to move move faster when the point when the gradient size is larger then you want to move it move the point slower so that's what you want to do toward these direction okay um i have a comment what is meant with surface parameterization how we can change or fit values i'm not sure what you mean by that okay so let's try to implement those movement in order to move those points based on this gradients and the gradient size so i am going to rename this to move points all right and let's see what we can do what we need to do okay so first thing first we need to determine the the minimum distance we want to move for each point to move okay for example for this point what will be the minimum distance that can move in any direction now we can determine the minimum distance by looking at the the neighbor points or the nearest points within this uh from this point with some range and this the point where it found with the shortest distance probably this point in this case or this point in this case could be the minimum distance it should move to okay so let's try to estimate those distance with those with this method i'm going to try to get the get the shortest distance within a search range or shortest points number within the search range by first of all using a function called new points [Music] from the current point position with a really high number for the search radius but only get two points out of the uh this near point searches the first point will going to be the the point you're searching yourself so if you searching from this point then out of these array that you get with the searches the first point will always be yourself and the second point will be the point which is closest to this original point so probably this point or this point okay oops where did it go i think i have just removed some parameters or something okay here we go okay how do i move this thing all right i'm just gonna reset the view forgot how i do this how am i be able to move this paint have okay i think it's okay now um where was i so so so this new points will give you two result and the second point number is the one that you want to get in terms of the shortest distance so p i'm going to say npt is equal to in pts second point and i am going to get the position for this point to get the distance right so let's do this from the current point position to e and pause all right now um next thing i would like to do is to let's i'm going to call this minimum distance so that i can understand that the distance that i have just calculated is the maximum distance that i want to move the point based on the gradient value okay now next thing i like to do is to get the gradient value as a size so float um red size is equal to a the length of gradient which could be from zero to [Music] more than one let's let me check the maximum and minimum all right looking at the point attribute the maximum is to round two the minimum is around zero so pretty much the same with the curvature all right now by it and we we want to remap this value into the moving distance by using this min distance somehow and somehow if the gradient is large too large we want to clamp it using like fit function or clamp function or anything and make it as a moving distance okay so in order to do that what i'm going to do is using this kind of equations i am going to create a move distance actual move distance by first of all use a fit function for this grad size value which is in between 0 to some value that and for this sum value for the maximum value for the source i'm going to make it a parametric so that you can control how sharp you want in for the output so higher value input for these numbers you get more sharp edges as a final result so if you have small number small value for the sharpness you this means that you are going to clump the value with the small numbers and as a result you're going to have a bit more rounder edges okay and make it one and zero this is because smaller small gradient size you have more you want to move higher gradient size you have you want to move less so i'm going to flip the value to 1 to 0. and the reason why we what the reason why i use one uh one to zero i wanna i wanted to normalize the value so that will be easy to a control the value afterward now after this i am going i'm also going to use the power node to um use the power node to power functions to recalculate the move distance so for example if i type 2 here if it's if the distance is larger than you going if i mean in this case if the value is larger close to 1 you get really you get the value which is really close to 1 but if the value is close to 0 then you get the value really close to 0. but if it's uh in middle like 0.3 or 0.4 you're going to get a value which is close to 0.5 because you have this curve this kind of curve the the value is not no more a linear in terms of x and y but going to be this kind of curve by using it power of 2. and as a result you can exaggerate the curvature value more now this might not be necessary so let's try to parameterize this as well to see what's the difference with the result so i'm gonna name this as um sharpen power okay i think i'm have a spell mistake okay so for the sharpness let's say the default value is going to be i don't know 0.1 should have moved that far so probably in between 0.1 to 0.5 works maybe 0.5 might be too much so let's keep it 0.1 for now and for the shopping power i'm going to make it as 2 for now okay now that i have created this moving distance i can also implement a additional parameter the linear parameter which which you can control in in order to multiply these value or may control the size of this value from 0 to 1. i'm going to create a additional move parameter which is 0.1 as well for now okay finally we have just created the distance we can now move the point toward the gradient with these distance value so let's do this and together with this min minimum distance value so i forgot to use this minimum distance so maybe i can multiply it to this moving distance as well like this okay now let's try to move the point toward this toward the gradient normalized gradient multiplied by this moving distance all right now it's it just moved the point just a little bit you can see it just moved just a little bit and we want to keep this small in terms of the moving distance because if you make it too far with single iterations you can see that it already breaks up or already you already see some geometries messing up so make this small enough and the key is to repeat this process and again and again using a for each loop or anything using recursively so that you can recalculate the curvature in next step and try to change the gradient direction toward this new um curvature and optimize the direction and the distance okay now the final step i there i would want to have a final steps in this case i want to smoothen out the geometry a little bit using this smooth node now using strings of 10 might be too much so i'm gonna keep it as one small enough to smoothen out the point position this is because again um by moving the point sometimes you get these points shifting sometimes it's it creates undesirable like glitches so in order in order to fix this a little bit i'm going to implement this smoothness for all the point position now this is one point this is one set okay and the things that i want to do is to repeat this process and again and again and see what you get as a result okay so let's try to do this for each number i'm gonna use by count and feedback fetch feedback and see how this works i'm going to copy all the all those process inside the loop just like these and try to increase the iterations to see what would happen so currently um the number of iterations equal to 10 now if i increase this up to 50 start cd mesh the edges it's being sharpened a little bit maybe not too much because currently the sharp parameter shop sharpness parameter is currently 0.1 which is rather small so let's try to increase this value to 1.0 see what what will happen now you start to see more exaggerated mesh edges maybe in this case i can reduce the number of iterations more but starting to see more interesting result okay yeah i think it is getting there now let's try to promote these parameters so that i can control these in one place i can see that a lot of people have comments on these with their own ways so you don't really need to follow my own process i mean if you just know the process you can just follow what you believe in right so but thanks for all the suggestions okay so i'm gonna copy all these parameters past all these parameters let's set the range so the sharpness the sharpness could go from zero to two round zero to two i guess since last time we checked the curvature the maximum value was around two also the gradient so let's say the maximum for the sharpness is two the sharpened power maybe we can go from zero to three i don't know what's the best value for these what is we shouldn't move that far so let's reduce the range from 0 to 0.5 okay what else we could also control the number of iterations this spelling iterations as well as well as these smoothing iterations or strings so let's have these values all passed out to this parameter set so the curvature of lowering and we we could reduce the number of maximum number of curvature iterations maybe to 10 the sharpness maybe 50. sharpness i'm going to make a lowercase sharp and power to move and another parameter that i want to get is this smoothing strings okay from 0 to 10 probably okay what else we could do that's pretty much it i guess and or maybe i we could also implement this subdivide subdivisions in between here to control these depths starting from zero we could parametrize this subdivide depths from zero to three that's fine okay the reason why you want to subdivide sometimes it's because you wanna you you'll be able to have more vertices you'll be able to control uh you'll be able to have more detailed sharp edges okay now let's let me try to con change these values and see what you get so if i increase this curvature of blur you try to get less curvature edges in this case maybe i made it too high because this there's already a few number of points for this geometry making these curvature blur high too high it's going to make all these points to have a similar curvature value so maybe we want to reduce this until something like five or some okay this one looks nicer and if i change this sharpness you can see what will be the maximum curvature to use as a maximum for the moving distance equations higher value you'd use more it moves more point moves faster less curvature less sharpness you use points move slower so you get a bit more around the edges okay well the shopping power if you keep this to one all the points move linearly so you have less vertices in the sharpen edges and all the points moves in same speed if you make this two then when the distance is close to the higher curvature or higher gradient it moves faster like this and as a result you get a more sharpened edge right the moving distance this is this is the one that you want to be careful if you make it too much you start to get a flipped edges like these by moving the points too fast okay so in this case keeping this 2.1 seems to be doing good maybe you could also reduce this a little bit more and increase the number of iterations instead now i forgot to bring up the number of iterations as a parameter so let's also bring this one as well gonna copy the situation values yeah i'm just gonna call this iterations from zero to i don't know hundred all right now if i make if i reduce the number of durations you can reduce the the number of calculations and as a result you can reduce the the sharp edges as well probably the combination probably if you want to make more higher detail edges you can reduce the number of move and increase the number of iterations if you want to get faster result you can increase this number and then reduce the number of iterations but less detailed okay so in my way and for my case i want to have a bit more detailed results with higher number of iterations which makes the calculations slower but you get a bit better result okay so let's try to visualize this by promoting the normal direction for each point to a color so that we can see the how sharp sharp it is on these edges so i'm going to use the point wrangle to promote the normal to color now currently the point has doesn't have any normal information so let's create that first using the normal node for the points i'm going to pass that information directly to the color so that we can see the normal direction in color all right just like this and this is the result let me lighten this up a little bit so i can see that i have a sharp edges on these areas these areas these edges i might have a little problem with this flipped edge maybe i can reduce i can tweak the value somewhere around here maybe if i increase the a little bit of smoothness that might fix maybe not or maybe i can reduce the sharpness a little bit yeah it's reducing a little bit and can try out different values right now the blur value is five but if i make this one you have more number of sharp edges let's reduce this and increase the number of iterations yeah you see it's getting sharper and sharper like these looks good now let's try with the let's also increase the subdivisions and see if we can get more detail result now you start to see more edges by increasing the subdivide depths like these having more like a cur carved shape nice now if you increase a more curvature blur like five you start to see more less edges i makes this ten less edges what was this for smooth strings oh yeah if i make this two i'll be able to have more smoother surface positions starting to get some nice results i mean this process i guess this process doesn't have any like exact correct answer because i don't know i mean i i see many people tackling this to this problem so this just wanted to show this is one of my way i found out which seems to create some nice result and with these wireframe now some people might not write like these kind of too close edges so if you want to reduce that probably you could reuse this sharpness a little bit smaller maybe 0.1 then you'll be able to reduce these too close vertices but overall for myself i'm pretty satisfied with what i get as a result like these okay and that's pretty much it okay so let me check the comment if you have any questions or suggestions or anything let me check um let me go back and see hello everybody um thanks red red beard says cup pace thanks for all the informations in terms of the fit functions and minimum maximum okay in time um i have a comment from farid tgv thanks my problem is trying to understand the c graph paper on surf's up where they talk about defining a shader zone on the curved surface here is the link to the article okay that sounds more complicated the one that i'm doing here is more simple stuff but i would like to check that out myself later thank you for the comment why i will evil um this approach is more comfortable than allows me to do it it's siri and i could come from z8 is there any easy way to d wait is there any easy way to de-intersect the mesh in case of the problem also is it possible to add some kind of bevels or for sharpen edges i am not sure about the bevel but in order to de-intersect the mesh in case of the problem like for example one of the pros one of the parameters you can control is this sharpness to reduce the values or as a pause process you could recalculate the curvature maybe right after calculating the normal yet recalculate the curvature for the points you can see these part the higher curvature parts are the all the positions where it always have the problem with the flipped edges or the interior self intersections so for all for only for those parts for those parts which have higher curvatures you can maybe apply a additional blur for the points using these curvatures of white for example attribute blur bring attribute blur and um below the positions based on the curvature and you can see that i mean all the other place all the other position is also blurring but we want to make these point uh the edges which has higher curvatures to be able to have more blurring so we might need to control that by um remapping this curvature value to something exaggerated so let's see what's the curvature volume right now the curvature is currently from 0 to 1. now more curvature you have more iterations or more higher blurring you want to apply but less value you have you want to apply less blurring or maybe not no blurring so in this case we can we probably can clamp the minimum and maximum to make it as a weight so i'm going to create a new weight attribute for the flooring using fit function for the current curvature and we can create a minimum and maximum parameter and fit in to one to zero zero to one higher weight you have you want to have you want to make it higher flooring then you could create additional like power functions to exaggerate the volume let me make this as a variable i'm not sure if this is going to work just going to try okay so let's say the minimum is 0.1 the maximum is 1 and the power is 2 to make a weight apply it as a point attribute okay let me check so from 0 to one okay now let's use this weight and you can see you can kind of see that these edges are moving smoothing out based on this weight now maybe i'm clumping too much these point is not moving so maybe i can reduce the minimum to 0.01 yeah looks better now a little bit better now let's try to create those situations where edges is intersecting okay so [Music] increasing the sharpness to one probably you start to get those sharpie edges two sharpie edges like these part okay and probably this part has really high curvature like these i can see that now let me try increasing the blurring and see if these come on going to be fixed yeah i can see that this gun these things is going to be fixed and we need to recalculate the normal direction and yeah i think this seems this approach seems to work so i'm not sure if this is suitable for your case but as a pass process you could do something like these to avoid the self-intersections okay i don't know if this works for you maybe i can also bring this parameter to this one how do i call this [Music] um post sharp edge blur straight forward say maximum is 20. all right and the result is pretty nice okay seems like i'm having a double edges right here okay maybe we need to tweak a little a little bit of parameters right here which part should be um smoothing out or not but i guess by tweaking these values i think you'll be able to control what you want as a result so i guess these parameters should also be for promoted let me bring up the separator bring all those parameters up let's blow them in post max the name doesn't really sound straightforward but i'm just gonna go with these and the maximum one the minimum one all right so let's test these out okay if i increase this value oh maybe i could increase this volume a little little hard to tweak these values but maybe adding additional attribute blur for the curvature might also work maybe two iterations that seems to do a little bit better job yeah so you probably need these one as well well that's a lot that's a lot of post-processing and a lot of parameters i'm not sure if this is suitable but just as your idea maybe there's a much more effective way to do this efficient way to do this this is just a quick idea that i came up with no really sure this if this is the best way post curvature blur wait a minute this is not the parameter i should bring this one post traveler post all right any other comment i see another it's it's pulling the edge down into the mesh a lot when it should stretch around the mesh right works well enough to be usable that's it it's pulling the edge down into the mesh alone yeah that's right red beard escape base i think so i think that's how it works with these uh implementation way one i see another shop in tech that akira's either provide cluster normal curvature then smooth the boundary edge maybe i can get more good result to mix it with your workflow yes i saw missed the cycles process as well that seems to do a great job as well and especially when it comes to separating those surfaces to different parts i think his approach is much better the this approach sometimes you get really smooth surface like these in between even though when some parts have a higher curvature higher sharpen edges but and blurring into a smart surface so if you want to have a this kind of like attribute or if uh effect effects maybe this approach might suit you but if you want to make all the edges sharpen and separate into clusters i think his ways is much better okay any other comments or any other questions or suggestions i can try out this process i mean this uh set up with the other geometries if i make this curvature one equal to one i also like this kind of setup like having a lot of sharpie edges like these looks mechanical somehow now let's try to change the shape to something else to see it could if this could work for any other geometries now this squab is a hardest things to test out because it has a longer long narrow shape sometimes it messes up for a lot of cases let's see if this could work spending a little bit of time to calculate the downside of this um implementation is that this is pretty slow if you have tons of vertices okay seems to do a great job i think looks nice this is a curvature blur equal to one if i set this to something like six you start to see less number of edges wait a minute i have just increased the subdivide depths no that's not the one that i want whoops oops okay i might going to crush this thing i'm pressing escape right now oops okay i'm gonna prepare trying to salvage the crushed file damn it i cannot really stop this process maybe i should force force quit hopefully the process that i made is left i'm not sure if i have saved it okay let me go to the temporal folder okay let me make this to one okay right one i wanted to increase this to curvature blur not the subdivision depths maybe i need a some morning marker or something or some clump value that it doesn't go over two or three okay looks nice say next result looks more like a comical or comic like shape let's test out with the other geometries like template head this is pretty small let's try with these one see how this one changes this is also interesting starting to get more android like face i increase the curvature of low to 15. you have less edges starting to get more android like face maybe less curvy traveler you get more robotic-like face interesting now i can play out with these parameters and how this changes these facial or edges the sharp edges see how these work so i haven't tried out myself how these ones interact with each other so some value might not work together with some values not sure yet but you could try it by yourself i am going to upload this file that i've just created to a github and i'm going to paste the url to the video description video description page for this youtube live so that you can download the file and test it all yourself or maybe copy paste to your project if you think you could use this just a reminder the process is a bit slow since it's not using any opencl or any optimization process so maybe you can implement that yourself if you find any better way and if you did please let me know in a comment that'll be great what about the river toy okay this one also seems pretty nice a number of edges you can see on the roundy shape a small number of edges on these um more easy to estimate curvature places if you want to have less edges you can just increase this value and there you go all right so i think this seems to work fine i'm gonna end this having a little bit of squeezing right here maybe we need to tweak a little bit of smoothness or some false process maybe i can increase this smooth strength okay this is pretty much it um let me know okay i guess i don't have any questions anymore i'll let i i would like to end the live right here at this point looks nice this would be good for carving stone wood chainsaw i think so i think so too it looks like the looks like a coughed sculpture okay so um as i said you can download the file later from the same url to this live video on the live videos is also going to be archived so that you can watch later and if you are interested in supporting me in terms of making these videos that you can also go to the patreon page for myself that would also be great okay that's pretty much it for today thank you very much and see you next week on wednesday night i'll try to come up with another thing that i found interesting okay so let me take a snapshot of this one and i'll end this live all right looks nice good night and see you next week you
Info
Channel: Junichiro Horikawa
Views: 2,544
Rating: 5 out of 5
Keywords: houdini, sidefx, live, tutorial, procedural, procedural modeling, parametric modeling, parametric design, parametric, fabrication, digital design, computational design, 3d, design, isosurface, lattice, structure, 3d modeling, modeling, computational, generative, line drawing, drawing, illustration, fractal, reaction diffusion, celullar automata, simulation, trail, particle, vfx, mitosis, magnetic field, field, volume, rendering, computer graphics, visualization, algorithm, motion graphics, graphics, remesh, quad
Id: 3AUBNxJ8CSo
Channel Id: undefined
Length: 75min 22sec (4522 seconds)
Published: Wed Sep 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.