Workflow for converting geometry in SOPs/OBJs into USD?

   2783   1   2
User Avatar
Member
61 posts
Joined: April 2018
Offline
I'd appreciate some input on how to best convert geometry, programmatically, from SOPs/OBJs into USD.

In the scene I have, the different “assets” are divided into groups (the attached .hip is a simplified example). Initially I searched for a way of using the groups to convert the geometry to USD, but couldn't find any, so I broke the geo into one OBJ node per group, for feeding into a Scene Import LOP, followed by a USD ROP (in the .hip, under ‘/obj/geo1/lopnet__SceneImport’). This worked to produce one .usd per object, although it based the file paths on Houdini node paths:

To work around this, the only way I found was to use a custom output processor (.py attached) that removes unwanted parts from the save paths. I also needed to disable “Error Saving Layers With Implicit Paths” on the ROP node, so it would downgrade the errors about paths to warnings, and cook successfully. With this, .usd files were saved where I want them, although still with warnings:

To have more control, I ended up scripting the creation of SOP Import, Configure Layer, and other LOPs – one set of them per object (in the .hip, under ‘/obj/geo1/obj_to_lop1/lopnet’). This gave me .usd files exactly where and as I want them (that is, with the intended USD structure); however, I'm worried about the overhead of having to manage these nodes, especially if the number of objects to process is very large. But perhaps this wouldn't be an issue except in extreme scenarios (e.g. thousands of objects)?

So this is what I'm mostly interested in getting some feedback about: Is the last approach the expected way to deal with this scenario – where many assets (at best, separated into OBJs; at worst, separated by attribute/group) are to be converted into USD?

Edit: Reworded for clarity.
Edited by pabcou - Jan. 15, 2020 21:20:42

Attachments:
capture_1.png (50.4 KB)
capture_2.png (44.0 KB)
customprocessor.py (1.1 KB)
main.hiplc (290.2 KB)

User Avatar
Staff
4435 posts
Joined: July 2005
Offline
Creating multiple separate USD files from a single SOP node source using groups is not likely to be something we support. I'm not sure this is even possible given the way that SOP data is imported to LOPs (using the USD file format plugin). I'm sure it would be possible to create an HDA that does something like this (using the SOP Import's “Import Group” parameter and a For Each loop). But we currently have no plans to create such an asset.

On the other hand the Scene Import approach should work much better than it does, and that is a node that will definitely be receiving some attention in the coming months. Being able to control the save paths for each object is definitely one thing we'll need to add. I suppose we could add the ability to split a single SOP into multiple USD references in this node, but it isn't currently in the plan. I see a lot of complications with such an approach and the authoring of transforms on each group…

For now, I think what you've done referencing in each SOP separately is the best approach. You might improve it by using a For Each loop, and maybe using the Import Group parameter on the SOP Import. But again, the transforms would be a problem…
  • Quick Links