Jump to content

Adjust instances to primitive size


Recommended Posts

Hi guys!

I'm fairly new to Houdini and would love for someone to point me in the right direction.
I'm copying objects on a quadtree plane and want to adjust the size of the instances in order to fit into each primitive. Unfortunately, I can't get the pscale value of the plane, since I'm loosing that in order to copy the objects to the center of the primitive.
I hope that makes sense and would really appreciate any tips.

Thanks,
Misha

 

houdinifx_UYO8AAtlSL.png

recursive_subd_001.hiplc

Link to comment
Share on other sites

Here is a basic setup. It uses a second loop to give each primitive a unique name. Inside the loop, the area for each primitive is stored as an attribute. After the loop, pscale is derived from the area.

Untitled-1.jpg

Use the ramp and the multiplier to dial in the sizes.

ap_recursive_subd_001.hiplc

Edited by Atom
  • Like 2
Link to comment
Share on other sites

To fill quadratic polygons with copies just take the square root of the intrinsic primitive area as point scale:

int pt_add = addpoint(0, v@P);
float area = primintrinsic(0, 'measuredarea', i@primnum);
float scale = sqrt(area);
setpointattrib(0, 'pscale', pt_add, scale, 'set');
removeprim(0, i@primnum, 1);

 

KM_recursive_subd_001.hipnc

  • Like 3
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...