bbentley81 Posted February 10, 2019 Share Posted February 10, 2019 Hello, I am working on a marvelous designer to Houdini pipeline and I have hit a snag that I am hoping someone could help me with. I am trying to take the draped model and flatten it to the uvs that come out of MD. This part I have working with a point wrangle with "@P = @uv;" The part I am having trouble with is matching the area. I have tried: 1. make a measure sop set to area on both the draped and flatted model 2. promote the area attribute to detail using sum to get the area for the entilre model 3 get a scale factor by drapeArea/uvArea 4. use this in a point wrangle to scale the @P by the scale factor. float currScale = detail(0, "area", 0); float targetScale = detail(1, "area",0); float scaleFactor = targetScale/currScale; @P *= scaleFactor/1000; This, however, is not working. I am not sure if it is a problem with my math or my logic. If anyone can shed some light on this I would be greatly appreciative. I have attached an example hipnc file for reference. Cheers, B matchArea.hipnc Quote Link to comment Share on other sites More sharing options...
anim Posted February 10, 2019 Share Posted February 10, 2019 1 hour ago, bbentley81 said: This, however, is not working. I am not sure if it is a problem with my math or my logic. math, since you are dealing with areas, which are quadratic, to compute linear scale you need to do sqrt() float currScale = detail(0, "area", 0); float targetScale = detail(1, "area",0); float scaleFactor = sqrt(targetScale/currScale); @P *= scaleFactor; Quote Link to comment Share on other sites More sharing options...
julian johnson Posted February 10, 2019 Share Posted February 10, 2019 (edited) @P *= sqrt(scaleFactor); I think if you double the scale of something you quadruple its area... Edit. As Tomas just said! Edited February 10, 2019 by julian johnson Quote Link to comment Share on other sites More sharing options...
bbentley81 Posted February 11, 2019 Author Share Posted February 11, 2019 (edited) YAAAASSSS!! Thank you so much. This worked perfectly!! I've attached the working file for those few who are interested. matchAreaSqrt.hipnc Edited February 11, 2019 by bbentley81 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.