Manipulating individual USD Instances (TRS, with animation)

   1107   2   2
User Avatar
Member
146 posts
Joined: Jan. 2016
Offline
Please, what would be the fastest (performance-wise) way to manipulate many individual instances in Solaris, the same way that we can manipulate PackedGeometry primitives inside SOPs (animated translate, rotate, scale)?

I have tried few methods, and I am probably doing it wrong, I am not able to access the Point Instancer with SOP Modify, unless I enable the unpacktopolygons. So far the fastest (with my limited knowledge) is the Modify Point Instances but still it is way slower then working with packed primitives in sops. Is this syntax the fastest way to access Point Instances with the Modify Point Instances LOP please?

/instancer4[*]

I have also tried the Attribute Wrangle LOP which is faster then going into sops and back again (but I managed to make it work only with Instanceable Reference) ... how can I access each individual Point Instance with Attribute Wrangle LOP please?

Attached is the file with my tests (tests _4 and _5 and _6 are with the Point Instancer)
Edited by ikoon - Sept. 23, 2022 04:37:16

Attachments:
usd instances.hiplc (275.5 KB)

User Avatar
Staff
451 posts
Joined: June 2020
Offline
I think the answer probably depends a bit on what modification(s) you're looking to make. For example, in your attribwrangle4it looks like you're just trying to change the position of each instance. That can definitely be done with a wrangle, by modifying the positionsattribute on the PointInstancer. Replace usd_addtranslate(0, @primpath, "my", dist);with v@positions += dist;

Attachments:
wrangle.png (573.3 KB)

User Avatar
Member
146 posts
Joined: Jan. 2016
Offline
Thank you so much Rob! Here is a sample wrangle for animated TRS:

// animate a quaternion
float   angle = float(@elemnum) * 0.00001 * @Frame;
vector  axis  = {0,1,0};
matrix3 m     = ident();
rotate(m, angle, axis);
vector4 orient = quaternion(m);
        
// animate scales
vector scales = set(1, 1,  1 + sin( float(@elemnum) + @Frame * 0.1));

// animate pos
vector pos = set(0, 0.5 * sin( float(@elemnum) + @Frame * 0.15), 0);


// apply to individual instances:
p@orientations  = orient;
v@scales        = scales;
v@positions    += pos;

Attachments:
lop_wrangle.hiplc (101.9 KB)

  • Quick Links