Assemble vs Pack per connectivity: super slow!

   1256   9   1
User Avatar
Member
1010 posts
Joined: April 2017
Offline
Hi!

I've got a tree with 150 000 leaves. I need to pack them while placing their pivot points at the root of each leaves. I can do it with a for-each loop that places the root at the origin, packs it (with the Pack sop) and moves it back to its original position. This works but it's mega slow in the viewport.

...yet, when I use the Assemble sop (without the for-each loop), I get the same amount of packed primitives but it's not laggy in the viewport. What's the technical difference?
User Avatar
Member
447 posts
Joined: Aug. 2019
Offline
1. Have you tried to compile the whole for-each block? As far as I know, for-each isn't multi-threaded by default, unless you compile them.

2. Please post the file or at least a screenshot of the network.
Edited by raincole - Nov. 28, 2023 21:18:52
User Avatar
Member
8573 posts
Joined: July 2007
Online
olivierth
What's the technical difference?
Sounds like you may be creating unique Packed Geometry primitives while Assemble by default produces Packed Fragments primitives which is more optimized way to pack unique pieces

Also if your leaves are the same topology and shape you may want to instance them rather than keeping each unique
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1010 posts
Joined: April 2017
Offline
raincole: I meant it's slow when I rotate/pan/zoom in the viewport.

tamte: arg, I see. It makes sense that a copy-to-point would be the best option. It's just anoying to setup with multiple leaf types but I'll be good from there. Thanks!

-Olivier
Edited by olivierth - Nov. 29, 2023 10:52:34
User Avatar
Staff
360 posts
Joined: Feb. 2008
Offline
If your leaves are all a single piece of geo to start with, you may want to try the Find Instances SOP in H20.0
User Avatar
Member
8573 posts
Joined: July 2007
Online
npetit
If your leaves are all a single piece of geo to start with, you may want to try the Find Instances SOP in H20.0
how would you make sure that the resulting instances have pivot at the correct place?
I assume that you should be able to plug in custom clean packed prototypes to second input, however I was not able to make it work yet
Edited by tamte - Nov. 30, 2023 16:23:19
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Staff
360 posts
Joined: Feb. 2008
Offline
At the moment when packing the prototypes which get instanced onto the extracted points, the pivot location isn't promoted and is set to "Centroid" by default. I'll add that as an option.

Replacing a prototype however should be pretty simple. You can either replace the prototype entirely or unpack the prototype, offset it to place the desired pivot at the world origin, repack it and set the pivot location to "Origin" and reset the transform (apply the inverse transform of whatever transform you did to set the desired pivot before packing).

Here's an example.

Attachments:
FindInstances_Pivot.hip (228.4 KB)

User Avatar
Member
8573 posts
Joined: July 2007
Online
thanks Nick, I was trying to use Packed primitives in Prototypes input
in your example the geometry is unpacked, which seems to create a lot of ambiguity especially if we need multiple prototypes

I think it would be the most convenient if we could provide custom prototypes as already packed primitives with correct pivot etc.
and the node would just use those as they are to replace any geo that matches

that would also ensure that each prototype can have completely different attributes packed inside without any cross-contamination, which is inevitable if they are unpacked
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Staff
360 posts
Joined: Feb. 2008
Offline
Thanks Tomas, that's a good point.
I've got it working with packed prototypes. As soon as I get the go ahead from our UX Czar I'll backport the changes.
User Avatar
Staff
360 posts
Joined: Feb. 2008
Offline
Tomorrow's build has packing options for the prototypes (create packed fragments and pivot location) as well as supporting user supplied prototypes as packed geo.

The comparisons still happen using the unpacked prototypes, however attributes that are not used for the comparisons are sanitized beforehand to avoid attrib pollution.
  • Quick Links