Stevie Mac Posted March 22, 2020 Share Posted March 22, 2020 Hi Guys I'm making a wood fracture HDA & I need to be able to go through the input geo & roate it all so the longest length is pointing up. So I was thinking on a For Loop get the Max BBox then find the longest edge of that then rotate the obejct so that longest edge is always rotated to Houdini's World up or a Transform Y etc. I've only been using Houdni a few years so I don't know how to get these bits & put them in the corrrect way for it to work. So a Shed model made of planks comes in. Each plank needs to be orientated up. I've managed to get some pieces to rotate correctly but some arn't & I know this is down to the Bound node Orientated BBox Option not knowing which way around it is. So is there simple solution to do this? I do understand VEX a bit but this'll take me ages to figure out. Can I get the Max Length of the Geo then some how tell houdini to rotate the geo so that longest edge is paralel to up? I then need to put the Geo back to it's original position & rotation but thats the next bit I gues or I was hopeing to just use Rest before then call it back at the end. Can anyone help me achieve this? Thanks Steve Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 22, 2020 Share Posted March 22, 2020 hey i got sumfin'... vu alignY.hipnc Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted March 22, 2020 Author Share Posted March 22, 2020 Ok I managed to store the BBox in a Attrib Wrangle v@bbox = getbbox_max(0); then find the longest & set that as a Prim Attribute called Max Vecter using VOPs. So maybe I can do this in VOP's easier? So now I need to find out what angle that MaxVextor is on x y or z (using P maybe?) then rotate the BBox so that MaxVector is UP. Looking at the spreadsheet & my plank, up is BBox[1] so I need to change anything not in BBox[1] to rotate 90 until the Max matches BBox[1] slot. No idea how to do that. Thanks if you can help. Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted March 22, 2020 Author Share Posted March 22, 2020 8 hours ago, Noobini said: hey i got sumfin'... vu alignY.hipnc Hey thanks for the help mate I think I managed to do it. I'm not sure if you file saved ok but the Copy to points is a merge node? Either way I swapped that & yours works great in you example but on mine it didn't work. I think it's because your boxes already know what XYZ are where my shed is brought in as an Alembic file as one object. Yours is a lot simple than mine tho! Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 22, 2020 Share Posted March 22, 2020 that merge thing is a PIA....lemme guess you're on H17 ? some H18 nodes for some unfathomable reason appear as merger in 17...go figure Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 22, 2020 Share Posted March 22, 2020 btw, in the bound, tick Transform Attrib...then you get xform[12], [13], [14] that represent the alignment of the bbox...once you got this I think using dihedral can line it up with Y...but I'm not a VEX guru. surely someone here can do it. Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 22, 2020 Share Posted March 22, 2020 also, here's the 17.5 version, I left the stupid merge in there anyway but it really was a copytopoints in H18 the align and distribute is from sidefx labs tools so make sure you have updated it. It just lines them up nicely left to right that's all. vu alignY_17.5.hipnc Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted March 22, 2020 Author Share Posted March 22, 2020 Ok I use the Connectivity node to split the geo up The For loop to go every piece Each piece gets a Bound The TransformAttrib inverts then saves to the xform attrib Wrangle then saves the BBox v@bbox = getbbox_max(0); The VOP then gets that saved BBox & finds the largest size then compares that to all 3 XYZ to find if the largest is Y if not it writes to a Variable Called Yes. The Attrib 'Yes' is used to Switch the transform on which rotates X & Z to 90 since I just need the Geo to point up. Then the rest moves it all back to where it was in the begining for after I add my changes to each piece. This all seems to work so far. Hopefully this'll help someone else who's not a coder! =0) Thanks for looking & the help guys! Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted March 22, 2020 Author Share Posted March 22, 2020 4 minutes ago, Noobini said: also, here's the 17.5 version, I left the stupid merge in there anyway but it really was a copytopoints in H18 the align and distribute is from sidefx labs tools so make sure you have updated it. It just lines them up nicely left to right that's all. vu alignY_17.5.hipnc Thanks mate but still no luck. Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 22, 2020 Share Posted March 22, 2020 what's the problem here ? try a convert after unpack ? Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted March 22, 2020 Author Share Posted March 22, 2020 2 minutes ago, Noobini said: what's the problem here ? try a convert after unpack ? Nope still didn't work. Here's the shed Alembic it's just some test geo I made in 3ds Max then reset the XForm then collapsed it to an Edit Poly. The exported to AlembicShed_Low.ABC Shed_Low.ABC Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 22, 2020 Share Posted March 22, 2020 (edited) i reckon it's pivot related...ie. each piece has the pivot at Origin instead of say at the base of each 'plank'...(or centered to each plank) Edited March 22, 2020 by Noobini Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 22, 2020 Share Posted March 22, 2020 close !!!! if I line up the pivot with the base of the planks. Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 22, 2020 Share Posted March 22, 2020 just change the 'merge' to copytopoints. ignore the wrangle..i was just foolin around with dihedral...but as said useless at VEX. vu alignY.hipnc Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted March 22, 2020 Author Share Posted March 22, 2020 17 minutes ago, Noobini said: just change the 'merge' to copytopoints. ignore the wrangle..i was just foolin around with dihedral...but as said useless at VEX. vu alignY.hipnc Didn't work again but if you do this it will better! Yours Added the first part of mine. Quote Link to comment Share on other sites More sharing options...
Alain2131 Posted March 22, 2020 Share Posted March 22, 2020 Here's my take on it By the way, thanks Noobini, I've always wondered what dihedral did. With this, I now got a better understanding of it This is a VEX-heavy method of doing it. I compute the rotation matrix and bring back to the origin, then find the longest and shortest side, and finally align the piece according the orientation we want, using dihedral. align_bounds_longest_shortest.hipnc 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 22, 2020 Share Posted March 22, 2020 haha great, got there in the end. Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 22, 2020 Share Posted March 22, 2020 just to step back abit... was this all because you need to fracture the wood grain in the correct longest axis wherever the piece of wood happen to point ? coz I thought the RBDmaterialfracture already catered for this situation. Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 23, 2020 Share Posted March 23, 2020 YEEEEEEEEEEEESSSSSSSSSSSSSS. here's my virtually no VEX effort. The VEX I used is so basic any dunce would be able to decipher. vu_AlignY.hiplc Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted March 23, 2020 Author Share Posted March 23, 2020 15 hours ago, Noobini said: just to step back abit... was this all because you need to fracture the wood grain in the correct longest axis wherever the piece of wood happen to point ? coz I thought the RBDmaterialfracture already catered for this situation. Yes but I've made my own Fracture tool. Maybe there's an answer in the RBDFracture tool then too. Thanks for the help man. 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.