Jump to content
5hyuk1n

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks so much for the fast reply guys! all works perfectly!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×