"Pack Geometry Before Merging" for Houdini Engine Maya

   4676   15   1
User Avatar
Member
30 posts
Joined: 9月 2023
Offline
I came across Houdini Engine for Unity's "Pack Geometry Before Merging" feature. I haven't used it, but it looks useful - "If checked, all the different Unity meshes will be packed individually before being merged into the asset's input."

The problem I'm having is that multiple geometries from Maya will always end up merged down to one geometry. For example, I have one 4-face plane and another 1-face plane. Ideally, I want them to appear in Houdini as 2 PackedGeometry prims, with packedfulltransform and such so I can retrieve their transform data. Instead, they merge to 5 Poly prims and I lose all the per-object transform data.

Even though I can separate prims by name using "For-each Named Primitive", I can't get the respective transform information associated with them.

I can't find any similar settings to "Pack Geometry Before Merging" in Houdini Engine for Maya. But in general, the question is Is there something I can do to get per-object transform data from Maya?

I've attached an HDA that displays point/prim/detail attributes in Maya for debugging.

Attachments:
Maya_Debug_Attribute_Output.png (37.2 KB)
Input_Geo.png (13.0 KB)
sop_sliu.show_attribs.1.0.hda (4.4 KB)

User Avatar
スタッフ
528 posts
Joined: 8月 2019
Offline
This is now possible in the plugin bundled with 19.0.1153 and 19.5.787

See: https://www.sidefx.com/forum/topic/72894/?page=1#post-404867 [www.sidefx.com]
User Avatar
Member
30 posts
Joined: 9月 2023
Offline
Great. Thanks for the new feature! Is it possible to add this to Houdini 20 too?
User Avatar
スタッフ
528 posts
Joined: 8月 2019
Offline
It's already present, however it won't be in the initial gold release - the daily build following it will include it.

Will that work for you?
Edited by johnmather - 2023年11月3日 14:40:37
User Avatar
Member
30 posts
Joined: 9月 2023
Offline
I'll make sure to get the build that has this update. Thanks!
User Avatar
Member
5 posts
Joined: 11月 2020
Offline
Hi! I've looked for the "Pack Geometry Before Merging" setting in the attribute editor (Maya), but I couldn't find it.

Here are info from the Houdini Engine pref. in Maya.

Houdini version 19.0.561
Houdini Engine version 4.2 (API:11)
Maya 2022

or the above Houdini Engine version doesn't have this feature?
Thank you.
User Avatar
Member
30 posts
Joined: 9月 2023
Offline
@johnmather I've been testing the new "Pack Geo Before Merge" feature in Maya and it works great!
But I am getting one unwanted behavior, which slows down Maya quite a bit when working with heavy scenes. To demonstrate, I have a HDA that simply outputs the input without any processing. In Maya, it outputs a bunch of transform nodes that seemingly do nothing. On a heavy scene, this makes some Maya commands, such as the PaintVertexColorTool, extremely slow to the point it hangs the application. I'm wondering if there's a workaround to get rid of all that hierarchy, like an HDA normally does without "Pack Geo Before Merge".

Additionally, there's a bug where toggling the Pack Geo Before Merge via cmds
cmds.setAttr("my_hda_node.packBeforeMerge", 1)
, and syncing the asset does nothing. I only get the asset to pack the input geo when I toggle via the Attribute Editor. I believe there is a callback attached to the Pack Geo Before Merge toggle that actually does the work. Can we make it so that cmds.setAttr also works? I cross-checked cmds.setAttr on useInstancerNode, and it behaves properly after a sync, so ideally we have the same behavior on packBeforeMerge.

I'm on version 20.0.547. Thanks!
Edited by nd_sliu - 2024年7月11日 16:00:31

Attachments:
pack-before-merge-annotated.png (60.9 KB)
dont-pack-before-merge-annotated.png (58.4 KB)
test-hda.png (9.1 KB)

User Avatar
スタッフ
528 posts
Joined: 8月 2019
Offline
Would you be able to attach the HDA that you're using?
User Avatar
Member
30 posts
Joined: 9月 2023
Offline
I don't believe we do anything special with the HDA, but I attached a test HDA that just takes the input and connects it to the output. You'll see in Maya it creates a deep hierarchy of transforms when "Pack Geo Before Merge" is enabled.

One other weird behavior I noticed is that if update the input via "Set to Selection", the HDA no longer respects "Pack Geo Before Merge", and the meshes are merged together as if "Pack Geo Before Merge" is disabled. Maybe Houdini Engine needs to double-check the geos are packed after updating the selection?

