Macha Posted June 20, 2011 Share Posted June 20, 2011 (edited) I have an interesting problem and I hope someone can shed light on this. A while ago I posted this oriented-bounding-box script on sideffects. It orients a bounding box along the "best" axes. http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=88114&highlight=#88114 The problem is that it flips axes with animated objects and, being a statistical method, it can jitter or produce suboptimal results. (The Houdini bounding-box node suffers from the same problem by the way) Does anybody know if there is an algorithm out there that produces better results? I have a feeling the whole thing is connected to finding eigenvectors to get the "best" basis for a set of vectors but I am a bit out of my depth here. Ideas welcome and rewarded with plenty of good karma! Edited June 20, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
Adam Ferestad Posted June 20, 2011 Share Posted June 20, 2011 Hey Marc, I am not sure how to help you, but I wish I did. I will keep an eye on this thread though, because I want to see the answer to your problem. Sorry I can't help. Quote Link to comment Share on other sites More sharing options...
ikarus Posted June 20, 2011 Share Posted June 20, 2011 perhaps you could implement a filtering method that samples over a relative frame range? Quote Link to comment Share on other sites More sharing options...
Macha Posted June 20, 2011 Author Share Posted June 20, 2011 (edited) Well, what I"ve tried so far is to attribute transfer a point id from a previous frame. That keeps point numbers constant. The axis still flip "behind the scenes" but I think I can extract a transform from this and drive another box with it. Need to test it though... By the way, does anybody know how to extract rotation values from a matrix? I tried transform matrix vopsop but it gives no result. Very strange. Edited June 20, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
anim Posted June 21, 2011 Share Posted June 21, 2011 ... By the way, does anybody know how to extract rotation values from a matrix? ... believe it or not there is Extract Transform VOP there you can extract translates, rotates or scales Quote Link to comment Share on other sites More sharing options...
Macha Posted June 21, 2011 Author Share Posted June 21, 2011 (edited) Yes Tomas, I believe you, I am not doubting, but I get strange results. I have a rotating box. I choose a zero point (offset it to 0,0,0), and then 3 other points so that I get a representation of a coordinate system. Say, point 1: 0.3,0.5,0.3 point 2: 0.1,0.23,0.45 point 3: 0.11,0.34,0.34 (I made them up now but imagine they are orthonormal) I then slot them into a matrix, each point for a column. That should give me a basis, right? And putting that into the extract-transform should give me rotation values. But it doesn't, so I"m going wrong somewhere... believe it or not there is Extract Transform VOP there you can extract translates, rotates or scales Edited June 21, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
anim Posted June 21, 2011 Share Posted June 21, 2011 here is an example of Extract Transform VOP Extract_euler_rotation.hip 1 Quote Link to comment Share on other sites More sharing options...
Macha Posted June 21, 2011 Author Share Posted June 21, 2011 (edited) Thanks Anim, that"s great. Looks like I messed up something with my point numbers and looping thing. (So...Houdini's vectors are rows, not columns?) Edited June 21, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
anim Posted June 22, 2011 Share Posted June 22, 2011 ... (So...Houdini's vectors are rows, not columns?) ... yes, that's right for transform matrices in Houdini Quote Link to comment Share on other sites More sharing options...
edward Posted June 22, 2011 Share Posted June 22, 2011 The problem is that it flips axes with animated objects ... So you need to define some sort of "up vector" like concept? How about orientating your axes such that the origin is the smallest OBB corner position and then sorting the vectors? Quote Link to comment Share on other sites More sharing options...
edward Posted June 22, 2011 Share Posted June 22, 2011 yes, that's right for transform matrices in Houdini Isn't it the same with Maya? @Macha: See also http://www.sidefx.co...hom/hou/Matrix4 Quote Link to comment Share on other sites More sharing options...
Jason Posted June 22, 2011 Share Posted June 22, 2011 It would be nice if Houdini had a simple VEX function, kind of like that in the Rivet Object, where you could supply 2 inputs of three points or a primitive and it would return to you the transform it takes to get to one from the other. Quote Link to comment Share on other sites More sharing options...
Macha Posted June 22, 2011 Author Share Posted June 22, 2011 Yes, something like that. Perhaps if the objects are clearly asymetrical on all axes they won't flip in the first place. But for now the setup I made is working. The attribute-transfer-id and caluclating the rotation values from the new base seems to do what I had in mind. No flipping and oriented bounding. It just feels a bit of a hack. So you need to define some sort of "up vector" like concept? How about orientating your axes such that the origin is the smallest OBB corner position and then sorting the vectors? 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.