@jlafleche this is a continuation of Replicator way of doing usd_scene_construction_utils - #7 by Turowicz
The function you helped me with does indeed generate the stacks, but they are the same for each frame of SDG. What I would like is to generate “fresh” stacks for each frame. Unfortunately registering a lambda with the randomizer doesn’t help. My understanding is that I am trying to do something undocumented. That said, it must be possible, since the randomizer.instantiate
function does dynamically load and unload USDs. Would you be able to help me with the modification of the code you wrote in the related issue in order to achieve fresh new stacks each frame?
Cheers!
@pcallender @jlafleche @hclever @dennis.lynch please help me to learn how to proceed here.
The simplest approach is to modify the script to save out N
number of configurations of stacks to individual .usd files, then use instantiate
to sample from them. The files themselves will contain references and xforms and so can be very lightweight.
Another approach using Python consists of emitting a custom event and subsribing a Python function to it. that randomizes the stacks. Let me know if an example of how that works would be helpful.
Let us know if either of those approaches work for your use case or not and why. This is a great workflow and one which we’d definitely want to be able to support in a more natural way if possible.
Dear @jlafleche thank you for your reply.
I am scheduled to tackle this issue early next week. I initially thought about what you said about the dummy usd files but have dismissed it as it would really need to be a 1000 files at least or more for the stacks to be truely randomized. That said, it may turn out to be much faster due to the cost of randomizing stacks on the fly. We are generating many sdg jobs in the cluster and having a defined set of assets that we cache locally for generation definitely helps.
That said, having a factory method for instantiate
would be of tremendous help as today we are using workarounds for many other scenarios.