Hi there, I’m a beginner in USD and I’m currently trying to export a large scene to USD format for sharing.
This scene was originally authored in Blender, but I was able to export many of the geometry nodes based scattering systems to individual USD files. Now I’d like merge and flatten these separate scattering systems as they use the same underlying geometry.
However, due to sheer number of instances in some circumstances, when I approach roughly 2M some 3D DCC tools just stop working altogether. I tried this workflow in Houdini LOPs and Omniverse USD Composer.
I did read up that Disney USD Moana dataset seems to have a lot more instances than what I ultimately have in this scene, however I’m not sure what needs to be done here to optimize these files for fast loading and sharing.
You can definitely keep the separate files as “separate” files, and still have them sharing the same prototype, but I’m wondering how are you exporting those instances.
Are they PointInstancers or individual instanceable elements ?
To add to that… USD (but not all DCC’s if fully “importing” a USD scene) can handle a scene with tens of millions of Prims in it, but you’ll find life alot easier if, when you have millions of instances, you represent them as PointInstancers. You can combine that with “native instances” (what Paolo called “individual instanceable elements”), in that the prototypes of the PointInstancers can themselves be native instances, so you can break up the instances into PointInstancers as makes sense for your scene organization, and still get quite alot of sharing and scalability.
Do you have any tips as to how can I convert my individual instanceable elements into PointInstancers?
making a script to do that is pretty straight forward for sure, but is there a chance you can handle it at export time directly ? maybe setting it up differently in Blender would export PointInstancers directly… ?
If not, you can have a look at the python files in the this fork of the usd-wg assets repo (hopefully merged in soon), with examples for various types of instancing and how to apply edits to those if needed.
Please, let me know if you need any help with making the script.
Thank you! Certainly, I’d love to get some help with the script.
This scene was originally authored in Geometry Nodes, and the Blender USD exporter seems to support the PointInstancer only when the scattering is done via the Particle Systems instead of Geometry Nodes. As you can see by the image attached:
If there is an easier way to convert these individual instances into the Point Instancer via a script it’d be a lot better. I spent a great deal of time trying to do this conversion manually in Houdini but given my surface level knowledge of Houdini Solaris and USD I haven’t had much success.
happy to help, if you have an example file with just a few elements.
There isn’t a single way to potentially do this, and you can make it easily very specific to your case.
Ideally, you want to end up with classes for the unique “assets”, and PointInstancer prototypes inheriting from those, ensuring those are set instanceable too.
And you can have a single PointInstancer with multiple prototypes or multiple PointInstancers with one prototype each.
I’ll attach an example asset here. This is one of the smaller ones, but I think if the script works for this one, we should be able to replicate it with the other heavier assets as well.
(I didn’t include textures as the resulting .ZIP was too big to upload). USD_Anthurium_Asset.zip (2.0 MB)
You can probably work from this (it should work as is, but in case you have other cases, please, change it).
The idea of the script is to use what Blender sets on what it defines as the “masters” (or prototypes), which are then references on all other instances in your scenes.
Reading the “userProperties:blender:object_name” you can figure out what are those prototypes and use those as “classes” for the PointInstancers prototypes.
This script searches for those blender-prototypes, and writes a new classes file, so whatever setup you have in those prototypes (with materials/textures/etc) it will be untouched.
This file is then referenced in the scene with all the new PointInstancers.
This could be extended checking for the implicit-prototypes and various changes per-instance (attributes per instance), but from what I’ve seen in your scene, there are only transforms on those instances. But you should be able to adjust the script to handle per-instance variation if needed.
It is not setting implicit-instancing on the PointInstancers prototypes as it is ensuring to use one class in one PointInstancer only, but if you want to further split PointInstancers into multiple PointInstancers, you should then make their prototypes instanceable.
Anyway, let me know if this works on a larger scene.
Hi Paolo, sorry for the late reply. I was able to test this script against some of the heavier files and so far, it is looking very promising! Thank you so very much for your help!
I’ll be sharing more details with you as I continue to test it this week.