"look at" at the SOP level?

   10961   8   2
User Avatar
Member
63 posts
Joined: July 2005
Offline
Hi All-

Is it possible to make a transform SOP “look at” another object at the SOP level? Easy to do with a geo @ the OBJ level, but I need it at the SOP level.

Any ideas?

-jon
User Avatar
Member
7726 posts
Joined: July 2005
Offline
Append a default Transform SOP. In the RX, RY, RZ parameters put in the following expressions:
explodematrix(dihedral(vector3(0,0,-1),vtorigin(“..”,“lookat_path”)), “SRT”, “XYZ”, “RX”)
explodematrix(dihedral(vector3(0,0,-1),vtorigin(“..”,“lookat_path”)), “SRT”, “XYZ”, “RY”)
explodematrix(dihedral(vector3(0,0,-1),vtorigin(“..”,“lookat_path”)), “SRT”, “XYZ”, “RZ”)


Substitute lookat_path with the path to the object you want to look at. You can substitute vector3(0,0,-1) with the axis that you want to align with. I picked the negative Z axis here because that's what the object-level does. Notice that “SRT” is the transform order which should match the transform order of your Transform SOP. Ditto for “XYZ” as the rotation order.
User Avatar
Member
648 posts
Joined: July 2005
Offline
is there an equivalent of the dihedral
function in vops?

-cpb
User Avatar
Member
136 posts
Joined: July 2005
Offline
Align VOP
User Avatar
Member
159 posts
Joined: July 2010
Offline
Thanks for the explodematrix code edward.
I tried this in a copy SOP, where I was copying a bunch of disks to points, where I wanted the disks to be perpenticular to world zero.
It works!
Much thanks
-syntheticperson
User Avatar
Member
8584 posts
Joined: July 2007
Offline
cpb
is there an equivalent of the dihedral
function in vops?…

well, there is directly Look At VOP which will compute rotation matrix from given direction and up vector

be aware of Align VOP and dihedral functions for this as they don't care about up vector and therefore you may be experiencing flipping
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
I found this old thing I apparently made long ago. I think it still probably works…

Attachments:
sop_lookat.otl (16.0 KB)

Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
159 posts
Joined: July 2010
Offline
Graham,

I tried your SOP/lookat, but it does not show up in houdini 12.1.177.
Have you tried it in houdini 12.1.177?

thanks

-syntheticperson
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
I'm assuming you mean 12.1.77, the latest production build, but yes, I see it. Assuming you've got it loaded, it should show up in the tab menu with the name “Geometry Lookat”.
Graham Thompson, Technical Artist @ Rockstar Games
  • Quick Links