konstantin magnus Posted October 22, 2018 Share Posted October 22, 2018 (edited) How can I move one particle each through the center of these SDF pipes? I think I will be able to define starting points with a volumeslicer (better ideas welcome!) but I am uncertain about moving them. volume_to_particle.hip Edited October 22, 2018 by konstantin magnus Quote Link to comment Share on other sites More sharing options...
mangi Posted October 22, 2018 Share Posted October 22, 2018 Hi, Maybe you can use the geo curve and make A POP Flow along each curve. Here Is a Basic File I put up from and example file and kind of hooked it up with your file. It´s just along on curve. Any way just messing around a bit. M volume_to_particle_flow.hipnc popflow.mov Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted October 22, 2018 Author Share Posted October 22, 2018 (edited) Hi Mike, yes, thats also interesting. But please ignore the curves (I just used them for construction). The input I have is only a volume. The output I want are the curves. Edited October 22, 2018 by konstantin magnus Quote Link to comment Share on other sites More sharing options...
ikoon Posted October 22, 2018 Share Posted October 22, 2018 (edited) SDF is a scalar field. You could add a Volume Analysis SOP (Gradient), which will give you the "normal" direction of your SDF, and then use this normal vector to push the particles to the center of your sdf (POP Advect by Volumes) http://www.sidefx.com/docs/houdini/nodes/sop/volumeanalysis.html You could also generate Collision from your sdf, to keep your particles inside the tunnels. But I think, that those forces will be too tricky to keep the particles in the center of those "tunnels" and art-direct their speed. I would rather fake it in SOPs ... generate centerlines, smooth, multiplicate them, give them some position noise, Slide points along edges (as Matt does it here) The "generation of centerlines" issue remind me of this link: https://houdinigubbins.wordpress.com/2017/07/22/fiedler-vector-and-the-medial-axis/ Unfortunately I am not skilled enough to reproduce that "centerline" setup and source is not included there. Edited October 22, 2018 by ikoon Quote Link to comment Share on other sites More sharing options...
ikoon Posted October 22, 2018 Share Posted October 22, 2018 If those tunnels are not animated, you could separate it into more steps: - somehow manage to keep the particles inside the tunnels, and make them reach their goal, even if their speed and behavior is not exactly what you like - generate their trails (Timeshift to the end and loong Trail) - finetune these trails in SOPs (Smooth, Resample, Point jitter ... and VDB Advect Points can also help to push them into the center of tunnels) - finally Slide points along edges, so you can art direct the speed l am curious about other approaches, this is interesting topic. Quote Link to comment Share on other sites More sharing options...
StepbyStepVFX Posted October 22, 2018 Share Posted October 22, 2018 (edited) Hi, I just throw some ideas, maybe it is redudant with what Mangi posted (can't open the file being at work) : - initial setting of particles : I would create a thin box that intersect with your SDF pipes (vdb combine), then scatter a lot of points within this intersection (thousands, let's say), and then use the Cluster points, with output set on Average Points, and the number of clusters set on the number of SDF pipes you have. That should do the trick. - advect the particles along the SDF pipes : you can indeed try to use a POP Curve. Maybe you can also build a VDB with a velocity based on the SDF : the gradient of the SDF should give you a vector field that goes toward the surface, and from there you can build a new vector field perpendicular to this one, that will follow the "flow". From there you advect the particles using this vector field (VDB Advect POints, inside a SOP Solver). Edited October 22, 2018 by StepbyStepVFX 1 Quote Link to comment Share on other sites More sharing options...
Iskander Posted October 22, 2018 Share Posted October 22, 2018 It's funny, but just today I read an article that can help. I know it is in russian, but math is a universal language.) https://habr.com/company/inobitec/blog/354702/ 2 1 Quote Link to comment Share on other sites More sharing options...
StepbyStepVFX Posted October 22, 2018 Share Posted October 22, 2018 Just to complete a bit, once you have the gradient of the SDF (using a first VDB analysis set on gradient), calculate the curl of the gradient : this should give you the vector field that goes along with the flow. That being said, this vector may be infinite at the center of the VDB... so maybe normalize the curl vector field using a new VDB analysis. My maths on curl calculation in cylindrical coordinates are a bit rusty, but with vectors that are Vtheta = constant, Vrad = constant and Vz=0; the curl should be oriented only in z with Curl.z = constant/radius... whcih goes toward infinity when radius goes to 0. 1 1 Quote Link to comment Share on other sites More sharing options...
Skybar Posted October 22, 2018 Share Posted October 22, 2018 (edited) This could be improved upon but it works for this case (mostly, the intersecting tubes are a problem): volume_to_particle_dv.hip Edited October 22, 2018 by Skybar 2 1 Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted October 22, 2018 Author Share Posted October 22, 2018 (edited) 2 hours ago, ikoon said: The "generation of centerlines" issue remind me of this link: https://houdinigubbins.wordpress.com/2017/07/22/fiedler-vector-and-the-medial-axis/ Yes, this is exactly what I am after. I dont necessarily need to move points along gradients, creating those center lines right away would be even better. Edited October 22, 2018 by konstantin magnus Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted October 23, 2018 Author Share Posted October 23, 2018 (edited) Alright, I created a simple volume crawler. After cutting a slice its basically a solver taking volumesample()s based on directions from sample_direction_cone(), always moving points towards the lowest density. int samples = chi('samples'); float ln = chf('ray_length'); float angle = chf('ray_angle'); vector pos_next = vector(0.0); float dens = 1.0; for(int i = 0; i < samples; i++){ float v = i / float(samples); vector2 u = rand(v); vector dir = sample_direction_cone(v@N, angle, u); vector pos = v@P + (dir * ln); float dens_curr = volumesample(1, 0, pos); if(dens_curr < dens){ pos_next = pos; dens = dens_curr; } } v@N = normalize(pos_next - v@P); v@P = pos_next; Has anyone implemented a more mathematical, more robust or more straight-forward solution to this problem in Houdini? volume_crawler.hiplc Edited October 23, 2018 by konstantin magnus 4 Quote Link to comment Share on other sites More sharing options...
vicvvsh Posted October 25, 2018 Share Posted October 25, 2018 This is my attempt without solver sop. It is not super precisely and in some cases you have to adjusting parm "offset" in volumewrangle1. My setup has limitation - don't work properly when pipes are intersecting. volume_to_particle_01.hipnc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.