Orienting instanced geometry to primitive centroid

   5530   2   2
User Avatar
Member
2 posts
Joined: July 2014
Offline
Hi,
I am a Houdini amateur working on a tool that places tiles onto buildings. I followed a great tutorial by Scott Keating explaining how to orient instances to a primitives surface using the point normal inside of a VOPSOP with quaternion / the orient attribute. While this works really well, I think my tool would work better if it could orient the instances to the vector of the center point on each face rather than the normal.

Currently I am getting the center point using a Point SOP and then trying to use that vector for orienting the primitives. It seems to work ok with spheres but doesn't orient properly with flatter surfaces.

I've attached a file with the two approaches, any help would be extremely appreciated!

Attachments:
alignToSurfaceCenter.hipnc (394.5 KB)

User Avatar
Member
483 posts
Joined: Dec. 2006
Offline
Hmmm, maybe this is helpy, if you like to find the center of a primitve with orientation “Convert -> Circle”?
Or is this to simple?

Attachments:
center_on_primitive.hip (62.6 KB)

English is not my native language, sorry in advance for any misunderstanding :-)
User Avatar
Member
453 posts
Joined: Feb. 2013
Online
Currently the most efficient method to get the center of a primitive seems to be to use an Attribute Wrangle set to “Run Over: Primitives” with the following code:

addpoint(0, @P);
removeprim(0, @primnum, 1);

First line adds a point to the center of each primitive. (I believe it uses the point average for the center).
The second line is optional and removes the original primitives.

-
Add an attribute SOP and create an “up” Vector attribute with value something like 0,1,0.
Then use a point VOP to get the vector from each point to wherever you want the object to rotate to. (Goal point minus start point equals vector from goal to start). Normalize that and bind export as the normal attribute “N”.
Feed that into copy and or instance SOP and you get what you want.
  • Quick Links