Posting this for future reference and so others won’t walk my foolish path “`c // Vertex Wrangle vector quad[] = {{0,0,0}, {0,1,0}, {1,1,0}, {1,0,0}}; vector tri[] = {{0,0,0}, {1,0,0}, {0,1,0}};
int vtx = vertexprimindex(0, i@vtxnum); int vtxcount = primvertexcount(0, i@primnum);
if(vtxcount == 3) v@__intrinsic_uv = tri[vtx]; else if(vtxcount == 4) v@__intrinsic_uv = quad[vtx]; else // Probably should do NGons at some point v@__intrinsic_uv = -1.0; “`
Category: hou-programming
Archived post by mattiasmalmer
Did you guys see this neat SHARD Noise function that @ENDESGA posted on twitter? x.com/ENDESGA/status/1725827957061759092?s=20
I did a quick houdini variant. Also extended it to 4D so that we can phase it.
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20233711/21/23/SHARDNOISE.hiplc
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20233711/21/23/image.png
Archived post by lwwwwwws
as well as the labs csv route you can actually export direct to json just by saving geo with a .hjson extension, you get a big array of each attrib in there (looks like just straight .json works as well in fact)
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20233211/09/23/Screenshot_2023-11-09_at_15.35.09.png
Archived post by captainhammy
One thing I’ve seen some peopel do lately for diffing is to make use of the Attribute From Parameters node to generate all the graph data as points/attribs and then compare things via that
In single mode pointed to a node it also essentialy functions as a “getParms()” thing.
Not that setParms() is anything special either… It just processes all the dict keys/values and sets them. Could easily write a getParms() function that does the same.
Archived post by remipierre
Yeah, I’ve been adding it in every single studio I’ve been in, ahah
`nodegraphtitle.py` in pythonx.xlibs
Archived post by Colemapt96
“`import hou
def lock_hda(node_path): “”” Lock the HDA at the given node path. And then Unlock it now that it has been matched “”” # Get the node node = hou.node(node_path)
# Check if node exists if node is None: print(“Node does not exist.”) return
# Lock the HDA node.matchCurrentDefinition() # Unlock the HDA node.allowEditingOfContents()
# Example usage def otherDefinitions(node_path): ”’Given an HDADefinition object, return the other loaded definitions for the same node type.”’ # Look through all the loaded hda files for definitions providing # the same node type. node = hou.node(node_path) definition = node.type().definition() node_version = definition.nodeTypeName().split(‘::’)[0] result = [] result.append(definition) for hda_file in hou.hda.loadedFiles(): # Skip the hda file containing the definition that was passed in. if hda_file == definition.libraryFilePath(): continue for other_definition in hou.hda.definitionsInFile(hda_file): # print(other_definition) if node_version in other_definition.nodeTypeName().split(‘::’)[0]: result.append(other_definition) else: pass return result def getHighestVersion(node): node_path = node.path() otherDef = otherDefinitions(node_path) highest_version_def = sorted(otherDef, key=lambda x: x.nodeTypeName().split(“::”)[1])[-1] highest_version_name = highest_version_def.nodeTypeName() node.changeNodeType(highest_version_def.nodeTypeName(), keep_parms=True) print(f”Updated HDA {node_path} to version {highest_version_name}”) nodeM = hou.node(‘/path/to/your_node’) # replace path with actual node path node_path = nodeM.path() # get the node path since after we replace the type the direct reference will no longer exist
getHighestVersion(nodeM) # update the HDAs version type
lock_hda(node_path) # lock and unlock the HDA to match internal contents “`
justt got this guy done thought id share since i had to do some digging on how to do it! takes an input node and gets the highest version of that HDA and then updates it to that version and locks and unlocks the HDA to match contents!
Archived post by vfxman222
Ah. I deleted Tailor for a reason. 😂 Always misses an image when stitching.
Instaweb works better, but it’s a PDF, which is silly. Regardless here’s the full thread as PDF.
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20230208/26/23/Paul_Ambrosiussen_ArgumentParser.pdf
Archived post by sniperjake945
If you do find use in this thing, I updated the above vex to fix the numerical issues, so definitely use that. the project file i posted is using the old method which has issues numerically…. And then you can set mu to be something low, like .05 and it’ll resolve really quickly and with much fewer issues…
okay this one fixes the issue ive been talking to myself about
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20235908/15/23/FlattenPrims5_jr_v0003.hiplc
Archived post by sniperjake945
@paqwak i wish houdini had a built in nearest point on single prim function… you can make one yourself by manually computing the barycentric coords…
the local solve from the paper i linked above seems to work pretty well. the idea is to generate prim normals using a normal sop, and then use the following vex in a for loop: @paqwak “`c //run over points int nbs[] = pointprims(0, @ptnum); matrix3 nTn = 0; vector dTn = 0; foreach(int prim; nbs){ vector n = prim(0, “N”, prim); vector p = prim(0, “P”, prim); nTn += outerproduct(n, n); dTn += n * dot(p, n); }
3@A = nTn; v@b = dTn; v@P = invert(3@A) * v@b; //solve Ax=b “`
if you use enough iterations on the above idea, you’ll end up at a point where your for loop with the fuse and stuff no longer really affects the mesh. the only problem with this method is that it requires the geometry to be like manifold and not poopy
the paper wrote the algorithm in matrix form, which does also work (though the normal building step that uses eigenvalues/vecs is really annoying so we skip that and just use a normal sop)
and since we can use a normal sop, really only the bottom half of the algorithm is what we need, and i’ve translated it to the vex above
I also omitted the `mu` stuff since that’s just like a lerp from non-planar to planar… which is a parameter we don’t really need
the above method can be problematic if the matrix A has a really stupid inverse… since i’m solving by inversion, it will cause like crazy results
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20232608/15/23/FlattenPrims5_jr_v0002.hiplc
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20232608/15/23/image.png
Archived post by paqwak
Hello, so looks like packedbounds = bound of the packed geo before any transformation. So if I use copy to point with a scale/pscale attribute it doesn’t not get reflected on packedbound value :S … How do I extract the scale value (x y z) between the the rest (intrinsic.local.transform ?) and intrisic.packedfulltransform ? I’m so lost with those matrix stuff. I could copy/transfer the exising scale/pscale in my copy to point attrib transfer options, but I would like to have the system working just form the packed geo data.
…. mmm looks like the reply is “cracktransform” Oo
“`matrix3 test = primintrinsic(0,”transform”,@primnum); vector t,r,s;
cracktransform (0, 0, @P, test, t, r, s);
vector bound[] = primintrinsic(0, “packedbounds”, @primnum);
vector bboxMin = bound[0]; vector bboxMax = bound[1];
vector bboxDimensions = bboxMax – bboxMin;
float radius = length(max(bboxDimensions.x, bboxDimensions.y,bboxDimensions.z));
@pscale = radius*0.5*chf(“offset”)*max(s.x,s.y,s.z);“`
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20233608/12/23/image.png