Jump to content

UV to mesh with matching prim area


Recommended Posts

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

Link to comment
Share on other sites

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;
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...