V4 Orient INSTANCES problem

   1732   5   2
User Avatar
Member
64 posts
Joined: April 2017
Offline
Need help to work with v4 orient values.
I undestand the N normal directions , but dont understand how to control the orient values.
I need this to place INSTANCES on those points with the v4 orient values on them.

In the example image atached:
1. The original object mesh.
2. The INSTANCED objects as I want.(a simple extrude for demostration pourpose)
3. The problem i have. The instanced objects are “steped” (marked in red). I want them maintaining the face direction (marked in green in pic2.)

Any help please, atach example file. Thanks

// set_prim_orient //////////////////////////////////////////////////////
vector up = {0,1,0};
vector nN = normalize(v@N);
matrix3 localrot = matrix3(maketransform(0, 0, {0,0,0}, {90, 0, 0}, {1,1,1}));
matrix3 rot = maketransform(nN, up);
p@orient = quaternion(localrot*rot);
/////////////////////////////////////////////////////////////////////////
Edited by bhbilbao - July 3, 2020 11:15:28

Attachments:
orient_instances_problem.jpg (130.6 KB)

User Avatar
Member
5965 posts
Joined: Sept. 2011
Online
They're lined up with ‘up’ because the y axis was used as the up vector. Use the local y axis of the target shape to get the local up vector, although that isn't necessarily trivial.
User Avatar
Member
64 posts
Joined: April 2017
Offline
The problem is that target shape is not always to be perfect. Sometimes could be deformed.
The “copy-instances-to-prims” must be based on prims, not the object itself.

Attachments:
copy_to_shape_orient.jpg (50.7 KB)

User Avatar
Member
273 posts
Joined: April 2017
Offline
Like jsmack said, figuring out the orientation here isn't very straightforward. If your topology is very consistent, like that ring-like geometry you posted, then it can be done without too much effort, but it still takes a bit of work. Essentially, you split up all of the primitives and for each one, you store the primitive normal as N, and you figure out an up vector by averaging the vectors that represent both of the long edges. Then you create a point at the center of each primitive and transfer that N and up to the point, and finally you copy your objects to those points.

Attaching an example file.

Attachments:
copy_to_prim_centers.png (1.2 MB)
copy_instances_to_prims_toadstorm.hiplc (337.8 KB)

MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
64 posts
Joined: April 2017
Offline
Yeah! Thats it.

I finally solved in the last week using “carves” in a bungler way.
But I think your solution is more clear.

I attach here an screen capture if anybody need it.
Edited by bhbilbao - July 12, 2020 21:54:11

Attachments:
instance_points_orientation.jpg (51.7 KB)

User Avatar
Member
64 posts
Joined: April 2017
Offline
Sorry toadstorm,
outside the INSTANCE node works fine (using copy_to_points), but for some reason, your solution dont work with INSTANCES. (HOUDINI 17.5.543)
https://www.sidefx.com/docs/houdini/nodes/obj/instance.html [www.sidefx.com]

I dont know its a bug or I made something wrong. I have the INSTANCE node option:
Point instancig: Full Point instancing
… and again the instances are showing stepped.
  • Quick Links