this little tool turned out pretty decent 😁
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20245904/08/24/attribute_delta_null.mp4
this little tool turned out pretty decent 😁
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20245904/08/24/attribute_delta_null.mp4
For no real reason at all I have been spending waaaay too much time reverse engineering Nukes rotosplines so that I can copy them over to houdini. vex hell
Here is where Im at now with the nuke spline. Do not read my atrocious vex code or you might go blind.
still lots of edge cases and features to handle.
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20241403/24/24/houdini_0mgxB8svew.mp4
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20241403/24/24/nukesplajn.hipnc
I have improved on that script since then. We use it at the office now and so far no ill effects.
you just put this in your /python3.10libs folder
it creates backup files every 5 minutes if the undostack has changed. it does it by saving a copy of your scene named Backup_scenename_0001.hip and keeps 20 files that it overwrites in a rotating fashion. you can easily adjust the script for your workflow. (longer intervals more files whatever.)
it has to be named ready.py so that houdini runs it at the correct time.
the benefit with this script is that you never overwrite your actual file. something that the autosave function built in does.
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20242503/15/24/ready.py
Yup looks the version I did (based on @mestela initial work) is slightly faster, but you have to extend the voxel banding at lot on the vdb from polygon itself … after that it’s a single volume vop … it’s probably less clever but faster to execute. Otherwise yes Dom toolset is a way better approach, especially if you can only use SDF primitives.
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20241103/11/24/sop_vdbsoftboolean.1.0.hda
@David Torno
with a bit of help about binary string lookup from a good friend of mine
it’ll spit out a CSV file with this
took a tad longer than I thought – but I think there might be a better way to do this lol
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20245503/10/24/get_versions.hiplc
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20245503/10/24/image.png
Some code for the volume wrangle. Volume goes in input 1. Seed points in input 2. And then you need to construct the control interface.
`//controls int mirror = chi(“mirror”); int distanceMetric = chi(“distanceMetric”);
//init variables float currentdist = 1000000; //pick a super high starting value. In theory, it should be infinite… int closestpt = 0; //placeholder for seed point float dist = 0; //placeholder for distance to seed vector pos = v@P; //current voxel position
//mirror if(mirror == 1) pos.x = abs(pos.x); if(mirror == 2) pos.y = abs(pos.y); if(mirror == 3) pos.z = abs(pos.z);
//calculate distances int pts = npoints(1); for(int pt = 0; pt < pts; pt++){ vector ptpos = point(1, "P", pt); vector vdist = abs(pos - ptpos); //vector distances if(distanceMetric == 0) dist = length(vdist); //euclidian/voronoi distance if(distanceMetric == 1) dist = sum(vdist); //manhattan distance if(distanceMetric == 2) dist = max(vdist); //chebyshev distance
if(dist <= currentdist){ closestpt = pt; currentdist = dist; } }`
Above code will give you a density field that stores the seed values. From there, you can parse it how you need.
(gemming my own code for posterity)
I have just published a new Cloud Solver 😀 drive.google.com/file/d/18RnoiX-Hvn4kM3_L09wT0INXRdRYFjxh/view?usp=drive_link
It is based on the SIGGRAPH Asia 2020 paper “Stormscapes: Simulating Cloud Dynamics in the Now”. It can simulate fog, stratus, stratocumulus, cumulus, cumulonimbus, Kelvin-Helmholtz instability, and more. computationalsciences.org/publications/haedrich-2020-stormscapes.html
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20240502/23/24/cloud2.mp4
this works but I feel like it’s a hack
“`py node = hou.pwd() stage = node.editableStage()
prim = stage.GetPrimAtPath(‘/geo/points_0’)
ptsattrib = prim.GetAttribute(‘points’)
ptsarray = prim.GetAttribute(‘points’).Get()
ptsattrib.Set(ptsarray[::10]) “` weirdly enough the python version doesn’t seem to affect the HoudiniDataId while the vex version sets it to -1 which makes me go hmmmmm
“`py node = hou.pwd() stage = node.editableStage()
prim = stage.GetPrimAtPath(‘/geo/points_0’)
attribs = prim.GetAttributes()
for attrib in attribs:
interp = attrib.GetMetadata(“interpolation”)
if interp == “vertex”:
valarray = attrib.Get() attrib.Set(valarray[::10]) “` this makes more sense as if you have more primvars on your points you would wanna slice those arrays as well
the 10 here drives the percentage of points you want, setting it to 10 gives me 10 percent of my original pointcount
to get 5% you would do 20 because 100/20
“`py node = hou.pwd() stage = node.editableStage()
for prim in stage.Traverse():
if not prim.GetTypeName() == ‘Points’:
continue
attribs = prim.GetAttributes()
for attrib in attribs:
interp = attrib.GetMetadata(“interpolation”)
if interp == “vertex”:
valarray = attrib.Get() attrib.Set(valarray[::10]) “` here’s a version that will cull all your point clouds to keep only 10%. Might be slow if you have a large stage as I’m doing a stage traversal here
this won’t work for an animated pointcloud though
hold on
right, here’s a file with a static point cloud, animated(time dependent), animated(time samples)
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20245502/17/24/image.png
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20245502/17/24/waffles_cull_points_solaris.hip
Ok i stripped the scene down to the main solvers. have fun.
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20244502/14/24/sandsolver_stripped.hiplc
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20244502/14/24/tst.jpg
I’ll post the code in a bit
“`py from pxr import UsdSkel
node = hou.pwd() stage = node.editableStage()
skeleton_prim = None anim_prim = None
for prim in stage.Traverse() :
if prim.GetTypeName() == “Skeleton”:
skeleton_prim = prim
elif prim.GetTypeName() == “SkelAnimation”:
anim_prim = prim
anim_binding = UsdSkel.BindingAPI.Apply(skeleton_prim.GetPrim())
anim_rel = anim_binding.CreateAnimationSourceRel()
anim_rel.AddTarget(anim_prim.GetPrim().GetPath())
vis = skeleton_prim.GetAttribute(“visibility”)
vis.Set(“invisible”)“`
Here’s my file featuring all methods we discussed (you need the dragon and the shark models )
(that snippet also hides the skeleton so it doesn’t show on the dragon)
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20240002/13/24/waffles_usd_apply_anim.hip