Archived post by mattiasmalmer

one step forward two steps back kindof algo πŸ™‚

nice enough result so i will hold on to it.

now back to doing the thing i was actually trying to get done…

i did not like the arbitrariness so I made a better one myself…

“` vector poslist[];
vector p0=point(0,”P”,pts[0]); vector p1=point(0,”P”,pts[1]); vector p2=point(0,”P”,pts[2]);
vector n = normalize(p1 – p0); vector v = p2 – (p0+p1)*.5; vector proj = dot(v, n) * n; vector g = p2 – 2* proj;
append(poslist,g);
for (int i=0; i

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20252006/20/25/houdini_upLMp3SOem.mp4

Archived post by niconghiem

Was toying with the Linear Solver at work this week and ended up writing a Spectral Clustering algorithm that can somehow guess the number of clusters. Finally found a good scenario where it actually made sense to use the Spare_parminputindex trick (and not me obfuscating stuff for no reason <:hyperlaugh:443322845406298112> )

Unfortunately with those data-analysis type of things, the algorithm is not really scale dependent and results vary a lot if the parameters (standard deviation/distance between clusters) are in the good ballpark tho for my use case at work (clustering crowds) those do not really vary much so it’s pretty solid in most cases

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20250806/12/25/dev_spectral_clustering.mp4
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20250806/12/25/spectral_clustering_dev.hiplc

Archived post by lukevanlukevan

okay, let me re do, maybe I can get famous!

Angled and regular tile sampling:

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20253206/11/25/angled.gif
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20253206/11/25/regular.gif
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20253206/11/25/LV.lv_angled_tile_sample.1.0.hdalc
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20253206/11/25/LV.lv_tile_sample.1.0.hdalc

Archived post by sniperjake945

@aswaab dumb ass idea here but what if you splat your velocity from the particles into a volume, hit it with vdb project non divergent, have that node output the pressure field, take the gradient of that pressure field and use that as your velocity? :0
Cuz in theory gravitational fields are equivalent to the gradient of the pressure field (the irrotational component of a velocity field). I’m just curious if that would give you a less streaky result when trying to make the velocity field from your particles…

It probably won’t but it’s at least an idea <:ICANT:1079254533609357433>

But like I guess the intuition here is that because youd be getting the pressure field, that field would be relatively smooth over the full volume, where as just splatting the particle velocities will be relatively discontinuous

image 0 is the velocity field just splatted into a volume and then advecting by that volume. image 1 is doing the same only we’re advecting by the gradient of the pressure. It changes the result though so it’s probably not what you want… but it does create the clumpys!

the scaling of the pressure field is something you might have to futz with. I found my notes on it…
“`c //if staggered volume @vel_pressure *= length(v@dPdx) * length(v@dPdx) * 4;
//if non-staggered volume @vel_pressure *= length(v@dPdx) * length(v@dPdx) * 1; “`
So in the case of my examples you’d want to use the top version which is multiplied by 4. That would give you the field whos gradient can be subtracted from the velocity field in order to make it divergent free. But like your mileage may very, that will definitely change the look of the advected volume…

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20254505/25/25/image.png

Archived post by sniperjake945

here’s a full nbody solver using this method πŸ™‚ i havent really tuned the parms, since i only had like 40 minutes to work on this!!! the one downside is that gas particle to field in accumulate mode doesnt allow for like accumulating over larger radii so its a lil bit scuffed. but it works πŸ™‚

the resolution of the background field is of course important, its probably a bit too low in this example but dgaf

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20250805/24/25/nbody_poisson_solver_v0001.hip

Archived post by mattiasmalmer

cateye…

“`
#bind layer src? val=0 #bind layer !&dst
inline float2 fibonacci_spiral(int n ,int samples) { float phi = (1.0f + sqrt(5.0f)) / 2.0f; // Golden ratio float angle = 2.0f * M_PI * phi * n; float r = 1.0f * sqrt((float)n /samples); // Normalized radius float x = r * cos(angle); float y = r * sin(angle); return (float2)(x,y); }
inline float2 scale_along_vector(float2 pos, float2 dir, float scale) { // Normalize the direction float2 n = normalize(dir); // Project pos onto dir float proj_len = dot(pos, n); float2 proj = proj_len * n; // Compute the component orthogonal to dir float2 ortho = pos – proj; // Scale only the projection return proj * scale + ortho; }

@KERNEL { float2 pos=(float2)(@ix,@iy); float4 color=(float4)(0,0,0,0);
for (int i=0; i<@samples; i++) { float2 disc=fibonacci_spiral(i,@samples)*@radii; float2 dir=pos-(float2)(@xres,@yres)*.5f; float dist=length(dir)/length((float2)(@xres,@yres)*.5f); disc=scale_along_vector(disc , dir ,(1-pow(dist,1.0f)*@squash)); color+=@src.bufferSample(pos+disc); }
@dst.set(color/@samples); }
“`
just make radii, squash and (int)samples in the bindings

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20253105/22/25/image.png

Archived post by mattiasmalmer

the handles are very broken to use in hda:s i bind a point and in the view it says that it is on coordinate 1024,1024 but the bound parameter sets itself to 2048,2048… very odd.

for when tasteful subtleties are not on the menu.

With very little code change you could make it into a ”godray” generator.

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20255905/21/25/houdini_2v0omrwdAd.mp4
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20255905/21/25/cwarp.hiplc
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20255905/21/25/cop_Mattias.chromawarp.1.0.hdalc
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20255905/21/25/image.png