fwiw, I should mention also that I'm on Maya 2022
Edited by nd_sliu - 2024年7月11日 18:04:59

Attachments:
sop_sliu.test_houdini_engine.1.0.hda (3.1 KB)

User Avatar
スタッフ
528 posts
Joined: 8月 2019
Offline
For the extra transforms, I believe the best way to do this would be to unpack your geometry and pipe it through a Groups From Name node before your output node. Since you're not using instancer nodes, this shouldn't have too much of a performance impact. This will result in the following hierarchy:

sliu__test_houdini_engine__1_01
test_houdini_engine_1_0
_pCylinder1_pCylinderShape1_0
_pCube1_pCubeShape1_1
_pSphere1_pSphereShape1_2

For your other requests, I'll need to look into them a bit further, but I thought I would get you started with this in the mean time.
Edited by johnmather - 2024年7月23日 14:00:15
User Avatar
スタッフ
528 posts
Joined: 8月 2019
Offline
The issue where setting the attribute programatically would fail to run the associated callback has been fixed: https://www.sidefx.com/forum/topic/72894/#post-427287 [www.sidefx.com]
User Avatar
Member
30 posts
Joined: 9月 2023
Offline
Thanks for the programmatic attribute fix! As for your suggestion for using "Groups from Name", I assume unpacking the geometry and grouping by name will throw away the transform info. The reason I was using "Pack Geometry before Merge" is so I can preserve transform going in and out of Houdini, which is essential for some of our tools.

I'll give it a try anyways! But it'd be great to understand what's making Houdini Engine output the deep nested transforms or if there's an easy way to circumvent that.
User Avatar
スタッフ
528 posts
Joined: 8月 2019
Offline
HAPI has a concept called parts [www.sidefx.com], where a number of parts makes up an object. What Maya does, is create a hierarchy that describes the parts and their relations to each other. When building your asset, there is only a single extraneous transform that isn't connected to the asset node, and it's what encloses all of the related parts. Unfortunately changing the way that things are laid out could break some workflows, so it's not something that I'm comfortable with doing. I tried skipping the creation of that group but ran into some errors as other parts of the plugin assume that it exists.

That said, I'm surprised that transforms would have any impact on something like PaintVertexColorTool. Have you taken a look at the profiler to see if perhaps something else is cooking when using that tool?
User Avatar
スタッフ
528 posts
Joined: 8月 2019
Offline
nd_sliu
One other weird behavior I noticed is that if update the input via "Set to Selection", the HDA no longer respects "Pack Geo Before Merge", and the meshes are merged together as if "Pack Geo Before Merge" is disabled.
Thanks for reporting. This has been fixed in 19.5.1071/20.0.798/20.5.326: https://www.sidefx.com/forum/topic/72894/#post-428724 [www.sidefx.com]
Edited by johnmather - 2024年8月13日 18:03:56
User Avatar
Member
30 posts
Joined: 9月 2023
Offline
johnmather
nd_sliu
One other weird behavior I noticed is that if update the input via "Set to Selection", the HDA no longer respects "Pack Geo Before Merge", and the meshes are merged together as if "Pack Geo Before Merge" is disabled.
Thanks for reporting. This has been fixed in 19.5.1071/20.0.798/20.5.326: https://www.sidefx.com/forum/topic/72894/#post-428724 [www.sidefx.com]
Great! I can confirm the "Set to Selection" now respects "Pack Geo Before Merge" on 20.5.326.
However, perhaps the programmatic setAttr fix got lost in this update? I tried
cmds.setAttr("my_hda_node.packBeforeMerge", 1)
cmds.evalDeferred(partial(mel.eval, 'houdiniEngine_syncAsset my_hda_node;'))
but the output still results in a single mesh.
I also tried running just the first line, and hitting "Sync Asset" via Attribute Editor, and got the same issue.
Edited by nd_sliu - 2024年8月15日 17:49:37
User Avatar
スタッフ
528 posts
Joined: 8月 2019
Offline
nd_sliu
Great! I can confirm the "Set to Selection" now respects "Pack Geo Before Merge" on 20.5.326.
However, perhaps the programmatic setAttr fix got lost in this update?
Indeed it did! It looks like a commit from the Unreal plugin partially reverted some of my most recent changes. This will be fixed in 20.5.328.
  • Quick Links