Replace Geometry and keep SRT

   5374   3   1
User Avatar
Member
8 posts
Joined: Jan. 2015
Offline
Hello,

while playing around with Houdini I stumbled across a problem which I am not able to solve. My testfile contains several objects which I want to replace with another geometry. With assemble and the copy SOP I was able to copy the new geometry to the position of my original objects, but somehow I am not able to get the correct rotation and scaling. Would be nice if someone could help me out.




Thanks in advance
Mars
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
To do this you need to add proper orient attributes to your input packed point primitives and make sure to enable the Copy SOPs orient attribute toggle.

See the attached scene file for a discrete solution where I insert two SOPs, one above the transform that initializes N and up as orient vectors which are transformed, then after an attribute wrangle SOP that creates a vector size attribute that copies the transform SOPs scale parameters.

I put in two solutions. One that is discrete as mentioned above and one where I ceased a transform_orient SOP that is a simple asset wrapper with a Pack, the two wrangle SOPs and the Transform SOP and promoted the transform handle up so it is pretty much identical to the Transform SOP but with the extra orient attributes created and you end up with a packed primitive for the Copy SOP.

The Copy SOP uses template attributes to do control the Transforms of the copied data. See the help for the Copy SOP.

I used the simplest attributes available by exact name to build a TRS transform:
N
up
scale

There is also float pscale which applies a uniform scale which the transform SOP doesn't support (Primitive SOP does but is a different SOP for different purposes).

Hope that helps.


I like to make things as discrete as possible and try to put as much smarts as possible up the chain as long as it is lightweight. With packed prime and alembics, this is really powerful.

These same attributes are used by Mantra for instancing geometry as well. The Copy SOP is a fabulous instancer now if you feed in packed primitives (alembics, packed prims) in to the left input as well.

Oh and this is an H14 file. Finally!!!!!

Attachments:
copy_sop_packed_orientation_templates.hip (140.9 KB)

There's at least one school like the old school!
User Avatar
Member
8 posts
Joined: Jan. 2015
Offline
Hi jeff,

thanks for taking the time for this comprehensive answer. I'm going to have a look at template attributes and how to set or manipulate them with VEX since it seems that handling these is crucial. Thanks for the support.

Mars
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
With instancing and Copy SOP, yes it is everything, and everywhere. Especially pscale in rbd, fluids, instancing, crowds, etc.
There's at least one school like the old school!
  • Quick Links