random brick rotation (without stamping)

   1597   3   0
User Avatar
Member
1004 posts
Joined: April 2017
Offline
Hi!

I'm making a brick wall generator and I was using copy stamp to have small random rotations. I can see that it gets super slow to calculate when I try to make a big wall. I've also tested with “Pack Geometry Before Copying”.

Is there a better way? I was thinking of using the primitive sop but each brick would need to be considered as one primitive to work…

Thanks.

-Olivier

Attachments:
brick_wall_rand_rotation_query.JPG (282.2 KB)

User Avatar
Member
7737 posts
Joined: Sept. 2011
Online
Use copytopoints, and setup tranform attributes on the points prior to copying. It's potentially hundreds of times faster than stamping.

http://www.sidefx.com/docs/houdini/nodes/sop/copytopoints.html [www.sidefx.com]

http://www.sidefx.com/docs/houdini/copy/instanceattrs.html [www.sidefx.com] For the list of attributes to control how the copies are made
User Avatar
Member
1004 posts
Joined: April 2017
Offline
Nice, thanks!

I was able to change the scale with a simple float but I don't get how to rotate the bricks with orient or rot… I get that I need a vector4 but I'm not sure how to make it work in VEX…

-Olivier
User Avatar
Member
7737 posts
Joined: Sept. 2011
Online
If vector4 quaternion are not your thing, you can use N and up vectors to control the look at and look up vectors. The Z-axis of the input geometry will look at the normal direction, and the Y-axis will align to the up vector. You an also use Euler rotations (rotate xyz) if you convert them to quaternion first. The eulertoquaternion vop can do that for you. The euler convert node might do something silly, such as expect input in radians, so keep that in mind if the output doesn't make sense. Make sure if you bind to ‘orient,’ that you don't forget to set the type to vector4.
  • Quick Links